root/src/core/Voxel.cpp

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. compartment
  2. get_id
  3. set_compartment
  4. get_compartment
  5. hide
  6. show
  7. is_visible
  8. set_geometry
  9. set_color

   1 #include "core/Voxel.hpp"
   2 
   3 Voxel::Voxel(const char * id) : id(id)
   4                               , node(new osg::Geometry())
   5                               , compartment(nullptr)
   6 { }
   7 
   8 
   9 Voxel::~Voxel()
  10 { }
  11 
  12 const char *
  13 Voxel::get_id()
  14 {
  15     return id.c_str();
  16 }
  17 
  18 void
  19 Voxel::set_compartment(Compartment * compartment)
  20 {
  21     this -> compartment = compartment;
  22 }
  23 
  24 Compartment *
  25 Voxel::get_compartment()
  26 {
  27     return compartment;
  28 }
  29 
  30 void
  31 Voxel::hide()
  32 {
  33     // node -> setNodeMask(NODE_HIDE_MASK);
  34 }
  35 
  36 void
  37 Voxel::show()
  38 {
  39     // node -> setNodeMask(NODE_SHOW_MASK);
  40 }
  41 
  42 bool
  43 Voxel::is_visible()
  44 {
  45     return true;
  46     // return (node -> getNodeMask() == NODE_SHOW_MASK ? true : false);
  47 }
  48 
  49 void
  50 Voxel::set_geometry( PyObject * distal
  51                    , PyObject * proximal
  52                    , PyObject * parent
  53                    )
  54 {
  55     Vec4f d(pysequence_to_vec4f(distal));
  56 
  57     if(proximal == Py_None)
  58     {
  59         sphere( osg::Vec3f(d[0], d[1], d[2])
  60               , d[3]
  61               , node.get()
  62               , SPHERICAL_VOXEL_POINTS
  63               , SPHERICAL_VOXEL_COLOR
  64               );
  65     }
  66     else
  67     {
  68         Vec4f p(pysequence_to_vec4f(proximal));
  69         cylinder( d
  70                 , p
  71                 , node.get()
  72                 , CYLINDRICAL_VOXEL_POINTS
  73                 , CYLINDRICAL_VOXEL_COLOR
  74                 , pysequence_to_vec3f(parent)
  75                 );
  76     }
  77 }
  78 
  79 void
  80 Voxel::set_color(PyObject * color)
  81 {
  82     Vec4Array * colors = new Vec4Array();
  83     colors -> push_back(pysequence_to_vec4d(color));
  84     node -> setColorArray(colors, osg::Array::BIND_OVERALL);
  85     node -> setColorBinding(osg::Geometry::BIND_OVERALL);
  86 }

/* [<][>][^][v][top][bottom][index][help] */