VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgRibbon.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2016 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 
90  virtual void setLightingEnabled(bool enable);
91 
93  virtual bool lightingEnabled();
94 
95  protected:
96 
98  virtual void addParticle(osg::Vec3d const& left, osg::Vec3d const& right,
99  double simTime) = 0;
100 
102  virtual float currentSegmentLength() = 0;
103 
105  virtual void extendCurrentSegment(osg::Vec3d const& left,
106  osg::Vec3d const& right, double simTime) = 0;
107 
109  virtual osg::Drawable* getDrawable() = 0;
110 
112  virtual osg::Geode* createGeode();
113 
115  virtual void setDrawable();
116 
117 
118  private:
119 
120  osg::ref_ptr<osg::MatrixTransform> myPositionNode;
121  osg::ref_ptr<osg::Geode> myGeode;
122  osg::Matrixd myWorldTransformInv;
123  osg::Matrixd myLastLocalToWork;
124 
127 
131 
132  osg::Vec3d myLocalPointA;
133  osg::Vec3d myLocalPointB;
134 
135  osg::Vec4 myColor;
138 
141 
143  };
144 
145 }

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)