a72a6d0a095112e67a23da9c899e4c222a9e469b
[vrfileman] / src / icon.cc
1 #include <string.h>
2 #include "icon.h"
3 #include "fs.h"
4 #include "meshgen.h"
5 #include "mesh.h"
6
7 IconRenderer::~IconRenderer()
8 {
9 }
10
11 bool IconRenderer::init()
12 {
13         return true;
14 }
15
16 void IconRenderer::shutdown()
17 {
18 }
19
20
21 // Shapes icon renderer
22 enum {
23         SHAPE_SPHERE,
24         SHAPE_BOX,
25         SHAPE_TORUS,
26         SHAPE_CONE,
27         NUM_SHAPES
28 };
29
30 struct ShapesIconsPriv {
31         Mesh *shape[NUM_SHAPES];
32 };
33
34 ShapesIcons::ShapesIcons()
35 {
36         priv = new ShapesIconsPriv;
37         memset(priv, 0, sizeof *priv);
38 }
39
40 ShapesIcons::~ShapesIcons()
41 {
42         shutdown();
43         delete priv;
44 }
45
46 bool ShapesIcons::init()
47 {
48         for(int i=0; i<NUM_SHAPES; i++) {
49                 priv->shape[i] = new Mesh;
50         }
51
52         gen_geosphere(priv->shape[SHAPE_SPHERE], 1.0, 2);
53         gen_box(priv->shape[SHAPE_BOX], 1, 1, 1);
54         gen_torus(priv->shape[SHAPE_TORUS], 0.9, 0.2, 16, 8);
55         gen_cone(priv->shape[SHAPE_CONE], 0.8, 1.0, 8, 2);
56
57         return true;
58 }
59
60 void ShapesIcons::shutdown()
61 {
62         for(int i=0; i<NUM_SHAPES; i++) {
63                 delete priv->shape[i];
64         }
65 }
66
67 void ShapesIcons::draw(FSNode *node) const
68 {
69 }