adding fs and icon renderers
[vrfileman] / src / icon.cc
diff --git a/src/icon.cc b/src/icon.cc
new file mode 100644 (file)
index 0000000..a72a6d0
--- /dev/null
@@ -0,0 +1,69 @@
+#include <string.h>
+#include "icon.h"
+#include "fs.h"
+#include "meshgen.h"
+#include "mesh.h"
+
+IconRenderer::~IconRenderer()
+{
+}
+
+bool IconRenderer::init()
+{
+       return true;
+}
+
+void IconRenderer::shutdown()
+{
+}
+
+
+// Shapes icon renderer
+enum {
+       SHAPE_SPHERE,
+       SHAPE_BOX,
+       SHAPE_TORUS,
+       SHAPE_CONE,
+       NUM_SHAPES
+};
+
+struct ShapesIconsPriv {
+       Mesh *shape[NUM_SHAPES];
+};
+
+ShapesIcons::ShapesIcons()
+{
+       priv = new ShapesIconsPriv;
+       memset(priv, 0, sizeof *priv);
+}
+
+ShapesIcons::~ShapesIcons()
+{
+       shutdown();
+       delete priv;
+}
+
+bool ShapesIcons::init()
+{
+       for(int i=0; i<NUM_SHAPES; i++) {
+               priv->shape[i] = new Mesh;
+       }
+
+       gen_geosphere(priv->shape[SHAPE_SPHERE], 1.0, 2);
+       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);
+
+       return true;
+}
+
+void ShapesIcons::shutdown()
+{
+       for(int i=0; i<NUM_SHAPES; i++) {
+               delete priv->shape[i];
+       }
+}
+
+void ShapesIcons::draw(FSNode *node) const
+{
+}