VR-Forces 5.0.3 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) 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() = delete;
47  DtOsgRibbon(const DtOsgRibbon&) = delete;
49  DtOsgRibbon &operator=(const DtOsgRibbon&) = delete;
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 
77  virtual void update();
78 
80  virtual void setMaxSegments(long segments);
81 
83  inline virtual long maxSegments() const { return myMaxSegments; }
84 
86  virtual void setSegmentSpacing(float spacing);
87 
89  virtual void setSegmentTimeout(float duration);
90 
92  inline virtual float segmentSpacing() const { return mySegmentSpacing; }
93 
94  // Set ribbon to be stippled or alpha-blended.
100  virtual void setStippled(bool stippled);
101 
106  inline virtual bool isStippled() const { return myStippled; }
107 
109  virtual void setLightingEnabled(bool enable);
110 
112  virtual bool lightingEnabled();
113 
114  protected:
115 
117  virtual void addParticle(osg::Vec3d const& left, osg::Vec3d const& right,
118  double simTime) = 0;
119 
121  virtual float currentSegmentLength() = 0;
122 
126  virtual void cleanupOldSegments(double simTime) = 0;
127 
129  virtual void extendCurrentSegment(osg::Vec3d const& left,
130  osg::Vec3d const& right, double simTime) = 0;
131 
133  virtual osg::Drawable* getDrawable() = 0;
134 
136  virtual osg::Geode* createGeode();
137 
139  virtual void setDrawable();
140 
141  protected:
142 
145  osg::Matrixd myWorldTransformInv;
146  osg::Matrixd myLastLocalToWork;
147 
150 
155 
156  osg::Vec3d myLocalPointA;
157  osg::Vec3d myLocalPointB;
158  osg::Vec3d myLocalPosOffset;
159 
160  osg::Vec4 myColor;
163 
166 
168 
169  };
170 
171 }
long myMaxSegments
Definition: DtOsgRibbon.h:151
int myLastUpdatedFrame
Definition: DtOsgRibbon.h:148
virtual long maxSegments() const
Gets the maximum number of segments allowed in the ribbon.
Definition: DtOsgRibbon.h:83
osg::Matrixd myWorldTransformInv
Definition: DtOsgRibbon.h:145
bool myFirstUpdate
Definition: DtOsgRibbon.h:161
float mySegmentTimeout
Definition: DtOsgRibbon.h:154
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
bool myStippled
Definition: DtOsgRibbon.h:162
bool myShaderSet
Definition: DtOsgRibbon.h:167
DtDe & myDe
Definition: DtOsgRibbon.h:164
osg::ref_ptr< osg::MatrixTransform > myPositionNode
Definition: DtOsgRibbon.h:143
osg::Vec3d myLocalPointA
Definition: DtOsgRibbon.h:156
virtual bool isStippled() const
Get the stipple setting for this ribbon.
Definition: DtOsgRibbon.h:106
osg::ref_ptr< osg::Geode > myGeode
Definition: DtOsgRibbon.h:144
bool myLightingEnabled
Definition: DtOsgRibbon.h:165
float mySegmentSpacingSquared
Definition: DtOsgRibbon.h:152
virtual const osg::Vec4 & color() const
Get the ribbon&#39;s color.
Definition: DtOsgRibbon.h:62
osg::Vec3d myLocalPointB
Definition: DtOsgRibbon.h:157
osg::Vec3d myLocalPosOffset
Definition: DtOsgRibbon.h:158
osg::Vec4 myColor
Definition: DtOsgRibbon.h:160
Base class for OSG ribbon implementations.
Definition: DtOsgRibbon.h:25
osg::Matrixd myLastLocalToWork
Definition: DtOsgRibbon.h:146
float mySegmentSpacing
Definition: DtOsgRibbon.h:153
virtual float segmentSpacing() const
Gets the maximum length of the ribbon segments.
Definition: DtOsgRibbon.h:92
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:70
double myLastUpdateTime
Definition: DtOsgRibbon.h:149

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)