VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtOsgRibbon.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2013 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
14 #include <osg/MatrixTransform>
15 #include <osg/Group>
16 #include <osg/Geode>
17 #include <osg/Vec3>
18 #include <osg/Vec4>
19 
20 namespace makVrv
21 {
22 
25  class DT_DLL_VRVOSG DtOsgRibbon : public osg::Group
26  {
27  public:
28 
34  DtDe& de,
35  float segmentSpacing = 1.0,
36  const osg::Vec4& color = osg::Vec4d(0.5, 0.5, 0.5, 1.0),
37  float maxLength = 2000);
38 
40  virtual ~DtOsgRibbon();
41 
43  virtual void traverse(osg::NodeVisitor& nv);
44 
46  virtual osg::Node* node();
47 
49  virtual void setColor(const osg::Vec4& color);
50 
52  const osg::Vec4& color() const { return myColor; }
53 
55  virtual void setDroppedPoints(const osg::Vec3d& pointA, const osg::Vec3d& pointB);
56 
58  virtual void update(double dt, double simTime);
59 
61  virtual void update() {};
62 
64  virtual void setMaxSegments(long segments);
65 
67  inline long maxSegments() const { return myMaxSegments; }
68 
70  virtual void setSegmentSpacing(float spacing);
71 
73  inline float segmentSpacing() const { return mySegmentSpacing; }
74 
75  // Set ribbon to be stippled or alpha-blended.
81  virtual void setStippled(bool stippled);
82 
87  inline bool isStippled() const { return myStippled; }
88 
89  protected:
90 
92  virtual void addParticle(osg::Vec3d const& left, osg::Vec3d const& right,
93  double simTime) = 0;
94 
96  virtual float currentSegmentLength() = 0;
97 
99  virtual void extendCurrentSegment(osg::Vec3d const& left,
100  osg::Vec3d const& right, double simTime) = 0;
101 
103  virtual osg::Drawable* getDrawable() = 0;
104 
106  virtual osg::Geode* createGeode();
107 
109  virtual void setDrawable();
110 
111  private:
112 
113  osg::ref_ptr<osg::MatrixTransform> myPositionNode;
114  osg::ref_ptr<osg::Geode> myGeode;
115  osg::Matrixd myWorldTransformInv;
116  osg::Matrixd myLastLocalToWork;
117 
120 
124 
125  osg::Vec3d myLocalPointA;
126  osg::Vec3d myLocalPointB;
127 
128  osg::Vec4 myColor;
131 
133  };
134 
135 }

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)