vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
loftturtle.h
Go to the documentation of this file.
1 #ifndef LOFTTURTLE_H_
2 #define LOFTTURTLE_H_
3 
4 #include "movingturtle.h"
5 
6 namespace AP_LSystem {
10 class LoftTurtle : public MovingTurtle
11 {
12 protected:
18  virtual int drawStep( double dist)
19  {
20  int ret = LS_OK;
21 
22  preStep( );
23 
24  osg::Matrixd t;
25  // set movement as half of step
26  t.makeTranslate( HeadVec * dist/2.0f );
27  // move to the center of the step
29 
30  // adjust matrices - process tropism, twist minimalizing
31  adjustMatrices( );
32 
33  // do whatever in the center
34  ret = insideStep();
35  // draw debug
37 
38  // store control point - center of step
39  properties.controlPoint = osg::Vec3d( 0.0, 0.0, 0.0 ) * properties.matrix;
40 
41  // move forward - second half of the step
43 
44  postStep( );
45 
46  return ret;
47  }
48 
53  {
54  if(properties.contour.get())
55  return;
56 
57  osg::Quat q( 2.0f * PI / static_cast<double>(properties.contourDetail), HeadVec );
58 
59  properties.contour = new osg::Vec3dArray( );
60 
61  properties.contour->push_back( LeftVec );
62 
63  for(unsigned int i=1; i<properties.contourDetail; i++)
64  {
65  properties.contour->push_back( q * *(properties.contour->rbegin()) );
66  }
67  }
68 
73  virtual int addContourLoftGeometry();
74 
79  virtual int createLoftGeometryOpening();
80 
81  virtual int insideStep() { return 0; }
82 public:
83  LoftTurtle(void);
84  ~LoftTurtle(void);
85 };
86 }
87 
88 #endif