![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2009 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtCuboidModelInstance.h,v $ $Revision: 1.0 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #ifndef DtCuboidModelInstance_H_ 00014 #define DtCuboidModelInstance_H_ 00015 00016 #include <vrvOsg/vrvOsg.h> 00017 #include <vrvOsg/DtOsgModelInstance.h> 00018 00019 #include <osg/Geode> 00020 00021 namespace makVrv 00022 { 00025 class DT_DLL_VRVOSG DtCuboidModelInstance : public DtOsgModelInstance 00026 { 00027 public: 00028 00029 struct CuboidParameters 00030 { 00031 float xLength; // x dimension 00032 float yLength; // y dimension 00033 float zLength; // z dimension 00034 float rColor; // RGBA red value 00035 float gColor; // RGBA green value 00036 float bColor; // RGBA blue value 00037 float aColor; // RGBA alpha value 00038 bool flashing; // Like HTML blink 00039 }; 00040 00042 static const CuboidParameters defaultParameters; 00043 00044 friend class DtCuboidModelInstanceCreator; 00045 00047 virtual ~DtCuboidModelInstance(); 00048 00050 virtual void setDimensions(double x, double y, double z); 00051 00053 virtual void setColor(float r,float g,float b,float a); 00054 00057 virtual bool realize(DtModelDefinition& definition); 00058 00060 virtual void addToConnector( DtOsgSceneConnector* connector ); 00061 00063 virtual bool removeFromConnector( DtOsgSceneConnector* connector ); 00064 00066 virtual void setVisible(bool isVisible) {} 00067 00068 protected: 00070 DtCuboidModelInstance(DtDe& de); 00071 00073 virtual void build(const CuboidParameters& parameters); 00074 00076 CuboidParameters myParameters; 00077 00078 osg::ref_ptr<osg::Geode> myGeode; 00079 }; 00080 00083 class DT_DLL_VRVOSG DtCuboidModelInstanceCreator : public DtModelInstanceCreator 00084 { 00085 public: 00086 00088 static void registerCreator(DtDe& de); 00089 00091 virtual ~DtCuboidModelInstanceCreator (); 00092 00094 virtual DtModelInstance* create(DtDe& de); 00095 00096 protected: 00097 00098 DtCuboidModelInstanceCreator (); 00099 }; 00100 } 00101 00102 #endif 00103