8 #ifndef META_OCEAN_RENDERING_GLES_TEXT_H
9 #define META_OCEAN_RENDERING_GLES_TEXT_H
30 namespace GLESceneGraph
81 inline bool isValid()
const;
95 unsigned int textureWidth_ = 0u;
98 unsigned int textureHeight_ = 0u;
106 typedef std::pair<std::string, std::string>
FontPair;
154 std::string
text()
const override;
166 std::string
fontFamily(std::string* styleName =
nullptr)
const override;
196 void setText(
const std::string& text)
override;
208 void setFont(
const std::string& fontFamily,
const std::string& styleName = std::string())
override;
244 bool isFontAvailable(
const std::string& familyName,
const std::string& styleName = std::string())
const override;
355 bool needsRebuild_ =
false;
370 characters_(characters),
371 textureWidth_(textureWidth),
372 textureHeight_(textureHeight)
This class is the base class for all font implementations.
Definition: Font.h:43
std::shared_ptr< Characters > SharedCharacters
Definition of a shared pointers holding characters.
Definition: Font.h:170
This class implements a recursive lock object.
Definition: Lock.h:31
This class implements a 2D lookup object with values at the bins' corners defining the individual loo...
Definition: Lookup2.h:636
This class is the base class for all rendering engines like.
Definition: Engine.h:46
This class implements a GLESceneGraph attribute set object.
Definition: GLESAttributeSet.h:40
This class implements a class factory for all GLESceneGraph objects.
Definition: GLESFactory.h:30
This class implements a base for all GLESceneGraph framebuffers.
Definition: rendering/glescenegraph/GLESFramebuffer.h:34
This class is the base class for all GLESceneGraph shape objects.
Definition: GLESShape.h:34
This class stores the relevant information necessary to render the text using one specific font.
Definition: GLESText.h:59
CV::Fonts::SharedFont font_
The font of this object.
Definition: GLESText.h:86
CV::Fonts::Font::SharedCharacters characters_
The layout information for all characters.
Definition: GLESText.h:92
FontData()=default
Default constructor creating an invalid object.
bool isValid() const
Returns whether this object hold valid information.
Definition: GLESText.h:377
TexturesRef textures_
The textures object holding the texture with the font's characters.
Definition: GLESText.h:89
The manager providing access to the texture containing the font's characters and some associated info...
Definition: GLESText.h:50
std::pair< std::string, std::string > FontPair
Definition of a pair combining the font's family name and style name.
Definition: GLESText.h:106
FontData fontData(Rendering::Engine &engine, const std::string &fontFamily, const std::string &styleName=std::string())
Returns the relevant information necessary to render the text using a specific font.
CV::Fonts::SharedFont font(const std::string &fontFamily, const std::string &styleName=std::string())
Returns the font (with correct font size) which is used to create the relevant information for the ma...
std::map< FontPair, FontData > FontMap
Definition of a map mapping the font's name pair to FontData objects.
Definition: GLESText.h:111
FontMap fontMap_
The map mapping font names to FontData objects.
Definition: GLESText.h:142
void release()
Releases all text texture resources.
Lock lock_
The manager's lock.
Definition: GLESText.h:145
This class implements a GLESceneGraph text object.
Definition: GLESText.h:41
void rebuildPrimitives() override
Rebuilds the primitive vertex, normals and face sets.
TexturesRef textures_
The textures object holding the texture with the font's characters.
Definition: GLESText.h:358
std::string fontFamily_
The font family to be used.
Definition: GLESText.h:340
std::string styleName_
The font's style name to be used, empty to use the default style.
Definition: GLESText.h:343
std::string text_
The text which is actually rendered.
Definition: GLESText.h:328
ObjectType type() const override
Returns the type of this object.
HorizontalAnchor horizontalAnchor() const override
Returns the horizontal anchor of the text.
void setAlignmentMode(const AlignmentMode alignmentMode) override
Sets the alignment mode of the text.
Vector2 size() const override
Returns the actual width and height of the text.
std::string text() const override
Returns the text to be rendered.
VerticalAnchor verticalAnchor() const override
Returns the vertical anchor of the text.
void setVerticalAnchor(const VerticalAnchor verticalAnchor) override
Sets the vertical anchor of the text.
bool isFontAvailable(const std::string &familyName, const std::string &styleName=std::string()) const override
Returns whether a specific font is currently available.
void setGeometryLookupTable(const LookupCorner2< Vector3 > &lookupTable) override
Sets an explicit lookup table which will be used to determine the text geometry (the vertices of the ...
AlignmentMode alignmentMode() const override
Returns the alignment mode of the text.
std::string availableDefaultFont(std::string *styleName=nullptr) const override
Returns the default front currently available.
bool calculateTextSize(const CV::Fonts::Font &font, CV::PixelBoundingBoxesI &linePixelBoundingBoxes, unsigned int &textWidthPixels, unsigned int &textHeightPixels, Scalar &textWidth, Scalar &textHeight) const
Calculates the size of the reulting text block.
void render(const GLESFramebuffer &framebuffer, const SquareMatrix4 &projectionMatrix, const HomogenousMatrix4 &camera_T_object, const HomogenousMatrix4 &camera_T_world, const SquareMatrix3 &normalMatrix, GLESAttributeSet &attributeSet, const Lights &lights) override
Renders the triangles defined by the associated vertex set and the defined triangle faces.
MaterialRef backgroundMaterial() const override
Returns the material which is used to render the background of the text.
bool setSize(const Scalar fixedWidth, const Scalar fixedHeight, const Scalar fixedLineHeight) override
Sets the size of the text.
GLESText()
Creates a new GLESceneGraph box object.
std::string fontFamily(std::string *styleName=nullptr) const override
Returns the font which is used to render the text.
void setHorizontalAnchor(const HorizontalAnchor horizontalAnchor) override
Sets the horizontal anchor of the text.
std::vector< std::string > availableStyleNames(const std::string &familyName) const override
Returns the style names of all available fonts with specified family name.
~GLESText() override
Destructs a GLESceneGraph box object.
void updateBoundingBox() override
Updates the bounding box of this primitive.
std::string descriptiveInformation() const override
Returns descriptive information about the object as string.
MaterialRef backgroundMaterial_
The background material to be used.
Definition: GLESText.h:361
LookupCorner2< Vector3 > lookupTable_
The optional lookup table for the text geometry.
Definition: GLESText.h:364
static void release()
Releases all text texture resources.
std::vector< std::string > availableFamilyNames() const override
Returns all available family names.
void setBackgroundMaterial(const MaterialRef &material) override
Returns the material which is used to render the background of the text.
void setFont(const std::string &fontFamily, const std::string &styleName=std::string()) override
Sets the font to be used when rendering the text.
void setText(const std::string &text) override
Sets the text to be rendred.
This class implements a GLESceneGraph triangles object.
Definition: GLESTriangles.h:33
ObjectType
Definition of different object type.
Definition: Object.h:63
This class is the base class for all texts.
Definition: rendering/Text.h:39
HorizontalAnchor
Definition of individual horizontal anchor points for the entire text block.
Definition: rendering/Text.h:94
AlignmentMode
Definition of individual alignment modes within the text block.
Definition: rendering/Text.h:46
VerticalAnchor
Definition of individual vertical anchor points for the entire text block.
Definition: rendering/Text.h:139
This template class is the base class for all singleton objects.
Definition: Singleton.h:71
std::vector< PixelBoundingBoxI > PixelBoundingBoxesI
Definition of a vector holding bounding box objects with positive and negative coordinate values.
Definition: PixelBoundingBox.h:49
std::shared_ptr< Font > SharedFont
Definition of a shared font pointer.
Definition: Font.h:27
float Scalar
Definition of a scalar type.
Definition: Math.h:128
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition: Vector2.h:21
std::vector< LightPair > Lights
Definition of a set holding light sources.
Definition: GLESLightSource.h:44
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15