![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2009 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtArticulatingCylinderModelInstance.h,v $ $Revision: 1.0 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #ifndef DtArticulatingCylinderModelInstance_H_ 00014 #define DtArticulatingCylinderModelInstance_H_ 00015 00016 #include <vrvOsg/vrvOsg.h> 00017 #include <vrvOsg/DtOsgModelInstance.h> 00018 00019 #include <osg/Geode> 00020 #include <osg/MatrixTransform> 00021 #include <osg/ShapeDrawable> 00022 00023 namespace makVrv 00024 { 00027 class DT_DLL_VRVOSG DtArticulatingCylinderModelInstance 00028 : public DtOsgModelInstance 00029 { 00030 public: 00031 00032 struct AttachedCylinderParameters 00033 { 00034 float xLength; // x dimension 00035 float yLength; // y dimension 00036 float zLength; // z dimension 00037 float rColor; // RGBA red value 00038 float gColor; // RGBA green value 00039 float bColor; // RGBA blue value 00040 float aColor; // RGBA alpha value 00041 bool flashing; // Like HTML blink 00042 }; 00043 00045 static const AttachedCylinderParameters defaultParameters; 00046 00048 DtArticulatingCylinderModelInstance(DtDe& de); 00049 00051 virtual ~DtArticulatingCylinderModelInstance(); 00052 00054 virtual void setDimensions(double x, double y, double z); 00055 00057 virtual void setColor(float r,float g,float b,float a); 00058 00060 virtual void setLightingEnabled( bool enabled ); 00061 00064 virtual bool realize(DtModelDefinition& definition); 00065 00067 virtual void addToConnector( DtOsgSceneConnector* connector ); 00068 00070 virtual bool removeFromConnector( DtOsgSceneConnector* connector ); 00071 00073 virtual void setVisible(bool isVisible) {} 00074 00075 protected: 00076 00078 virtual void buildGeometry(const AttachedCylinderParameters& parameters); 00079 00081 virtual void buildState(const AttachedCylinderParameters& parameters); 00082 00084 AttachedCylinderParameters myParameters; 00085 00086 osg::ref_ptr<osg::ShapeDrawable> myCylinderDrawable; 00087 00089 osg::ref_ptr<osg::Geode> myFrontGeode; 00090 00092 osg::ref_ptr<osg::Geode> myBackGeode; 00093 00094 osg::ref_ptr<osg::MatrixTransform> myTransform; 00095 }; 00096 } 00097 00098 #endif 00099