VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgParticleRibbon.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include <vrvOsg/DtOsgRibbon.h>
12 
14 
15 #include <list>
16 
17 #include <osg/Geometry>
18 #include <osg/PrimitiveSet>
19 
20 namespace osg
21 {
22  class DrawElementsUInt;
23  class Teture;
24 }
25 
26 namespace makVrv
27 {
33  {
34  protected:
36  DtOsgParticleRibbon(DtDe& de, float segmentSpacing,
37  const osg::Vec4& color, osg::Texture* texture,
38  float expansionRate, float maxLength);
39 
41 
43  virtual ~DtOsgParticleRibbon();
44 
45  private:
47  DtOsgParticleRibbon() = delete;
51  DtOsgParticleRibbon &operator=(const DtOsgParticleRibbon&) = delete;
52 
53  public:
54 
56  virtual void update(double dt, double simTime) override;
57 
60  virtual void setAlphaVelocity(float alphaVelocity);
61 
64  virtual void setTextureRepeat(float textureRepeat);
65 
70  virtual void setNewParticlesVisible(bool enable);
71 
72  protected:
74  virtual void addParticle(osg::Vec3d const& left, osg::Vec3d const& right,
75  double simTime) override;
76 
78  virtual float currentSegmentLength() override;
79 
83  virtual void cleanupOldSegments(double simTime) override;
84 
86  virtual void extendCurrentSegment(osg::Vec3d const& left,
87  osg::Vec3d const& right, double simTime) override;
88 
90  virtual osg::Drawable* getDrawable() override;
91 
93  virtual osg::Geode* createGeode() override;
94 
96  virtual int particleIndexAtOffset(int offset);
97 
99  virtual void updateParticles(double dt);
100 
102  virtual void updateGeometryFromParticles(double dt);
103 
105  virtual osg::Vec2 getTextureCoordinateFor(int pointIndex, float vScale) const;
106 
107  protected:
111 
113 
116 
117 
122 
124  struct Particle
125  {
126  osg::Vec3d center;
127  osg::Vec3d left;
128  osg::Vec3d right;
129  osg::Vec3d axis;
130  float angle;
131  float alpha;
132  };
133 
134  typedef std::list<Particle> Particles;
136 
140 
142  };
143 
144  //
145  // Creator for DtOsgParticleRibbons
146  //
148  {
149  public:
150 
153 
154 
156  virtual ~DtOsgParticleRibbonCreator();
157 
160  static DtOsgParticleRibbonCreator& instance(DtDe& de);
161 
164  static void registerInstance(DtDe& de, DtOsgParticleRibbonCreator* creator);
165 
167  virtual DtOsgParticleRibbon* create(DtDe& de, float segmentSpacing,
168  const osg::Vec4& color, osg::Texture* texture,
169  float expansionRate, float maxLength);
170  };
171 }
172 
float angle
left-to-right axis of the particle&#39;s quad
Definition: DtOsgParticleRibbon.h:130
Diagonal crossing liens.
Definition: DtTacticalGraphicUtilities.h:93
bool myNewParticleVisible
Definition: DtOsgParticleRibbon.h:141
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
std::list< Particle > Particles
Definition: DtOsgParticleRibbon.h:134
Definition: DtOsgParticleRibbon.h:147
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
osg::ref_ptr< osg::Vec3Array > myPoints
Definition: DtOsgParticleRibbon.h:108
Particles myParticles
Definition: DtOsgParticleRibbon.h:135
osg::Vec3d axis
Definition: DtOsgParticleRibbon.h:129
osg::ref_ptr< osg::Geometry > myGeometry
Definition: DtOsgParticleRibbon.h:115
float myRotationalVelocity
speed at which particles move apart
Definition: DtOsgParticleRibbon.h:139
double myLastAddTime
Definition: DtOsgParticleRibbon.h:121
float myTextureRepeat
Definition: DtOsgParticleRibbon.h:120
osg::Vec3d center
Definition: DtOsgParticleRibbon.h:126
Contains makVrv::DtVirtualBaseClass class.
osg::ref_ptr< osg::Vec4Array > myColors
Definition: DtOsgParticleRibbon.h:109
Definition for a particle in the ribbon.
Definition: DtOsgParticleRibbon.h:124
osg::Vec3d right
Definition: DtOsgParticleRibbon.h:128
int myParticleIndex
Definition: DtOsgParticleRibbon.h:119
float alpha
How much rotation is applied to the particle.
Definition: DtOsgParticleRibbon.h:131
Base class for OSG ribbon implementations.
Definition: DtOsgRibbon.h:25
A ribbon with some particle system features, such as expansion rate texture, and fading out...
Definition: DtOsgParticleRibbon.h:32
float myAlphaVelocity
Definition: DtOsgParticleRibbon.h:137
osg::ref_ptr< osg::DrawElementsUInt > myRibbon
Definition: DtOsgParticleRibbon.h:114
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
osg::ref_ptr< osg::Vec2Array > myTextureCoordinates
Definition: DtOsgParticleRibbon.h:110
Base class for ribbons.
voidpf uLong offset
Definition: ioapi.h:42
osg::ref_ptr< osg::Texture > myTexture
Definition: DtOsgParticleRibbon.h:112
bool myWrappingVertices
Definition: DtOsgParticleRibbon.h:118
osg::Vec3d left
center back of the particle&#39;s quad
Definition: DtOsgParticleRibbon.h:127
float myExpansionRate
speed at which alpha decreases
Definition: DtOsgParticleRibbon.h:138

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)