VR-Forces 4.8 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) 2020 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  float timeout = 3600.0);
39 
41  virtual ~DtOsgRibbon();
42 
43  private:
45  DtOsgRibbon();
47  DtOsgRibbon(const DtOsgRibbon&);
49  DtOsgRibbon &operator=(const DtOsgRibbon&);
50 
51  public:
53  virtual void traverse(osg::NodeVisitor& nv);
54 
56  virtual osg::Node* node();
57 
59  virtual void setColor(const osg::Vec4& color);
60 
62  virtual const osg::Vec4& color() const { return myColor; }
63 
65  virtual void setDroppedPoints(const osg::Vec3d& pointA, const osg::Vec3d& pointB);
66 
70  virtual void setDroppedPointsPositionOffset(const osg::Vec3d& posOffset);
71 
73  virtual void update(double dt, double simTime);
74 
76  virtual void update() {};
77 
79  virtual void setMaxSegments(long segments);
80 
82  inline virtual long maxSegments() const { return myMaxSegments; }
83 
85  virtual void setSegmentSpacing(float spacing);
86 
88  virtual void setSegmentTimeout(float duration);
89 
91  inline virtual float segmentSpacing() const { return mySegmentSpacing; }
92 
93  // Set ribbon to be stippled or alpha-blended.
99  virtual void setStippled(bool stippled);
100 
105  inline virtual bool isStippled() const { return myStippled; }
106 
108  virtual void setLightingEnabled(bool enable);
109 
111  virtual bool lightingEnabled();
112 
113  protected:
114 
116  virtual void addParticle(osg::Vec3d const& left, osg::Vec3d const& right,
117  double simTime) = 0;
118 
120  virtual float currentSegmentLength() = 0;
121 
125  virtual void cleanupOldSegments(double simTime) = 0;
126 
128  virtual void extendCurrentSegment(osg::Vec3d const& left,
129  osg::Vec3d const& right, double simTime) = 0;
130 
132  virtual osg::Drawable* getDrawable() = 0;
133 
135  virtual osg::Geode* createGeode();
136 
138  virtual void setDrawable();
139 
140  protected:
141 
144  osg::Matrixd myWorldTransformInv;
145  osg::Matrixd myLastLocalToWork;
146 
149 
154 
155  osg::Vec3d myLocalPointA;
156  osg::Vec3d myLocalPointB;
157  osg::Vec3d myLocalPosOffset;
158 
159  osg::Vec4 myColor;
162 
165 
167 
168  };
169 
170 }
long myMaxSegments
Definition: DtOsgRibbon.h:150
int myLastUpdatedFrame
Definition: DtOsgRibbon.h:147
virtual long maxSegments() const
Gets the maximum number of segments allowed in the ribbon.
Definition: DtOsgRibbon.h:82
osg::Matrixd myWorldTransformInv
Definition: DtOsgRibbon.h:144
bool myFirstUpdate
Definition: DtOsgRibbon.h:160
float mySegmentTimeout
Definition: DtOsgRibbon.h:153
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
bool myStippled
Definition: DtOsgRibbon.h:161
bool myShaderSet
Definition: DtOsgRibbon.h:166
DtDe & myDe
Definition: DtOsgRibbon.h:163
osg::ref_ptr< osg::MatrixTransform > myPositionNode
Definition: DtOsgRibbon.h:142
osg::Vec3d myLocalPointA
Definition: DtOsgRibbon.h:155
virtual bool isStippled() const
Get the stipple setting for this ribbon.
Definition: DtOsgRibbon.h:105
osg::ref_ptr< osg::Geode > myGeode
Definition: DtOsgRibbon.h:143
virtual void update()
Optional time independent update method.
Definition: DtOsgRibbon.h:76
bool myLightingEnabled
Definition: DtOsgRibbon.h:164
float mySegmentSpacingSquared
Definition: DtOsgRibbon.h:151
virtual const osg::Vec4 & color() const
Get the ribbon&#39;s color.
Definition: DtOsgRibbon.h:62
osg::Vec3d myLocalPointB
Definition: DtOsgRibbon.h:156
osg::Vec3d myLocalPosOffset
Definition: DtOsgRibbon.h:157
osg::Vec4 myColor
Definition: DtOsgRibbon.h:159
Base class for OSG ribbon implementations.
Definition: DtOsgRibbon.h:25
osg::Matrixd myLastLocalToWork
Definition: DtOsgRibbon.h:145
float mySegmentSpacing
Definition: DtOsgRibbon.h:152
virtual float segmentSpacing() const
Gets the maximum length of the ribbon segments.
Definition: DtOsgRibbon.h:91
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
double myLastUpdateTime
Definition: DtOsgRibbon.h:148

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)