![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /***************************************************************************** 00002 * Copyright (c) 2012 MAK Technologies, Inc. 00003 * All rights reserved. 00004 *****************************************************************************/ 00005 00009 00010 #pragma once 00011 00012 #include <vrvOsg/vrvOsg.h> 00013 00014 #include <osg/MatrixTransform> 00015 #include <osg/Group> 00016 #include <osg/Geode> 00017 00018 namespace makVrv 00019 { 00020 00023 class DT_DLL_VRVOSG DtOsgRibbon : public osg::Group 00024 { 00025 public: 00026 00028 DtOsgRibbon(); 00029 00034 DtOsgRibbon( float segmentSpacing, const osg::Vec4& color, 00035 float maxLength = 2000 ); 00036 00038 virtual ~DtOsgRibbon(); 00039 00041 virtual void traverse( osg::NodeVisitor& nv ); 00042 00044 virtual osg::Node* node(); 00045 00047 virtual void setColor( const osg::Vec4& color ); 00048 00050 const osg::Vec4& color() const { return myColor; } 00051 00053 virtual void setDroppedPoints( const osg::Vec3d& pointA, const osg::Vec3d& pointB ); 00054 00056 virtual void update( double dt, double simTime ); 00057 00059 virtual void update() {}; 00060 00062 virtual void setMaxSegments( long segments ); 00063 00065 inline long maxSegments() const { return myMaxSegments; } 00066 00068 virtual void setSegmentSpacing( float spacing ); 00069 00071 inline float segmentSpacing() const { return mySegmentSpacing; } 00072 00073 protected: 00074 00076 virtual void addParticle( osg::Vec3d const& left, osg::Vec3d const& right, 00077 double simTime ) = 0; 00078 00080 virtual float currentSegmentLength() = 0; 00081 00083 virtual void extendCurrentSegment( osg::Vec3d const& left, 00084 osg::Vec3d const& right, double simTime ) = 0; 00085 00087 virtual osg::Drawable* getDrawable() = 0; 00088 00090 virtual osg::Geode* createGeode(); 00091 00093 virtual void setDrawable(); 00094 00095 private: 00096 00097 osg::ref_ptr<osg::MatrixTransform> myPositionNode; 00098 osg::ref_ptr<osg::Geode> myGeode; 00099 osg::Matrixd myWorldTransformInv; 00100 osg::Matrixd myLastLocalToWork; 00101 00102 int myLastUpdatedFrame; 00103 double myLastUpdateTime; 00104 00105 long myMaxSegments; 00106 float mySegmentSpacingSquared; 00107 float mySegmentSpacing; 00108 00109 osg::Vec3d myLocalPointA; 00110 osg::Vec3d myLocalPointB; 00111 00112 osg::Vec4 myColor; 00113 bool myFirstUpdate; 00114 00115 }; 00116 00117 }