fixed Mesh wireframe rendering for non-indexed meshes
[vrfileman] / src / icon.cc
index a72a6d0..502333c 100644 (file)
@@ -49,10 +49,15 @@ bool ShapesIcons::init()
                priv->shape[i] = new Mesh;
        }
 
-       gen_geosphere(priv->shape[SHAPE_SPHERE], 1.0, 2);
+       Mat4 xform;
+
+       gen_geosphere(priv->shape[SHAPE_SPHERE], 0.5, 0);
        gen_box(priv->shape[SHAPE_BOX], 1, 1, 1);
-       gen_torus(priv->shape[SHAPE_TORUS], 0.9, 0.2, 16, 8);
-       gen_cone(priv->shape[SHAPE_CONE], 0.8, 1.0, 8, 2);
+       gen_torus(priv->shape[SHAPE_TORUS], 0.4, 0.1, 12, 6);
+
+       gen_cone(priv->shape[SHAPE_CONE], 0.5, 1.0, 8, 2, 1);
+       xform.translation(0, -0.33, 0);
+       priv->shape[SHAPE_CONE]->apply_xform(xform, Mat4::identity);
 
        return true;
 }
@@ -64,6 +69,23 @@ void ShapesIcons::shutdown()
        }
 }
 
+static int fstype_shape(FSNodeType type)
+{
+       switch(type) {
+       case FSNODE_FILE:
+               return SHAPE_SPHERE;
+       case FSNODE_DIR:
+               return SHAPE_BOX;
+       case FSNODE_DEV:
+               return SHAPE_TORUS;
+       default:
+               break;
+       }
+       return SHAPE_CONE;
+}
+
 void ShapesIcons::draw(FSNode *node) const
 {
+       int s = fstype_shape(node->type);
+       priv->shape[s]->draw();
 }