VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtTextRenderer.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2014 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
16 #include <vrvGraphics/DtFont.h>
17 
18 #include <vrvUtil/DtUnicode.h>
19 
20 namespace makVrv
21 {
22 
23  class Dt2DEffect;
24  class DtTextProxy;
25  class DtTextLayoutInterface;
26  class DtTexturedGlyphRenderer;
27  class DtOverlayResourceProvider;
28  class DtProjected2DTexturedEffect;
29  typedef boost::weak_ptr<DtFont> DtFontWP;
30  typedef boost::shared_ptr<DtFont> DtFontSP;
31 
35  {
36  public:
39 
41  ~DtTextRenderer();
42 
44  DtTextProxy* createProxy();
45 
47  DtTextProxy* cloneProxy( const DtTextProxy* );
48 
50  virtual int numberOfPrimitives() const;
51 
53  virtual void releaseResources();
54 
56  virtual bool isRenderModeSupported( int mode );
57 
58  bool forceTextShaping(void) const;
59 
61  void render( bool geocentric, float geocentricAlpha,
62  const double location[3], const double positionMatrix[16] );
63 
65  void addGroupRef( unsigned int );
66 
68  void removeGroupRef( unsigned int );
69 
71  void deleteProxy( DtTextProxy* );
72 
73  protected:
74 
75  typedef std::vector<DtTextProxy*> TextProxyList;
79 
80  };
81 
82 
86  {
87  public:
88 
90  DtTextProxy( DtTextRenderer* parent );
91 
93  DtTextProxy* clone( DtTextRenderer* parent ) const;
94 
96  virtual ~DtTextProxy();
97 
99  void setAlignment( DtFont::TextAlignement alignment );
100 
102  DtFont::TextAlignement alignment() const { return myAlignment; };
103 
105  void setParent(DtTextRenderer*);
106 
108  void setPosition( float x, float y, float z, float w = 0 );
109 
111  const float* position() const;
112 
114  void setRotation( float angle );
115 
117  float rotation() const;
118 
120  void setColor( float r, float g, float b, float a );
121 
123  const float* color() const;
124 
127  void setString( const DtUnicode& str );
128 
130  const DtUnicode& string() const;
131 
133  void setFont( DtFontSP font );
134 
136  DtFontSP font() const;
137 
139  Dt2dPoint calculateGlyphSize(const DtPen& pen,
140  const DtUnicode& string, unsigned int pos = 0, int len = -1);
141 
143  DtBoundingBox calculateBoundingBox(const DtPen& pen,
144  const DtUnicode& string, unsigned int pos = 0, int len = -1);
145 
147  void setBounds( const DtBoundingBox& box );
148 
150  const DtBoundingBox& bounds() const;
151 
153  void setGroup( unsigned int group );
154 
156  unsigned int group() const;
157 
159  virtual void renderText(DtTexturedGlyphRenderer*);
160 
161  protected:
162 
164 
165  float myRotation;
166  float myPosition[4];
167  float myColor[4];
168  unsigned int myGroup;
169 
175 
176  void makeOrChangeTextLayout(const DtUnicode& str);
177  };
178 
179 }

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)