50 #ifndef ACG_TEXTNODE_HH 51 #define ACG_TEXTNODE_HH 56 #include "BaseNode.hh" 57 #include "TransformNode.hh" 58 #include "DrawModes.hh" 59 #include <ACG/GL/IRenderer.hh> 60 #include <ACG/GL/VertexDeclaration.hh> 63 #include <QFontMetrics> 104 const std::string& _name=
"<TextNode>",
105 TextMode _textMode = SCREEN_ALIGNED,
106 bool _alwaysOnTop =
false);
118 void boundingBox(
Vec3d& _bbMin,
Vec3d& _bbMax);
136 void setRenderingMode(
TextMode _textMode);
139 void setAlwaysOnTop(
bool _alwaysOnTop);
148 void setText(std::string _text);
151 void setSize(
const double _size);
154 void setPixelSize(
const unsigned int _size);
157 void setFont(
const QFont& _font);
172 static void updateFont();
176 static quint32 nearestPowerOfTwo(quint32 num);
191 void applyScreenAligned(
GLState &_state);
197 static std::map< char, std::pair<unsigned int, unsigned int> > createMap();
260 static std::map< char, std::pair<unsigned int, unsigned int> >
charToIndex_;
278 static const int numberOfChars_ = 94;
281 static const unsigned int rows_ = 10;
284 static const unsigned int columns_ = 10;
297 #endif // ACG_TEXTNODE_HH defined Namespace providing different geometric functions concerning angles.
Class to define the vertex input layout.
GLint blendSrc_
stores the sfactor parameter of glBlendFunc on entering TextNode
static QFont qfont_
font that is used to generate the texture in updateFont()
bool blendEnabled_
stores if GL_BLEND was enabled on entering TextNode
static int imageHeight_
height of the generated texture
bool texture2dEnabled_
stores if GL_TEXTURE_2D was enabled on entering TextNode
float lastScale_
stores the last scaling factor the text computed to SCREEN_ALIGNED_STATIC_SIZE
TextMode textMode_
current display mode of text_ (SCREEN_ALIGNED, SCREEN_ALIGNED_STATIC_SIZE or OBJECT_ALIGNED) ...
bool alphaTest_
stores if the alpha test was enabled
GLenum alphaTestFunc_
stores alpha test comparison function
static int imageWidth_
width of the generated texture
ACG::VertexDeclaration vertexDecl_
stores the vertex declaration
std::string text_
text to be displayed on quads in vbo_
float lastScale()
returns the scaling factor for screen aligned text the text. returns 0, if textmode is not SCREEN_ALI...
static bool initialised_
this is used to ensure that the texture is only generated once when necessary
bool depthEnabled_
stores if GL_DEPTH_TEST was enabled on entering TextNode
static QColor color_
color that is used to draw the characters into the texture in updateFont()
std::vector< GLfloat > vertexBuffer_
buffer of vertex coordinates and texture coordinates of the quads
Text will always stay parallel to screen.
double size_
scaling factor by which the quads in vbo_ are scaled
static qreal maxFontWidth_
max width of qfont
unsigned pixelSize_
pixelSize of the text for the SCREEN_ALIGNED_STATIC_SIZE mode
GLint blendDest_
stores the dfactor parameter of glBlendFunc on entering TextNode
static std::map< char, std::pair< unsigned int, unsigned int > > charToIndex_
maps most readable characters to indices for texture coordinate calculation in updateVBO() ...
bool alwaysOnTop_
stores if text should be drawn always on top
bool cullFaceEnabled_
stores if GL_CULL_FACE was enabled on entering TextNode
float alphaTestValue_
stores the alpha value used for alpha test
static GLuint texture_
handle for the texture into which characters from qfont_ are painted in updateFont() ...