xoreos
0.0.5
|
A texture font, as used by NWN and KotOR/KotOR2. More...
#include <texturefont.h>
Classes | |
struct | Char |
A font character. More... | |
Public Member Functions | |
TextureFont (const Common::UString &name) | |
~TextureFont () | |
float | getWidth (uint32 c) const |
Return the width of a character. More... | |
float | getHeight () const |
Return the height of a character. More... | |
float | getLineSpacing () const |
Return the size of space between lines. More... | |
void | draw (uint32 c) const |
Draw this character. More... | |
virtual void | renderBind (const glm::mat4 &transform) const |
Bind the font for rendering. More... | |
virtual void | render (uint32 c, float &x, float &y, float *rgba) const |
virtual void | renderUnbind () const |
Public Member Functions inherited from Graphics::Font | |
Font () | |
virtual | ~Font () |
size_t | getLineCount (const Common::UString &text, float maxWidth=0.0f, float maxHeight=0.0f) const |
Return the number of lines this text spans. More... | |
float | getWidth (const Common::UString &text, float maxWidth=0.0f) const |
Return the width this string would take. More... | |
float | getHeight (const Common::UString &text, float maxWidth=0.0f, float maxHeight=0.0f) const |
Return the height this string would take. More... | |
float | getLineWidth (const Common::UString &text) const |
Return the width of this string. More... | |
virtual void | buildChars (const Common::UString &str) |
Build all necessary characters to display this string. More... | |
float | split (const Common::UString &line, std::vector< Common::UString > &lines, float maxWidth=0.0f, float maxHeight=0.0f, bool trim=true) const |
float | split (Common::UString &line, float maxWidth, float maxHeight=0.0f, bool trim=true) const |
float | split (const Common::UString &line, Common::UString &lines, float maxWidth, float maxHeight=0.0f, bool trim=true) const |
Private Member Functions | |
void | load () |
void | drawMissing () const |
Private Attributes | |
TextureHandle | _texture |
std::map< uint32, Char > | _chars |
float | _height |
float | _spaceR |
float | _spaceB |
Mesh::MeshFont * | _mesh |
Shader::ShaderMaterial * | _material |
Shader::ShaderRenderable * | _renderable |
A texture font, as used by NWN and KotOR/KotOR2.
Definition at line 51 of file texturefont.h.
Graphics::Aurora::TextureFont::TextureFont | ( | const Common::UString & | name | ) |
Definition at line 64 of file texturefont.cpp.
References _material, _mesh, _renderable, _texture, Graphics::Shader::ShaderMaterial::getVariableData(), Graphics::Shader::ShaderSampler::handle, load(), MeshMan, Graphics::Shader::SHADER_FRAGMENT, ShaderMan, SurfaceMan, and TextureMan.
Graphics::Aurora::TextureFont::~TextureFont | ( | ) |
Definition at line 77 of file texturefont.cpp.
References _material, and _renderable.
|
virtual |
Draw this character.
Implements Graphics::Font.
Definition at line 116 of file texturefont.cpp.
References _chars, _spaceR, _texture, drawMissing(), and TextureMan.
|
private |
Definition at line 101 of file texturefont.cpp.
References _height, _spaceR, getWidth(), and TextureMan.
Referenced by draw().
|
virtual |
Return the height of a character.
Implements Graphics::Font.
Definition at line 93 of file texturefont.cpp.
References _height.
|
virtual |
Return the size of space between lines.
Reimplemented from Graphics::Font.
Definition at line 97 of file texturefont.cpp.
References _spaceB.
|
virtual |
Return the width of a character.
Implements Graphics::Font.
Definition at line 82 of file texturefont.cpp.
References _chars, and _spaceR.
Referenced by drawMissing().
|
private |
Definition at line 188 of file texturefont.cpp.
References _chars, _height, _spaceB, _spaceR, _texture, ABS(), Graphics::Aurora::convertToUTF32(), Graphics::TXI::Features::fileRange, Graphics::TXI::Features::fontHeight, Graphics::TXI::getFeatures(), Graphics::Aurora::Texture::getHeight(), Graphics::Aurora::TextureHandle::getTexture(), Graphics::Aurora::Texture::getTXI(), Graphics::Aurora::Texture::getWidth(), Graphics::TXI::Features::isDoubleByte, Common::isValidCodepoint(), Common::kEncodingInvalid, LangMan, Graphics::TXI::Features::lowerRightCoords, Graphics::TXI::Features::numChars, Graphics::TXI::Features::spacingB, Graphics::TXI::Features::spacingR, Graphics::Aurora::TextureFont::Char::tX, Graphics::Aurora::TextureFont::Char::tY, Graphics::TXI::Features::upperLeftCoords, Graphics::Aurora::TextureFont::Char::vX, Graphics::Aurora::TextureFont::Char::vY, Graphics::Aurora::TextureFont::Char::width, Graphics::TXI::Coords::x, and Graphics::TXI::Coords::y.
Referenced by TextureFont().
|
virtual |
Reimplemented from Graphics::Font.
Definition at line 153 of file texturefont.cpp.
References _chars, _mesh, _spaceR, and Graphics::Mesh::MeshFont::render().
|
virtual |
Bind the font for rendering.
Must be performed before render is called.
transform | Base modelview transform. Under most circumstances this is expected to be the identity matrix. |
Mesh data will be dynamically updated for each character drawn to the screen (at least for now), so make sure the mesh VBO is bound. This isn't required for GL2.1, but is for GL3.2 because using the VAO doesn't automatically bind the VBO for data updates.
Reimplemented from Graphics::Font.
Definition at line 136 of file texturefont.cpp.
References _material, _mesh, _renderable, Graphics::Shader::ShaderSurface::bindGLState(), Graphics::Shader::ShaderMaterial::bindGLState(), Graphics::Shader::ShaderSurface::bindProgram(), Graphics::Shader::ShaderMaterial::bindProgram(), Graphics::Shader::ShaderRenderable::getProgram(), Graphics::Shader::ShaderRenderable::getSurface(), Graphics::VertexBuffer::getVBO(), Graphics::Mesh::Mesh::getVertexBuffer(), Graphics::Shader::ShaderProgram::glid, and Graphics::Mesh::Mesh::renderBind().
|
virtual |
Reimplemented from Graphics::Font.
Definition at line 180 of file texturefont.cpp.
References _material, _mesh, _renderable, Graphics::Shader::ShaderRenderable::getSurface(), Graphics::Mesh::Mesh::renderUnbind(), Graphics::Shader::ShaderMaterial::unbindGLState(), and Graphics::Shader::ShaderSurface::unbindGLState().
Definition at line 82 of file texturefont.h.
Referenced by draw(), getWidth(), load(), and render().
|
private |
Definition at line 84 of file texturefont.h.
Referenced by drawMissing(), getHeight(), and load().
|
private |
Definition at line 89 of file texturefont.h.
Referenced by renderBind(), renderUnbind(), TextureFont(), and ~TextureFont().
|
private |
Definition at line 88 of file texturefont.h.
Referenced by render(), renderBind(), renderUnbind(), and TextureFont().
|
private |
Definition at line 90 of file texturefont.h.
Referenced by renderBind(), renderUnbind(), TextureFont(), and ~TextureFont().
|
private |
Definition at line 86 of file texturefont.h.
Referenced by getLineSpacing(), and load().
|
private |
Definition at line 85 of file texturefont.h.
Referenced by draw(), drawMissing(), getWidth(), load(), and render().
|
private |
Definition at line 80 of file texturefont.h.
Referenced by draw(), load(), and TextureFont().