Visualization Library 2.0.0-b3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vl::CoreText Class Reference

Experimental. More...

#include <CoreText.hpp>

+ Inheritance diagram for vl::CoreText:

Public Member Functions

 CoreText ()
 
const Stringtext () const
 The text to be rendered. More...
 
void setText (const String &text)
 The text to be rendered. More...
 
const fvec4color () const
 The color of the text. More...
 
void setColor (const fvec4 &color)
 The color of the text. More...
 
int margin () const
 The margin to be left around the text. More...
 
void setMargin (int margin)
 The margin to be left around the text. More...
 
const Fontfont () const
 The font to be used to render the text. More...
 
Fontfont ()
 The font to be used to render the text. More...
 
void setFont (Font *font)
 The font to be used to render the text. More...
 
ETextLayout layout () const
 Text layout: left to right, right to left. More...
 
void setLayout (ETextLayout layout)
 Text layout: left to right, right to left. More...
 
ETextAlign textAlignment () const
 Text alignment: left, right, center, justify. More...
 
void setTextAlignment (ETextAlign align)
 Text alignment: left, right, center, justify. More...
 
int textOrigin () const
 The origin of the text (pivot point for offsetting and rotations). More...
 
void setTextOrigin (int align)
 The origin of the text (pivot point for offsetting and rotations). More...
 
bool kerningEnabled () const
 If enabled text rendering uses kerning information for better quality results (slower). More...
 
void setKerningEnabled (bool kerning)
 If enabled text rendering uses kerning information for better quality results (slower). More...
 
bool borderEnabled () const
 If true draws a rectangular border around the text. More...
 
void setBorderEnabled (bool border)
 If true draws a rectangular border around the text. More...
 
const fvec4borderColor () const
 The color of the rectangular border. More...
 
void setBorderColor (const fvec4 &border_color)
 The color of the rectangular border. More...
 
bool backgroundEnabled () const
 If true draws a rectangular background below the text. More...
 
void setBackgroundEnabled (bool background)
 If true draws a rectangular background below the text. More...
 
const fvec4backgroundColor () const
 The color of the rectangular background. More...
 
void setBackgroundColor (const fvec4 &background_color)
 The color of the rectangular background. More...
 
bool outlineEnabled () const
 If true the characters are drawn with an outline. More...
 
void setOutlineEnabled (bool outline)
 If true the characters are drawn with an outline. More...
 
const fvec4outlineColor () const
 The color of the character outline. More...
 
void setOutlineColor (const fvec4 &outline_color)
 The color of the character outline. More...
 
bool shadowEnabled () const
 If true a sort of shadow is rendered below the text. More...
 
void setShadowEnabled (bool shadow)
 If true a sort of shadow is rendered below the text. More...
 
const fvec4shadowColor () const
 The color of the text shadow. More...
 
void setShadowColor (const fvec4 &shadow_color)
 The color of the text shadow. More...
 
const fvec2shadowVector () const
 The offset vector of the shadow. More...
 
void setShadowVector (const fvec2 &shadow_vector)
 The offset vector of the shadow. More...
 
AABB boundingRect () const
 Returns the plain 2D bounding box of the text, in local coordinates. More...
 
AABB boundingRect (const String &text) const
 Returns the plain 2D bounding box of the text, in local coordinates. More...
 
virtual void updateDirtyBufferObject (EBufferObjectUpdateMode)
 Uploads the data stored in the local buffers on the GPU memory. More...
 
virtual void deleteBufferObject ()
 Destroys the BufferObject (vertex buffer objects) associated to this a Renderable. More...
 
- Public Member Functions inherited from vl::Renderable
 Renderable ()
 Constructor. More...
 
virtual ~Renderable ()
 Destructor. More...
 
void render (const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context)
 Renders the Renderable and if necessary compiles the display list and updates the BufferObjects. More...
 
void computeBounds ()
 Recomputes the bounding box and bounding sphere of a Renderable. More...
 
long long boundsUpdateTick () const
 Returns the bounds-update-tick which is a counter incremented every time the bounding box or bounding sphere is updated. More...
 
void setBoundsDirty (bool dirty)
 Marks the bounding box and bounding sphere as dirty in order to be recomputed at the next rendering. More...
 
bool boundsDirty () const
 Returns whether the bounding sphere or bounding box are "dirty", that is, meant to be recomputed. More...
 
void setBoundingBox (const AABB &aabb)
 Sets the bounding box of a Renderable. More...
 
void setBoundingSphere (const Sphere &sphere)
 Sets the bounding sphere of a Renderable. More...
 
const AABBboundingBox () const
 Returns the bounding box of a Renderable without recomputing the bounds if dirty. More...
 
