VR-Forces Developer's Guide
 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) 2023 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
15 
16 #include <osg/MatrixTransform>
17 #include <osg/Group>
18 #include <osg/Geode>
19 #include <osg/Vec3>
20 #include <osg/Vec4>
21 
22 namespace makVrv
23 {
24 
27  class DT_DLL_VRVOSG DtOsgRibbon : public osg::Group
28  {
29  public:
30 
38  DtDe& de,
39  float segmentSpacing = 1.0,
40  const osg::Vec4& color = osg::Vec4d(0.5, 0.5, 0.5, 1.0),
41  float maxLength = 2000,
42  float timeout = 3600.0);
43 
45  virtual ~DtOsgRibbon();
46 
47  private:
49  DtOsgRibbon() = delete;
51  DtOsgRibbon(const DtOsgRibbon&) = delete;
53  DtOsgRibbon &operator=(const DtOsgRibbon&) = delete;
54 
55  public:
57  virtual void traverse(osg::NodeVisitor& nv);
58 
60  virtual osg::Node* node();
61 
63  virtual void setColor(const osg::Vec4& color);
64 
66  virtual const osg::Vec4& color() const { return myColor; }
67 
69  virtual void setDroppedPoints(const osg::Vec3d& pointA, const osg::Vec3d& pointB);
70 
74  virtual void setDroppedPointsPositionOffset(const osg::Vec3d& posOffset);
75 
77  virtual void update(double dt, double simTime);
78 
81  virtual void update();
82 
84  virtual void setMaxSegments(long segments);
85 
87  inline virtual long maxSegments() const { return myMaxSegments; }
88 
90  virtual void setSegmentSpacing(float spacing);
91 
93  virtual void setSegmentTimeout(float duration);
94 
96  inline virtual float segmentSpacing() const { return mySegmentSpacing; }
97 
98  // Set ribbon to be stippled or alpha-blended.
104  virtual void setStippled(bool stippled);
105 
110  inline virtual bool isStippled() const { return myStippled; }
111 
113  virtual void setLightingEnabled(bool enable);
114 
116  virtual bool lightingEnabled();
117 
119  virtual void setHeightLinesEnabled(bool enabled);
120 
122  virtual void setHeightLinesColor(float r, float g, float b, float a);
123 
125  virtual void setHeightLinesSpacing(float spacing);
126 
128  virtual void setHeightLinesModelSetId(DtModelSetId modelSetId);
129 
130  protected:
131 
133  virtual void addParticle(osg::Vec3d const& left, osg::Vec3d const& right,
134  double simTime) = 0;
135 
137  virtual float currentSegmentLength() = 0;
140  virtual void setCurrentSegmentLength( float len );
141 
145  virtual void cleanupOldSegments(double simTime) = 0;
146 
148  virtual void extendCurrentSegment(osg::Vec3d const& left,
149  osg::Vec3d const& right, double simTime) = 0;
150 
152  virtual osg::Drawable* getDrawable() = 0;
153 
155  virtual osg::Geode* createGeode();
156 
158  virtual void setDrawable();
159 
160  protected:
161 
164  osg::Matrixd myWorldTransformInv;
165  osg::Matrixd myLastLocalToWork;
166 
170 
176 
177  osg::Vec3d myLocalPointA;
178  osg::Vec3d myLocalPointB;
179  osg::Vec3d myLocalPosOffset;
180 
181  osg::Vec4 myColor;
184 
189  float myHeightLinesColor[4];
192 
193  };
194 
195 }
long myMaxSegments
Definition: DtOsgRibbon.h:171
int myLastUpdatedFrame
Definition: DtOsgRibbon.h:167
virtual long maxSegments() const
Gets the maximum number of segments allowed in the ribbon.
Definition: DtOsgRibbon.h:87
DtModelSetId myHeightLinesModelSetId
Definition: DtOsgRibbon.h:191
osg::Matrixd myWorldTransformInv
Definition: DtOsgRibbon.h:164
bool myFirstUpdate
Definition: DtOsgRibbon.h:182
float mySegmentTimeout
Definition: DtOsgRibbon.h:175
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
bool myStippled
Definition: DtOsgRibbon.h:183
bool myShaderSet
Definition: DtOsgRibbon.h:187
DtDe & myDe
Definition: DtOsgRibbon.h:185
osg::ref_ptr< osg::MatrixTransform > myPositionNode
Definition: DtOsgRibbon.h:162
osg::Vec3d myLocalPointA
Definition: DtOsgRibbon.h:177
virtual bool isStippled() const
Get the stipple setting for this ribbon.
Definition: DtOsgRibbon.h:110
osg::ref_ptr< osg::Geode > myGeode
Definition: DtOsgRibbon.h:163
double myRibbonLengthSquared
Definition: DtOsgRibbon.h:169
bool myLightingEnabled
Definition: DtOsgRibbon.h:186
float mySegmentSpacingSquared
Definition: DtOsgRibbon.h:173
virtual const osg::Vec4 & color() const
Get the ribbon&#39;s color.
Definition: DtOsgRibbon.h:66
osg::Vec3d myLocalPointB
Definition: DtOsgRibbon.h:178
bool myHeightLinesEnabled
Definition: DtOsgRibbon.h:188
osg::Vec3d myLocalPosOffset
Definition: DtOsgRibbon.h:179
osg::Vec4 myColor
Definition: DtOsgRibbon.h:181
Base class for OSG ribbon implementations.
Definition: DtOsgRibbon.h:27
osg::Matrixd myLastLocalToWork
Definition: DtOsgRibbon.h:165
float mySegmentSpacing
Definition: DtOsgRibbon.h:174
virtual float segmentSpacing() const
Gets the maximum length of the ribbon segments.
Definition: DtOsgRibbon.h:96
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
int myActiveSegmentCount
Definition: DtOsgRibbon.h:172
float myHeightLinesSpacing
Definition: DtOsgRibbon.h:190
DtModelSetId
Definition: DtModelSetEnums.h:19
double myLastUpdateTime
Definition: DtOsgRibbon.h:168
Contains various enum classes relating to model sets.

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)