00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __TEXTURETEXT_H__
00020 #define __TEXTURETEXT_H__
00021
00022
00023 #include <string>
00024 #include <set>
00025 #include <map>
00026
00027 #include <vrs/polygonset.h>
00028 #include <vrs/container/iterator.h>
00029 #include <vrs/container/dictionary.h>
00030 #include <vrs/sg/canvas.h>
00031
00032 #include <vrs/text/vrs_textprerequisites.h>
00033 #include <vrs/text/fontdefinition.h>
00034 #include <vrs/text/basetext.h>
00035
00036
00038 namespace VRS
00039 {
00040 class Engine;
00041
00042 namespace TEXT
00043 {
00044 typedef std::set< SO<FontTexture> > FontTextureSet;
00045 typedef NonPersistentDictionary< SO<FontTexture>, SO<PolygonSet> > TexturePolygonMap;
00046
00067 class VRS_CORE_API TextureText : public BaseText
00068 {
00069 public:
00070 #ifdef VRS_HAS_WSTRING // Has Unicode support
00072 TextureText( SO<FontDefinition> fd, const std::wstring& text );
00073 #endif
00075 TextureText( SO<FontDefinition> fd, const std::string& text );
00076
00078 TextureText( SO<FontDefinition> fd, TextureText* bt );
00080 virtual ~TextureText();
00081
00083 virtual const FontTextureSet getCachedTextures() const;
00085 virtual const SO< PolygonSet > getCollisionPolygonSet( ) const;
00087 virtual const SO< PolygonSet > getPolygonSet( SO<FontTexture> ) const;
00088
00090 virtual void setMatrix( const Matrix& m );
00092 virtual void setMatrix( AbstractText::TextPlane tp,
00093 const Vector& offset=Vector(0,0,0), const Vector& scale=Vector(1,1,1) )
00094 {
00095 setMatrix( AbstractText::buildMatrix(tp,offset,scale) );
00096 };
00097
00099 virtual Bounds boundingBox() const;
00100
00102 virtual Matrix calculateScreenSize( Engine* E ) const;
00103
00105 virtual void rebuildAllCaches();
00107 virtual void updateCachedTextures();
00109 virtual void updateCachedPolygons();
00110
00111 VRS_TYPEINFO(TextureText, BaseText);
00112 VRS_SERIALIZABLE(TextureText);
00113 protected:
00115 TextureText( );
00116
00118 FontTextureSet m_CachedTextures;
00119
00121 SO< PolygonSet > m_CollisionPolygonSet;
00123 SO< TexturePolygonMap > m_RenderPolygonSets;
00124 };
00125 }
00126 }
00127
00128 #endif