const SphereboundingSphere () const
 Returns the bounding sphere of a Renderable without recomputing the bounds if dirty. More...
 
const AABBboundingBox ()
 Returns the bounding box of a Renderable recomputing the bounds if dirty. More...
 
const SphereboundingSphere ()
 Returns the bounding sphere of a Renderable recomputing the bounds if dirty. More...
 
unsigned int displayList () const
 Returns the display list associated to a Renderable or 0 (zero) if no display list is associated. More...
 
void setDisplayList (unsigned int disp_list)
 Manually assciates a display list to a Renderable (to be used with care). More...
 
bool isDisplayListEnabled () const
 Returns true if display lists are enabled for a Renderable (disabled by default). More...
 
void setDisplayListEnabled (bool enabled)
 Enable/disable display lists (disabled by default). More...
 
bool displayListDirty () const
 Whether the display list associated to a Renderable should be recompiled at the next rendering. More...
 
void setDisplayListDirty (bool dirty)
 Whether the display list associated to a Renderable should be recompiled at the next rendering. More...
 
bool isBufferObjectEnabled () const
 Returns true if BufferObject (vertex buffer object) are enabled for a Renderable (enabled by default). More...
 
void setBufferObjectEnabled (bool enabled)
 Enable/disable BufferObject (vertex buffer object) (enabled by default). More...
 
bool isBufferObjectDirty () const
 Whether BufferObjects associated to a Renderable should be recomputed on the next rendering. More...
 
void setBufferObjectDirty (bool dirty=true)
 Whether BufferObjects associated to a Renderable should be recomputed on the next rendering. More...
 
void deleteDisplayList ()
 Deletes the display list currently associated to a Renderable. More...
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Protected Member Functions

virtual void render_Implementation (const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context) const
 
void computeBounds_Implementation ()
 
void renderText (const Actor *, const Camera *camera, const fvec4 &color, const fvec2 &offset) const
 
void renderBackground (const Actor *actor, const Camera *camera) const
 
void renderBorder (const Actor *actor, const Camera *camera) const
 
AABB rawboundingRect (const String &text) const
 
- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Protected Attributes

ref< FontmFont
 
String mText
 
fvec4 mColor
 
fvec4 mBorderColor
 
fvec4 mBackgroundColor
 
fvec4 mOutlineColor
 
fvec4 mShadowColor
 
fvec2 mShadowVector
 
int mTextOrigin
 
int mMargin
 
ETextLayout mLayout
 
ETextAlign mTextAlignment
 
bool mBorderEnabled
 
bool mBackgroundEnabled
 
bool mOutlineEnabled
 
bool mShadowEnabled
 
bool mKerningEnabled
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Detailed Description

Experimental.

Not yet functional.

Definition at line 47 of file CoreText.hpp.

Constructor & Destructor Documentation

◆ CoreText()

vl::CoreText::CoreText ( )
inline

Definition at line 52 of file CoreText.hpp.

Member Function Documentation

◆ backgroundColor()

const fvec4& vl::CoreText::backgroundColor ( ) const
inline

The color of the rectangular background.

Definition at line 117 of file CoreText.hpp.

◆ backgroundEnabled()

bool vl::CoreText::backgroundEnabled ( ) const
inline

If true draws a rectangular background below the text.

Definition at line 112 of file CoreText.hpp.

Referenced by render_Implementation().

◆ borderColor()

const fvec4& vl::CoreText::borderColor ( ) const
inline

The color of the rectangular border.

Definition at line 107 of file CoreText.hpp.

◆ borderEnabled()

bool vl::CoreText::borderEnabled ( ) const
inline

If true draws a rectangular border around the text.

Definition at line 102 of file CoreText.hpp.

Referenced by render_Implementation().

◆ boundingRect() [1/2]

AABB CoreText::boundingRect ( ) const

Returns the plain 2D bounding box of the text, in local coordinates.

Definition at line 631 of file CoreText.cpp.

References text().

Referenced by renderBackground(), and renderBorder().

◆ boundingRect() [2/2]

AABB CoreText::boundingRect ( const String text) const

◆ color()

const fvec4& vl::CoreText::color ( ) const
inline

The color of the text.

Definition at line 65 of file CoreText.hpp.

Referenced by render_Implementation().

◆ computeBounds_Implementation()

void vl::CoreText::computeBounds_Implementation ( )
inlineprotectedvirtual

Implements vl::Renderable.

Definition at line 160 of file CoreText.hpp.

◆ deleteBufferObject()

virtual void vl::CoreText::deleteBufferObject ( )
inlinevirtual

Destroys the BufferObject (vertex buffer objects) associated to this a Renderable.

Note
This function does not touch the local (non GPU) data stored in the buffers associated to the vertex attributes and DrawCall.

