![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2008 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtOsgParticleRibbon.h,v $ $Revision: 1.15 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00011 00012 #ifndef DtOsgParticleRibbon_H_ 00013 #define DtOsgParticleRibbon_H_ 00014 00015 #include <vrvOsg/vrvOsg.h> 00016 #include <vrvOsg/DtOsgRibbon.h> 00017 00018 #include <list> 00019 00020 namespace osg 00021 { 00022 class DrawElementsUInt; 00023 class Teture; 00024 } 00025 00026 namespace makVrv 00027 { 00032 class DT_DLL_VRVOSG DtOsgParticleRibbon : public DtOsgRibbon 00033 { 00034 public: 00036 DtOsgParticleRibbon(float segmentSpacing, 00037 const osg::Vec4& color, osg::Texture* texture, 00038 float expansionRate, float maxLength = 2000); 00039 00041 virtual void update(double dt, double simTime); 00042 00045 virtual void setAlphaVelocity(float alphaVelocity); 00046 00049 virtual void setTextureRepeat(float textureRepeat); 00050 00051 protected: 00053 virtual ~DtOsgParticleRibbon(); 00054 00056 virtual void addParticle(osg::Vec3d const& left, osg::Vec3d const& right, 00057 double simTime); 00058 00060 virtual float currentSegmentLength(); 00061 00063 virtual void extendCurrentSegment(osg::Vec3d const& left, 00064 osg::Vec3d const& right, double simTime); 00065 00067 virtual osg::Drawable* getDrawable(); 00068 00070 virtual int particleIndexAtOffset(int offset); 00071 00073 virtual void updateParticles(double dt); 00074 00076 virtual void updateGeometry(double dt); 00077 00079 virtual osg::Vec2 getTextureCoordinateFor(int pointIndex, float vScale); 00080 00082 virtual osg::Geode* createGeode(); 00083 00084 00085 private: 00086 osg::ref_ptr<osg::Vec3Array> myPoints; 00087 osg::ref_ptr<osg::Vec4Array> myColors; 00088 osg::ref_ptr<osg::Vec2Array> myTextureCoordinates; 00089 osg::ref_ptr<osg::Texture> myTexture; 00090 00091 bool myWrappingVertices; 00092 int myParticleIndex; 00093 float myTextureRepeat; 00094 double myLastAddTime; 00095 00097 struct Particle 00098 { 00099 osg::Vec3d center; 00100 osg::Vec3d left; 00101 osg::Vec3d right; 00102 osg::Vec3d axis; 00103 float angle; 00104 float alpha; 00105 }; 00106 00107 typedef std::list<Particle> Particles; 00108 Particles myParticles; 00109 00110 float myAlphaVelocity; 00111 float myExpansionRate; 00112 float myRotationalVelocity; 00113 00114 double myLastUpdateTime; 00115 }; 00116 } 00117 00118 #endif 00119