static dtx_font *fat_font;
#define FAT_FONT_SZ 32
-static unsigned int font_sdr;
+static unsigned int glow_link_sdr;
+static unsigned int chrome_font_sdr, glow_font_sdr;
bool init_fs(const char *path)
}
dtx_use_font(fat_font, FAT_FONT_SZ);
- if(!(font_sdr = create_program_load("sdr/dfont.v.glsl", "sdr/dfont.p.glsl"))) {
+ struct dtx_glyphmap *fat_gmap = dtx_get_glyphmap(fat_font, 0);
+ Vec2 pixsz;
+ pixsz.x = 1.0 / dtx_get_glyphmap_width(fat_gmap);
+ pixsz.y = 1.0 / dtx_get_glyphmap_height(fat_gmap);
+
+ if(!(chrome_font_sdr = create_program_load("sdr/chrome_font.v.glsl", "sdr/chrome_font.p.glsl"))) {
+ return false;
+ }
+ set_uniform_float(chrome_font_sdr, "height", dtx_line_height());
+ set_uniform_float(chrome_font_sdr, "smoothness", 0.01);
+ set_uniform_float2(chrome_font_sdr, "pix_sz", pixsz.x, pixsz.y);
+
+ if(!(glow_font_sdr = create_program_load("sdr/dfont.v.glsl", "sdr/glow_font.p.glsl"))) {
+ return false;
+ }
+ set_uniform_float(glow_font_sdr, "smoothness", 0.01);
+ set_uniform_float2(glow_font_sdr, "pix_sz", pixsz.x, pixsz.y);
+
+ if(!(glow_link_sdr = create_program_load("sdr/glink.v.glsl", "sdr/glink.p.glsl"))) {
return false;
}
- set_uniform_float(font_sdr, "smoothness", 0.01);
if(!(cur_node = get_fsnode(path))) {
return false;
rot_xform.rotate(0, 0, time_sec * 0.5);
glDisable(GL_TEXTURE_2D);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
int nchildren = (int)cur_node->children.size();
int ncols = std::min(cur_node->nfiles, max_ncols);
}
}
- // ... and draw them
- glLineWidth(5.0);
+ // draw the directory link lines
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+
for(int i=0; i<nchildren; i++) {
FSNode *node = cur_node->children[i];
xform.rotate_y(angle);
xform.translate(0, -0.3, 0);
- glUseProgram(0);
+ glUseProgram(glow_link_sdr);
glPushMatrix();
glMultMatrixf(xform[0]);
+ glDepthMask(0);
- glBegin(GL_LINES);
+ glBegin(GL_QUADS);
glColor3f(0.2, 0.3, 0.8);
- glVertex3f(0, 0, -0.3);
- glVertex3f(0, 0, -2);
+ glTexCoord2f(0, 0);
+ glVertex3f(-0.25, 0, 0.05);
+ glTexCoord2f(1, 0);
+ glVertex3f(0.25, 0, 0.05);
+ glTexCoord2f(1, 1);
+ glVertex3f(0.25, 0, -2.0);
+ glTexCoord2f(0, 1);
+ glVertex3f(-0.25, 0, -2.0);
glColor3f(1, 1, 1);
glEnd();
glPopMatrix();
+ glDepthMask(1);
+ }
+
+ // draw the directory labels
+ glUseProgram(glow_font_sdr);
+ col = 0;
+ for(int i=0; i<nchildren; i++) {
+ FSNode *node = cur_node->children[i];
+
+ if(node->type != FSTYPE_DIR) {
+ continue;
+ }
+
+ float angle = (float)col++ / (float)(num_dirs - 1) * max_icon_angle - max_icon_angle * 0.5;
+
draw_node_name(node, angle, -0.3, radius, false);
}
- glLineWidth(1.0);
- // then draw files
+ // then draw file icons
+ glDisable(GL_BLEND);
+ glUseProgram(0);
col = 0;
for(int i=0; i<nchildren; i++) {
int idx = (i + first) % nchildren;
continue;
}
- glUseProgram(0);
-
float angle = icon_angle(col, ncols, max_icon_angle);
Mat4 xform = rot_xform;
iconrend->draw(node);
glPopMatrix();
+ if(++col >= ncols) {
+ col = 0;
+ ++row;
+ }
+ }
+
+ // then draw the file labels
+ glUseProgram(chrome_font_sdr);
+ col = 0;
+ row = 0;
+ for(int i=0; i<nchildren; i++) {
+ int idx = (i + first) % nchildren;
+ FSNode *node = cur_node->children[idx];
+
+ if(node->type == FSTYPE_DIR) {
+ ++num_dirs;
+ continue;
+ }
+
+ float angle = icon_angle(col, ncols, max_icon_angle);
+
draw_node_name(node, angle, row * row_spacing - 0.1, radius, false);
if(++col >= ncols) {
xform.rotate_y(angle);
glMultMatrixf(xform[0]);
- glUseProgram(font_sdr);
- set_uniform_float(font_sdr, "height", line_height);
dtx_string(name);
glPopMatrix();
}