Implements vl::Renderable.

Definition at line 156 of file CoreText.hpp.

◆ font() [1/2]

const Font* vl::CoreText::font ( ) const
inline

The font to be used to render the text.

Definition at line 75 of file CoreText.hpp.

Referenced by rawboundingRect(), render_Implementation(), and renderText().

◆ font() [2/2]

Font* vl::CoreText::font ( )
inline

The font to be used to render the text.

Definition at line 77 of file CoreText.hpp.

◆ kerningEnabled()

bool vl::CoreText::kerningEnabled ( ) const
inline

If enabled text rendering uses kerning information for better quality results (slower).

Definition at line 97 of file CoreText.hpp.

Referenced by rawboundingRect(), and renderText().

◆ layout()

ETextLayout vl::CoreText::layout ( ) const
inline

Text layout: left to right, right to left.

Definition at line 82 of file CoreText.hpp.

Referenced by rawboundingRect(), and renderText().

◆ margin()

int vl::CoreText::margin ( ) const
inline

The margin to be left around the text.

Definition at line 70 of file CoreText.hpp.

Referenced by boundingRect(), and renderText().

◆ outlineColor()

const fvec4& vl::CoreText::outlineColor ( ) const
inline

The color of the character outline.

Definition at line 127 of file CoreText.hpp.

Referenced by render_Implementation().

◆ outlineEnabled()

bool vl::CoreText::outlineEnabled ( ) const
inline

If true the characters are drawn with an outline.

Definition at line 122 of file CoreText.hpp.

Referenced by render_Implementation().

◆ rawboundingRect()

AABB CoreText::rawboundingRect ( const String text) const
protected

◆ render_Implementation()

void CoreText::render_Implementation ( const Actor actor,
const Shader shader,
const Camera camera,
OpenGLContext gl_context 
) const
protectedvirtual

◆ renderBackground()

void CoreText::renderBackground ( const Actor actor,
const Camera camera 
) const
protected

◆ renderBorder()

void CoreText::renderBorder ( const Actor actor,
const Camera camera 
) const
protected

◆ renderText()

void CoreText::renderText ( const Actor ,
const Camera camera,
const fvec4 color,
const fvec2 offset 
) const
protected

◆ setBackgroundColor()

void vl::CoreText::setBackgroundColor ( const fvec4 background_color)
inline

The color of the rectangular background.

Definition at line 119 of file CoreText.hpp.

◆ setBackgroundEnabled()

void vl::CoreText::setBackgroundEnabled ( bool  background)
inline

If true draws a rectangular background below the text.

Definition at line 114 of file CoreText.hpp.

◆ setBorderColor()

void vl::CoreText::setBorderColor ( const fvec4 border_color)
inline

The color of the rectangular border.

Definition at line 109 of file CoreText.hpp.

◆ setBorderEnabled()

void vl::CoreText::setBorderEnabled ( bool  border)
inline

If true draws a rectangular border around the text.

Definition at line 104 of file CoreText.hpp.

◆ setColor()

void vl::CoreText::setColor ( const fvec4 color)
inline

The color of the text.

Definition at line 67 of file CoreText.hpp.

◆ setFont()

void vl::CoreText::setFont ( Font font)
inline

The font to be used to render the text.

Definition at line 79 of file CoreText.hpp.

◆ setKerningEnabled()

void vl::CoreText::setKerningEnabled ( bool  kerning)
inline

If enabled text rendering uses kerning information for better quality results (slower).

Definition at line 99 of file CoreText.hpp.

◆ setLayout()

void vl::CoreText::setLayout ( ETextLayout  layout)
inline

Text layout: left to right, right to left.

Definition at line 84 of file CoreText.hpp.

◆ setMargin()

void vl::CoreText::setMargin ( int  margin)
inline

The margin to be left around the text.

Definition at line 72 of file CoreText.hpp.

◆ setOutlineColor()

void vl::CoreText::setOutlineColor ( const fvec4 outline_color)
inline

The color of the character outline.

Definition at line 129 of file CoreText.hpp.

◆ setOutlineEnabled()

void vl::CoreText::setOutlineEnabled ( bool  outline)
inline

If true the characters are drawn with an outline.

Definition at line 124 of file CoreText.hpp.

◆ setShadowColor()

void vl::CoreText::setShadowColor ( const fvec4 shadow_color)
inline

The color of the text shadow.

Definition at line 139 of file CoreText.hpp.

◆ setShadowEnabled()

void vl::CoreText::setShadowEnabled ( bool  shadow)
inline

If true a sort of shadow is rendered below the text.

Definition at line 134 of file CoreText.hpp.

◆ setShadowVector()

void vl::CoreText::setShadowVector ( const fvec2 shadow_vector)
inline

