![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /***************************************************************************** 00002 * Copyright (c) 2011 MAK Technologies, Inc. 00003 * All rights reserved. 00004 *****************************************************************************/ 00005 00009 00010 #pragma once 00011 00012 #include <vrvGraphics/vrvGraphics.h> 00013 #include <vrvGraphics/DtPrimitiveRenderer.h> 00014 #include <vrvGraphics/DtBoundingBox.h> 00015 #include <vrvGraphics/DtTextured2DRenderer.h> 00016 #include <vrvGraphics/DtFont.h> 00017 00018 #include <vrvUtil/DtUnicode.h> 00019 00020 namespace makVrv 00021 { 00022 00023 class Dt2DEffect; 00024 class DtTextProxy; 00025 class DtTexturedGlyphRenderer; 00026 class DtOverlayResourceProvider; 00027 class DtProjected2DTexturedEffect; 00028 typedef boost::weak_ptr<DtFont> DtFontWP; 00029 typedef boost::shared_ptr<DtFont> DtFontSP; 00030 00033 class DT_DLL_VRVGRAPHICS DtTextRenderer : public DtPrimitiveRenderer 00034 { 00035 public: 00036 00037 friend class DtTextProxy; 00038 00040 DtTextRenderer( DtOverlayResourceProvider& provider ); 00041 00043 ~DtTextRenderer(); 00044 00046 DtTextProxy* createProxy(); 00047 00049 DtTextProxy* cloneProxy( const DtTextProxy* ); 00050 00052 virtual int numberOfPrimitives() const; 00053 00055 virtual void releaseResources(); 00056 00058 virtual bool isRenderModeSupported( int mode ); 00059 00061 void render( bool geocentric, float geocentricAlpha, 00062 const double location[3], const double positionMatrix[16] ); 00063 00065 void addGroupRef( unsigned int ); 00066 00068 void removeGroupRef( unsigned int ); 00069 00070 protected: 00071 00073 void deleteProxy( DtTextProxy* ); 00074 00075 protected: 00076 00077 typedef std::vector<DtTextProxy*> TextProxyList; 00078 TextProxyList myProxyList; 00079 DtTexturedGlyphRenderer* myGlyphRenderer; 00080 DtProjected2DTexturedEffect* myEffect; 00081 00082 }; 00083 00084 00087 class DT_DLL_VRVGRAPHICS DtTextProxy 00088 { 00089 public: 00090 00091 friend class DtTextRenderer; 00092 00094 ~DtTextProxy(); 00095 00097 void setAlignment( DtFont::TextAlignement alignment ); 00098 00100 void setPosition( float x, float y, float z, float w = 0 ); 00101 00103 void setRotation( float angle ); 00104 00106 void setColor( float r, float g, float b, float a ); 00107 00109 void setString( const DtUnicode& str ); 00110 00112 const DtUnicode& string() const; 00113 00115 void setFont( DtFontSP font ); 00116 00118 DtFontSP font(); 00119 00121 void setBounds( const DtBoundingBox& box ); 00122 00124 void setGroup( unsigned int group ); 00125 00127 unsigned int group() const; 00128 00129 protected: 00130 00132 DtTextProxy( DtTextRenderer* parent ); 00133 00135 DtTextProxy* clone( DtTextRenderer* parent ) const; 00136 00137 protected: 00138 00139 DtTextRenderer* myParent; 00140 00141 float myRotation; 00142 float myPosition[4]; 00143 float myColor[4]; 00144 unsigned int myGroup; 00145 00146 DtFont::TextAlignement myAlignment; 00147 DtUnicode myString; 00148 DtBoundingBox myBounds; 00149 DtFontSP myFont; 00150 00151 }; 00152 00153 }