![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2009 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: Dt3DTextModelInstance.h,v $ $Revision: 1.0 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #ifndef Dt3DTextModelInstance_H_ 00014 #define Dt3DTextModelInstance_H_ 00015 00016 #include <vrvOsg/vrvOsg.h> 00017 #include <vrvOsg/DtOsgModelInstance.h> 00018 00019 #include <osg/Geode> 00020 #include <osg/MatrixTransform> 00021 00022 namespace makVrv 00023 { 00026 class DT_DLL_VRVOSG Dt3DTextModelInstance : public DtOsgModelInstance 00027 { 00028 public: 00029 00030 struct TextParameters 00031 { 00032 float rColor; // RGB red value 00033 float gColor; // RGB green value 00034 float bColor; // RGB blue value 00035 bool flashing; // Like HTML blink 00036 std::string text; // The text to display 00037 std::string font; // The font used to render the text 00038 int fontSize; // Character size in pixels 00039 }; 00040 00042 static const TextParameters defaultParameters; 00043 00044 friend class Dt3DTextModelInstanceCreator; 00045 00047 Dt3DTextModelInstance(DtDe& de); 00048 00050 virtual ~Dt3DTextModelInstance(); 00051 00053 virtual void setColor(float r, float g, float b); 00054 00056 virtual void setText(const std::string& text); 00057 00059 virtual void setFont(const std::string& fontName); 00060 00062 virtual void setFontSize(int sizeInPixels); 00063 00066 virtual bool realize(DtModelDefinition& definition); 00067 00069 virtual void addToConnector( DtOsgSceneConnector* connector ); 00070 00072 virtual bool removeFromConnector( DtOsgSceneConnector* connector ); 00073 00075 virtual void setVisible(bool isVisible) {} 00076 00077 protected: 00078 00080 virtual void build(const TextParameters& parameters); 00081 00083 TextParameters myParameters; 00084 00085 osg::ref_ptr<osg::Geode> myGeode; 00086 }; 00087 00090 class DT_DLL_VRVOSG Dt3DTextModelInstanceCreator : public DtModelInstanceCreator 00091 { 00092 public: 00093 00095 static void registerCreator(DtDe& de); 00096 00098 virtual ~Dt3DTextModelInstanceCreator (); 00099 00101 virtual DtModelInstance* create(DtDe& de); 00102 00103 protected: 00104 00105 Dt3DTextModelInstanceCreator (); 00106 }; 00107 } 00108 00109 #endif 00110