7 IconRenderer::~IconRenderer()
11 bool IconRenderer::init()
16 void IconRenderer::shutdown()
21 // Shapes icon renderer
30 struct ShapesIconsPriv {
31 Mesh *shape[NUM_SHAPES];
34 ShapesIcons::ShapesIcons()
36 priv = new ShapesIconsPriv;
37 memset(priv, 0, sizeof *priv);
40 ShapesIcons::~ShapesIcons()
46 bool ShapesIcons::init()
48 for(int i=0; i<NUM_SHAPES; i++) {
49 priv->shape[i] = new Mesh;
54 gen_geosphere(priv->shape[SHAPE_SPHERE], 0.5, 0);
55 gen_box(priv->shape[SHAPE_BOX], 0.7, 0.7, 0.7);
56 gen_torus(priv->shape[SHAPE_TORUS], 0.4, 0.1, 12, 6);
58 gen_cone(priv->shape[SHAPE_CONE], 0.5, 1.0, 8, 2, 1);
59 xform.translation(0, -0.33, 0);
60 priv->shape[SHAPE_CONE]->apply_xform(xform, Mat4::identity);
65 void ShapesIcons::shutdown()
67 for(int i=0; i<NUM_SHAPES; i++) {
68 delete priv->shape[i];
72 static int fstype_shape(FSNodeType type)
87 void ShapesIcons::draw(FSNode *node) const
89 int s = fstype_shape(node->type);
90 priv->shape[s]->draw_wire();