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 
36  DtDe& de,
37  float segmentSpacing = 1.0,
38  const osg::Vec4& color = osg::Vec4d(0.5, 0.5, 0.5, 1.0),
39  float maxLength = 2000,
40  float timeout = 3600.0);
41 
43  virtual ~DtOsgRibbon();
44 
45  private:
47  DtOsgRibbon() = delete;
49  DtOsgRibbon(const DtOsgRibbon&) = delete;
51  DtOsgRibbon &operator=(const DtOsgRibbon&) = delete;
52 
53  public:
55  virtual void traverse(osg::NodeVisitor& nv);
56 
58  virtual osg::Node* node();
59 
61  virtual void setColor(const osg::Vec4& color);
62 
64  virtual const osg::Vec4& color() const { return myColor; }
65 
67  virtual void setDroppedPoints(const osg::Vec3d& pointA, const osg::Vec3d& pointB);
68 
72  virtual void setDroppedPointsPositionOffset(const osg::Vec3d& posOffset);
73 
75  virtual void update(double dt, double simTime);
76 
79  virtual void update();
80 
82  virtual void setMaxSegments(long segments);
83 
85  inline virtual long maxSegments() const { return myMaxSegments; }
86 
88  virtual void setSegmentSpacing(float spacing);
89 
91  virtual void setSegmentTimeout(float duration);
92 
94  inline virtual float segmentSpacing() const { return mySegmentSpacing; }
95 
96  // Set ribbon to be stippled or alpha-blended.
102  virtual void setStippled(bool stippled);
103 
108  inline virtual bool isStippled() const { return myStippled; }
109 
111  virtual void setLightingEnabled(bool enable);
112 
114  virtual bool lightingEnabled();
115 
117  virtual void setHeightLinesEnabled(bool enabled);
118 
120  virtual void setHeightLinesColor(float r, float g, float b, float a);
121 
123  virtual void setHeightLinesSpacing(float spacing);
124 
126  virtual void setHeightLinesModelSetId(DtModelSetId modelSetId);
127 
128  protected:
129 
131  virtual void addParticle(osg::Vec3d const& left, osg::Vec3d const& right,
132  double simTime) = 0;
133 
135  virtual float currentSegmentLength() = 0;
138  virtual void setCurrentSegmentLength( float len );
139 
143  virtual void cleanupOldSegments(double simTime) = 0;
144 
146  virtual void extendCurrentSegment(osg::Vec3d const& left,
147  osg::Vec3d const& right, double simTime) = 0;
148 
150  virtual osg::Drawable* getDrawable() = 0;
151 
153  virtual osg::Geode* createGeode();
154 
156  virtual void setDrawable();
157 
158  protected:
159 
162  osg::Matrixd myWorldTransformInv;
163  osg::Matrixd myLastLocalToWork;
164 
168 
174 
175  osg::Vec3d myLocalPointA;
176  osg::Vec3d myLocalPointB;
177  osg::Vec3d myLocalPosOffset;
178 
179  osg::Vec4 myColor;
182 
187  float myHeightLinesColor[4];
190 
191  };
192 
193 }
long myMaxSegments
Definition: DtOsgRibbon.h:169
int myLastUpdatedFrame
Definition: DtOsgRibbon.h:165
virtual long maxSegments() const
Gets the maximum number of segments allowed in the ribbon.
Definition: DtOsgRibbon.h:85
DtModelSetId myHeightLinesModelSetId
Definition: DtOsgRibbon.h:189
osg::Matrixd myWorldTransformInv
Definition: DtOsgRibbon.h:162
bool myFirstUpdate
Definition: DtOsgRibbon.h:180
float mySegmentTimeout
Definition: DtOsgRibbon.h:173
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
bool myStippled
Definition: DtOsgRibbon.h:181
bool myShaderSet
Definition: DtOsgRibbon.h:185
DtDe & myDe
Definition: DtOsgRibbon.h:183
osg::ref_ptr< osg::MatrixTransform > myPositionNode
Definition: DtOsgRibbon.h:160
osg::Vec3d myLocalPointA
Definition: DtOsgRibbon.h:175
virtual bool isStippled() const
Get the stipple setting for this ribbon.
Definition: DtOsgRibbon.h:108
osg::ref_ptr< osg::Geode > myGeode
Definition: DtOsgRibbon.h:161
double myRibbonLengthSquared
Definition: DtOsgRibbon.h:167
bool myLightingEnabled
Definition: DtOsgRibbon.h:184
float mySegmentSpacingSquared
Definition: DtOsgRibbon.h:171
virtual const osg::Vec4 & color() const
Get the ribbon&#39;s color.
Definition: DtOsgRibbon.h:64
osg::Vec3d myLocalPointB
Definition: DtOsgRibbon.h:176
bool myHeightLinesEnabled
Definition: DtOsgRibbon.h:186
osg::Vec3d myLocalPosOffset
Definition: DtOsgRibbon.h:177
osg::Vec4 myColor
Definition: DtOsgRibbon.h:179
Base class for OSG ribbon implementations.
Definition: DtOsgRibbon.h:27
osg::Matrixd myLastLocalToWork
Definition: DtOsgRibbon.h:163
float mySegmentSpacing
Definition: DtOsgRibbon.h:172
virtual float segmentSpacing() const
Gets the maximum length of the ribbon segments.
Definition: DtOsgRibbon.h:94
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:72
int myActiveSegmentCount
Definition: DtOsgRibbon.h:170
float myHeightLinesSpacing
Definition: DtOsgRibbon.h:188
DtModelSetId
Definition: DtModelSetEnums.h:19
double myLastUpdateTime
Definition: DtOsgRibbon.h:166
Contains various enum classes relating to model sets.

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)