59 #ifndef ACG_TEXTNODE_HH
60 #define ACG_TEXTNODE_HH
65 #include "BaseNode.hh"
66 #include "TransformNode.hh"
67 #include "DrawModes.hh"
68 #include <ACG/GL/IRenderer.hh>
69 #include <ACG/GL/VertexDeclaration.hh>
72 #include <QFontMetrics>
80 namespace SceneGraph {
113 std::string _name=
"<TextNode>",
114 TextMode _textMode = SCREEN_ALIGNED,
115 bool _alwaysOnTop =
false);
127 void boundingBox(
Vec3d& _bbMin,
Vec3d& _bbMax);
143 void setRenderingMode(TextMode _textMode);
146 void setAlwaysOnTop(
bool _alwaysOnTop);
152 TextMode renderingMode();
155 void setText(std::string _text);
158 void setSize(
const double _size);
161 void setPixelSize(
const unsigned int _size);
164 void setFont(
const QFont& _font);
179 static void updateFont();
183 static quint32 nearestPowerOfTwo(quint32 num);
198 void applyScreenAligned(
GLState &_state);
204 static std::map< char, std::pair<unsigned int, unsigned int> > createMap();
267 static std::map< char, std::pair<unsigned int, unsigned int> >
charToIndex_;
285 static const int numberOfChars_ = 94;
288 static const unsigned int rows_ = 10;
291 static const unsigned int columns_ = 10;
304 #endif // ACG_TEXTNODE_HH defined
static QColor color_
color that is used to draw the characters into the texture in updateFont()
Namespace providing different geometric functions concerning angles.
static int imageWidth_
width of the generated texture
bool texture2dEnabled_
stores if GL_TEXTURE_2D was enabled on entering TextNode
bool alwaysOnTop_
stores if text should be drawn always on top
TextMode textMode_
current display mode of text_ (SCREEN_ALIGNED, SCREEN_ALIGNED_STATIC_SIZE or OBJECT_ALIGNED) ...
static int imageHeight_
height of the generated texture
bool alphaTest_
stores if the alpha test was enabled
bool depthEnabled_
stores if GL_DEPTH_TEST was enabled on entering TextNode
unsigned pixelSize_
pixelSize of the text for the SCREEN_ALIGNED_STATIC_SIZE mode
bool blendEnabled_
stores if GL_BLEND was enabled on entering TextNode
static GLuint texture_
handle for the texture into which characters from qfont_ are painted in updateFont() ...
Class to define the vertex input layout.
float lastScale_
stores the last scaling factor the text computed to SCREEN_ALIGNED_STATIC_SIZE
static bool initialised_
this is used to ensure that the texture is only generated once when necessary
static QFont qfont_
font that is used to generate the texture in updateFont()
static std::map< char, std::pair< unsigned int, unsigned int > > charToIndex_
maps most readable characters to indices for texture coordinate calculation in updateVBO() ...
float alphaTestValue_
stores the alpha value used for alpha test
GLint blendSrc_
stores the sfactor parameter of glBlendFunc on entering TextNode
bool cullFaceEnabled_
stores if GL_CULL_FACE was enabled on entering TextNode
ACG::VertexDeclaration vertexDecl_
stores the vertex declaration
GLenum alphaTestFunc_
stores alpha test comparison function
GLint blendDest_
stores the dfactor parameter of glBlendFunc on entering TextNode
float lastScale()
returns the scaling factor for screen aligned text the text. returns 0, if textmode is not SCREEN_ALI...
double size_
scaling factor by which the quads in vbo_ are scaled
std::string text_
text to be displayed on quads in vbo_
Text will always stay parallel to screen.
static qreal maxFontWidth_
max width of qfont
std::vector< GLfloat > vertexBuffer_
buffer of vertex coordinates and texture coordinates of the quads