VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgTrackHistoryRibbon.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/DtOsgRibbon.h>
14 
16 
17 #include <osg/Geometry>
18 
19 namespace osg
20 {
21  class DrawElementsUInt;
22 }
23 
24 namespace makVrv
25 {
26 
27  class DtSceneObject;
28 
32  {
33  protected:
39  DtOsgTrackHistoryRibbon(DtDe& de, float segmentSpacing,
40  const osg::Vec4& color, float maxLength, float timeout);
41 
43 
44  public:
46  virtual ~DtOsgTrackHistoryRibbon();
47 
48  private:
50  DtOsgTrackHistoryRibbon() = delete;;
54  DtOsgTrackHistoryRibbon &operator=(const DtOsgTrackHistoryRibbon&) = delete;;
55 
56  public:
58  virtual void traverse(osg::NodeVisitor& nv) override;
59 
63  virtual void setMaxSegments(long segments) override;
64 
65  protected:
66 
68  virtual void addParticle(osg::Vec3d const& left,
69  osg::Vec3d const& right, double simTime);
70 
72  virtual float currentSegmentLength();
73 
75  virtual void extendCurrentSegment(osg::Vec3d const& left,
76  osg::Vec3d const& right, double simTime);
77 
81  virtual void cleanupOldSegments(double simTime);
82 
86  virtual osg::Drawable* getDrawable();
87 
89  virtual int particleIndexAtOffset(int offset);
90 
93  virtual void update() override;
94 
96  virtual void setColor(const osg::Vec4& color);
97 
102  virtual void updateBounds(const osg::Vec3& point);
103 
104  protected:
108  class TrackHistoryGeometry : public osg::Geometry
109  {
114  {
115  public:
118 
122  const osg::CopyOp& copyop);
123 
125  virtual ~ComputeBoundsCallback();
126 
134  virtual osg::BoundingBox computeBound(const osg::Drawable& g) const;
135 
138  void dirtyBound();
139 
140  private:
141  mutable bool myDirtyBound;
142  };
143 
144  friend class ComputeBoundsCallback;
145 
146  public:
149 
152  const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
153 
155  virtual ~TrackHistoryGeometry();
156 
159  virtual void expandBoundBy(const osg::Vec3d& point);
160  };
161 
162  protected:
163 
165 
169 
171 
172  std::vector<double> mySegmentCreationTimes;
173 
177  };
178 
179  //
180  // Creator for DtOsgTrackHistoryRibbons
181  //
183  {
184  public:
185 
188 
189 
192 
195  static DtOsgTrackHistoryRibbonCreator& instance(DtDe& de);
196 
199  static void registerInstance(DtDe& de, DtOsgTrackHistoryRibbonCreator* creator);
200 
202  virtual DtOsgTrackHistoryRibbon* create(DtDe& de, float segmentSpacing,
203  const osg::Vec4& color, float maxLength, float timeout);
204  };
205 }
osg::ref_ptr< DtSharedDrawElementsUInt > myTopLine
Definition: DtOsgTrackHistoryRibbon.h:168
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
Contains makVrv::DtSharedDrawElementsUInt class.
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
int myActiveParticleCount
Definition: DtOsgTrackHistoryRibbon.h:176
int myParticleStartIndex
Definition: DtOsgTrackHistoryRibbon.h:175
Definition: DtOsgTrackHistoryRibbon.h:182
Contains makVrv::DtVirtualBaseClass class.
Bounding box computation callback. Calculates the bounding box of the current track history ribbon...
Definition: DtOsgTrackHistoryRibbon.h:112
Geometry for the track history. Allows expansion of the geometry&#39;s bounding box as the ribbon grows w...
Definition: DtOsgTrackHistoryRibbon.h:108
osg::ref_ptr< DtSharedDrawElementsUInt > myRibbon
Definition: DtOsgTrackHistoryRibbon.h:166
Base class for OSG ribbon implementations.
Definition: DtOsgRibbon.h:25
osg::ref_ptr< DtSharedDrawElementsUInt > myBottomLine
Definition: DtOsgTrackHistoryRibbon.h:167
std::vector< double > mySegmentCreationTimes
Definition: DtOsgTrackHistoryRibbon.h:172
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
Base class for ribbons.
voidpf uLong offset
Definition: ioapi.h:42
OSG implementation of a track history ribbon.
Definition: DtOsgTrackHistoryRibbon.h:31
osg::ref_ptr< TrackHistoryGeometry > myGeometry
Definition: DtOsgTrackHistoryRibbon.h:170
osg::ref_ptr< osg::Vec3Array > myPoints
Definition: DtOsgTrackHistoryRibbon.h:164
int myParticleIndex
Definition: DtOsgTrackHistoryRibbon.h:174

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)