implemented a laser pointer
[vrfileman] / src / fs.cc
index 032fd66..3db0012 100644 (file)
--- a/src/fs.cc
+++ b/src/fs.cc
@@ -107,6 +107,7 @@ void draw_fs()
        static const float radius = 0.6;
        static const float umax = 0.42;
        static const float max_icon_angle = M_PI * 2.0 * umax;
+       static const float first_row_y = -row_spacing;
 
        int max_ncols = std::max<int>(1, umax * 12);
 
@@ -122,7 +123,7 @@ void draw_fs()
        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);
+       int ncols = std::max(std::min(cur_node->nfiles, max_ncols), 1);
 
        int first = start_child % ncols;
        int col = 0, row = 0;
@@ -137,6 +138,8 @@ void draw_fs()
        }
 
        // draw the directory link lines
+       glUseProgram(glow_link_sdr);
+       set_uniform_float(glow_link_sdr, "tsec", time_sec);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE);
 
        for(int i=0; i<nchildren; i++) {
@@ -150,23 +153,24 @@ void draw_fs()
 
                Mat4 xform;
                xform.rotate_y(angle);
-               xform.translate(0, -0.3, 0);
+               xform.translate(0, -0.6, 0);
 
-               glUseProgram(glow_link_sdr);
                glPushMatrix();
                glMultMatrixf(xform[0]);
                glDepthMask(0);
 
+               set_uniform_float(glow_link_sdr, "phase", col * 42.0);
+
                glBegin(GL_QUADS);
                glColor3f(0.2, 0.3, 0.8);
                glTexCoord2f(0, 0);
-               glVertex3f(-0.25, 0, 0.05);
+               glVertex3f(-0.2, 0, 0.05);
                glTexCoord2f(1, 0);
-               glVertex3f(0.25, 0, 0.05);
+               glVertex3f(0.2, 0, 0.05);
                glTexCoord2f(1, 1);
-               glVertex3f(0.25, 0, -2.0);
+               glVertex3f(0.2, 0, -10.0);
                glTexCoord2f(0, 1);
-               glVertex3f(-0.25, 0, -2.0);
+               glVertex3f(-0.2, 0, -10.0);
                glColor3f(1, 1, 1);
                glEnd();
                glPopMatrix();
@@ -186,12 +190,13 @@ void draw_fs()
 
                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);
+               draw_node_name(node, angle, -0.6, radius * 1.2, false);
        }
 
        // then draw file icons
        glDisable(GL_BLEND);
        glUseProgram(0);
+       glLineWidth(2.0);
        col = 0;
        for(int i=0; i<nchildren; i++) {
                int idx = (i + first) % nchildren;
@@ -205,7 +210,7 @@ void draw_fs()
                float angle = icon_angle(col, ncols, max_icon_angle);
 
                Mat4 xform = rot_xform;
-               xform.translate(0, row * row_spacing, -radius);
+               xform.translate(0, row * row_spacing + first_row_y, -radius);
                xform.rotate_y(angle);
 
                glPushMatrix();
@@ -218,6 +223,7 @@ void draw_fs()
                        ++row;
                }
        }
+       glLineWidth(1.0);
 
        // then draw the file labels
        glUseProgram(chrome_font_sdr);
@@ -234,7 +240,7 @@ void draw_fs()
 
                float angle = icon_angle(col, ncols, max_icon_angle);
 
-               draw_node_name(node, angle, row * row_spacing - 0.1, radius, false);
+               draw_node_name(node, angle, row * row_spacing + first_row_y - 0.08, radius, false);
 
                if(++col >= ncols) {
                        col = 0;
@@ -255,11 +261,11 @@ static void draw_node_name(FSNode *node, float angle, float ypos, float dist, bo
                const char *name = full ? node->name_lines[i].c_str() : node->short_name.c_str();
                glPushMatrix();
                Mat4 xform;
-               xform.translate(-dtx_string_width(name) / 2.0, -line_height * i, 0);
+               xform.translate(-dtx_string_width(name) / 2.0, -line_height * i - line_height * 0.5, 0);
                if(node->type == FSTYPE_DIR) {
                        xform.rotate_z(deg_to_rad(90));
                        xform.rotate_x(deg_to_rad(-90));
-                       xform.scale(0.0017);
+                       xform.scale(0.0018);
                } else {
                        xform.scale(0.0012);
                }