The offset vector of the shadow.

Definition at line 144 of file CoreText.hpp.

◆ setText()

void vl::CoreText::setText ( const String text)
inline

The text to be rendered.

Definition at line 62 of file CoreText.hpp.

◆ setTextAlignment()

void vl::CoreText::setTextAlignment ( ETextAlign  align)
inline

Text alignment: left, right, center, justify.

Definition at line 89 of file CoreText.hpp.

◆ setTextOrigin()

void vl::CoreText::setTextOrigin ( int  align)
inline

The origin of the text (pivot point for offsetting and rotations).

Definition at line 94 of file CoreText.hpp.

◆ shadowColor()

const fvec4& vl::CoreText::shadowColor ( ) const
inline

The color of the text shadow.

Definition at line 137 of file CoreText.hpp.

Referenced by render_Implementation().

◆ shadowEnabled()

bool vl::CoreText::shadowEnabled ( ) const
inline

If true a sort of shadow is rendered below the text.

Definition at line 132 of file CoreText.hpp.

Referenced by render_Implementation().

◆ shadowVector()

const fvec2& vl::CoreText::shadowVector ( ) const
inline

The offset vector of the shadow.

Definition at line 142 of file CoreText.hpp.

Referenced by render_Implementation().

◆ text()

const String& vl::CoreText::text ( ) const
inline

The text to be rendered.

Definition at line 60 of file CoreText.hpp.

Referenced by boundingRect(), render_Implementation(), and renderText().

◆ textAlignment()

ETextAlign vl::CoreText::textAlignment ( ) const
inline

Text alignment: left, right, center, justify.

Definition at line 87 of file CoreText.hpp.

Referenced by renderText().

◆ textOrigin()

int vl::CoreText::textOrigin ( ) const
inline

The origin of the text (pivot point for offsetting and rotations).

Definition at line 92 of file CoreText.hpp.

Referenced by boundingRect(), and renderText().

◆ updateDirtyBufferObject()

virtual void vl::CoreText::updateDirtyBufferObject ( EBufferObjectUpdateMode  )
inlinevirtual

Uploads the data stored in the local buffers on the GPU memory.

If 'discard_local_data' is set to true the memory used by the local buffers is released.

Implements vl::Renderable.

Definition at line 154 of file CoreText.hpp.

Member Data Documentation

◆ mBackgroundColor

fvec4 vl::CoreText::mBackgroundColor
protected

Definition at line 172 of file CoreText.hpp.

Referenced by renderBackground().

◆ mBackgroundEnabled

bool vl::CoreText::mBackgroundEnabled
protected

Definition at line 181 of file CoreText.hpp.

◆ mBorderColor

fvec4 vl::CoreText::mBorderColor
protected

Definition at line 171 of file CoreText.hpp.

Referenced by renderBorder().

◆ mBorderEnabled

bool vl::CoreText::mBorderEnabled
protected

Definition at line 180 of file CoreText.hpp.

◆ mColor

fvec4 vl::CoreText::mColor
protected

Definition at line 170 of file CoreText.hpp.

◆ mFont

ref<Font> vl::CoreText::mFont
mutableprotected

Definition at line 168 of file CoreText.hpp.

Referenced by rawboundingRect(), and renderText().

◆ mKerningEnabled

bool vl::CoreText::mKerningEnabled
protected

Definition at line 184 of file CoreText.hpp.

◆ mLayout

ETextLayout vl::CoreText::mLayout
protected

Definition at line 178 of file CoreText.hpp.

◆ mMargin

int vl::CoreText::mMargin
protected

Definition at line 177 of file CoreText.hpp.

◆ mOutlineColor

fvec4 vl::CoreText::mOutlineColor
protected

Definition at line 173 of file CoreText.hpp.

◆ mOutlineEnabled

bool vl::CoreText::mOutlineEnabled
protected

Definition at line 182 of file CoreText.hpp.

◆ mShadowColor

fvec4 vl::CoreText::mShadowColor
protected

Definition at line 174 of file CoreText.hpp.

◆ mShadowEnabled

bool vl::CoreText::mShadowEnabled
protected

Definition at line 183 of file CoreText.hpp.

◆ mShadowVector

fvec2 vl::CoreText::mShadowVector
protected

Definition at line 175 of file CoreText.hpp.

◆ mText

String vl::CoreText::mText
protected

Definition at line 169 of file CoreText.hpp.

◆ mTextAlignment

ETextAlign vl::CoreText::mTextAlignment
protected

Definition at line 179 of file CoreText.hpp.

◆ mTextOrigin

int vl::CoreText::mTextOrigin
protected

Definition at line 176 of file CoreText.hpp.


The documentation for this class was generated from the following files: