X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrfileman;a=blobdiff_plain;f=src%2Ficon.cc;h=b6cefffb241ba52d929703864561452858c973f6;hp=a72a6d0a095112e67a23da9c899e4c222a9e469b;hb=f737a4688a44fa05c9a5ea7919819437fae85ae1;hpb=d0cc9ec2f92f149279ebc8f1c29d2be627074488 diff --git a/src/icon.cc b/src/icon.cc index a72a6d0..b6cefff 100644 --- a/src/icon.cc +++ b/src/icon.cc @@ -45,14 +45,21 @@ ShapesIcons::~ShapesIcons() bool ShapesIcons::init() { + const float s = 0.12; + for(int i=0; ishape[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); + Mat4 xform; + + gen_geosphere(priv->shape[SHAPE_SPHERE], 0.5 * s, 0); + gen_box(priv->shape[SHAPE_BOX], 0.7 * s, 0.7 * s, 0.7 * s); + gen_torus(priv->shape[SHAPE_TORUS], 0.4 * s, 0.1 * s, 12, 6); + + gen_cone(priv->shape[SHAPE_CONE], 0.5 * s, 1.0 * s, 8, 2, 1); + xform.translation(0, -0.33 * s, 0); + priv->shape[SHAPE_CONE]->apply_xform(xform, Mat4::identity); return true; } @@ -64,6 +71,23 @@ void ShapesIcons::shutdown() } } +static int fstype_shape(FSNodeType type) +{ + switch(type) { + case FSTYPE_FILE: + return SHAPE_SPHERE; + case FSTYPE_DIR: + return SHAPE_BOX; + case FSTYPE_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_wire(); }