Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
STK::TextLabel3D Class Reference

#include <StkTextLabel3D.h>

Inheritance diagram for STK::TextLabel3D:
STK::BillboardRenderItem STK::MeshGraphicsModel STK::GraphicsModel Maria3D::PointSymbolLabel

Public Member Functions

 TextLabel3D (const std::shared_ptr< STK::GraphicsRender2D > &gfx_render, const std::shared_ptr< STK::FontManager > &font_manager, const std::string &name="")
 
void setText (const std::string &text)
 
const std::string & getText () const
 
void setFontName (const std::string &font_name)
 
const std::string & getFontName () const
 
void setFontStyle (STK::FontStyle font_style)
 
STK::FontStyle getFontStyle () const
 
void setFontSize (int font_size)
 
void setOutline (int width)
 
int getOutline () const
 
void setOutlineColor (const STK::Color4f &color)
 
const STK::Color4fgetOutlineColor () const
 
void setColor (const STK::Color4f &color)
 
const STK::Color4fgetColor () const
 
void setBackgroundColor (const STK::Color4f &color)
 
const STK::Color4fgetBackgroundColor () const
 
void setTextHAlignment (STK::TextHAlignment alignment)
 
void setTextVAlignment (STK::TextVAlignment alignment)
 
void setCornerRadius (float corner_radius)
 
float getCornerRadius () const
 
void setPadding (float pad)
 
void setPadding (float v_pad, float h_pad)
 
void setPadding (float top_pad, float h_pad, float bot_pad)
 
void setPadding (float top_pad, float right_pad, float bot_pad, float left_pad)
 
float getPadding () const
 
float getPaddingTop () const
 
float getPaddingRight () const
 
float getPaddingBottom () const
 
float getPaddingLeft () const
 
TextHAlignment getHorizontalAlignment () const
 
TextVAlignment getVerticalAlignment () const
 
- Public Member Functions inherited from STK::BillboardRenderItem
 BillboardRenderItem (const std::shared_ptr< STK::GraphicsRender2D > &gfx_render, const STK::Viewport &vp, const std::string &name)
 
void setShaderName (const std::string &shader_name)
 
const std::string & getShaderName () const
 
void setScale (float scale)
 
float getScale () const
 
void setRenderer (const std::shared_ptr< STK::GraphicsRender2D > &gfx_render)
 
const std::shared_ptr< STK::GraphicsRender2D > & getRenderer () const
 
void setViewport (const STK::Viewport &vp)
 
const STK::ViewportgetViewport () const
 
void setDepthTest (bool depth_test)
 
bool getDepthTest () const
 
void redraw (const STK::Camera &cam, const STK::Viewport &vp, int render_mask, const std::vector< std::shared_ptr< STK::Uniform > > *uniforms) override
 
void calcBoundingSphere (STK::Vector3f &center, double &radius) override
 
void calcBoundingBox (STK::Vector3f &min, STK::Vector3f &max) override
 
- Public Member Functions inherited from STK::MeshGraphicsModel
 MeshGraphicsModel (std::shared_ptr< ShaderProgramManager > prg_mgr, const std::string &name="")
 
void addMeshRender (std::shared_ptr< MeshRender > mesh_render)
 
unsigned int addMeshGroup (std::shared_ptr< MaterialMeshGroup > mesh_grp, const unsigned int layer=0)
 
std::shared_ptr< MaterialMeshGroupgetMeshGroup (const unsigned int id)
 
void setMeshGroup (const unsigned int id, std::shared_ptr< MaterialMeshGroup > mesh_grp)
 
void removeMeshGroup (const unsigned int id)
 
const std::map< unsigned int, std::shared_ptr< MaterialMeshGroup > > & getMeshGroups () const
 
std::map< unsigned int, std::shared_ptr< MaterialMeshGroup > > & getMeshGroups ()
 
std::shared_ptr< STK::MaterialfindMaterial (const std::string &name) const
 
void needsUpdate (const bool needs_update)
 
std::shared_ptr< const MeshNodegetRoot () const
 
std::shared_ptr< MeshNodegetRoot ()
 
void setRoot (const std::shared_ptr< MeshNode > &node)
 
void redraw (const STK::Camera &cam, const STK::Viewport &vp, int render_mask=STK::OpaqueMask, const std::vector< std::shared_ptr< STK::Uniform > > *uniforms=nullptr) override
 
void calcBoundingSphere (STK::Vector3f &center, double &radius) override
 
void drawShadowMap (const STK::Camera &cam, const STK::Viewport &vp, const Camera &shd_cam, const Viewport &shd_vp, STK::ShaderProgram *shader, STK::ShaderProgram *tex_shader) override
 
void addAnimation (std::shared_ptr< AnimationController > anim)
 
const std::vector< std::shared_ptr< AnimationController > > & getAnimations () const
 
int findAnimations (const std::string &search, std::list< std::shared_ptr< AnimationController > > &anims)
 
std::shared_ptr< AnimationControllerfindAnimation (const std::string &name)
 Find the animation with the exact name.
 
void findMeshNodes (const std::string &search, std::vector< std::shared_ptr< STK::MeshNode > > &nodes) const
 
void findMeshNodes (const std::regex &re, std::vector< std::shared_ptr< STK::MeshNode > > &nodes) const
 
std::shared_ptr< STK::MeshNodefindMeshNode (const std::string &name) const
 
void calcBoundingBox (STK::Vector3f &min, STK::Vector3f &max) override
 
std::shared_ptr< STK::ShaderProgramManagershaderProgramManager ()
 
std::shared_ptr< MeshGraphicsModelrefCopy ()
 
void redrawBackToFront (const Camera &cam, const STK::Viewport &, int render_mask, const std::vector< std::shared_ptr< Uniform > > *uniforms)
 
- Public Member Functions inherited from STK::GraphicsModel
 GraphicsModel (const std::string &name="")
 
void setName (const std::string &name)
 
const std::string & getName () const
 
virtual void filterChildren (const filter_fn &fn, std::vector< std::shared_ptr< GraphicsModel > > &matched)
 
void setTransform (const STK::Matrix4x4f &transform)
 
const STK::Matrix4x4fgetTransform () const
 
void setEnvironmentMap (const std::shared_ptr< STK::CubeMap > &env_map)
 
std::shared_ptr< STK::CubeMapgetEnvironmentMap ()
 
std::shared_ptr< const STK::CubeMapgetEnvironmentMap () const
 
void setWireframe (bool wireframe)
 
bool getWireframe () const
 
void setInvisible (bool invisible)
 
bool getInvisible () const
 
void setCastShadows (bool cast_shadows)
 
bool getCastShadows () const
 
void setDebugGraphics (bool debug_gfx)
 
bool getDebugGraphics () const
 
virtual void redraw (const STK::Camera &cam, const STK::Viewport &vp, int render_mask=STK::OpaqueMask, const std::vector< std::shared_ptr< STK::Uniform > > *uniforms=nullptr)=0
 
virtual void drawShadowMap (const STK::Camera &cam, const STK::Viewport &vp, const STK::Camera &shd_cam, const STK::Viewport &shd_vp, STK::ShaderProgram *shader, STK::ShaderProgram *tex_shader)=0
 
virtual void calcBoundingSphere (STK::Vector3f &center, double &radius)=0
 
virtual void calcBoundingBox (STK::Vector3f &min, STK::Vector3f &max)=0
 

Protected Member Functions

void updateGeometry () override
 
- Protected Member Functions inherited from STK::BillboardRenderItem
virtual void updateGeometry ()
 
bool initGeometry ()
 
- Protected Member Functions inherited from STK::MeshGraphicsModel
void calcNodeBounds (const MeshNode &parent, const STK::Matrix4x4f &m, STK::Vector3f &min, STK::Vector3f &max)
 
void drawHilitMeshes (const STK::Matrix4x4f &mesh_mvp, const STK::Matrix4x4f &pj, const std::vector< HilitMesh > &hilitMeshes)
 
void update ()
 
void updateIfNeeded ()
 

Protected Attributes

std::string text_
 
std::string font_name_ = "arial"
 
int font_size_ = 18
 
STK::FontStyle font_style_ = STK::FontStyle::Regular
 
std::shared_ptr< STK::FontManagerfont_manager_
 
STK::TextHAlignment h_alignment_ = STK::TextHAlignment::Center
 
STK::TextVAlignment v_alignment_ = STK::TextVAlignment::Center
 
int outline_ = 0
 
STK::Color4f fgcolor_ = {1.0f, 1.0f, 1.0f, 1.0f }
 
STK::Color4f bgcolor_ = {0.0f, 0.0f, 0.0f, 0.0f }
 
STK::Color4f outline_color_ = {0.0f, 0.0f, 0.0f, 1.0f }
 
float corner_radius_ = 0.0f
 
STK::Vector4f padding_
 
- Protected Attributes inherited from STK::BillboardRenderItem
std::shared_ptr< FBOTexturefbo_tex_
 
std::shared_ptr< MaterialMeshGroupmesh_grp_
 
std::shared_ptr< STK::GraphicsRender2Dgfx_render_
 
bool dirty_ = true
 
std::string shader_name_ = "BillboardFixedSizeTextureNoLighting"
 
float scale_ = 1.0f
 
STK::Viewport viewport_
 
bool depth_test_ = true
 
- Protected Attributes inherited from STK::MeshGraphicsModel
std::shared_ptr< MeshNoderoot_
 
std::map< unsigned int, std::shared_ptr< MaterialMeshGroup > > material_meshes_
 
bool needs_update_
 
std::shared_ptr< ShaderProgramManagerprg_mgr_
 
std::vector< std::shared_ptr< AnimationController > > animations_
 
- Protected Attributes inherited from STK::GraphicsModel
std::string name_
 
STK::Matrix4x4f transform_
 
std::shared_ptr< STK::CubeMapenv_map_
 
bool wireframe_
 
bool invisible_
 
bool cast_shadows_
 
bool debug_gfx_
 

Additional Inherited Members

- Public Types inherited from STK::GraphicsModel
using filter_fn = std::function< bool(const GraphicsModel &)>
 
- Static Public Member Functions inherited from STK::MeshGraphicsModel
static void getMeshModels (std::shared_ptr< STK::GraphicsModel > rootModel, std::vector< std::shared_ptr< STK::MeshGraphicsModel > > &mesh_models)
 
- Protected Types inherited from STK::MeshGraphicsModel
using visit_func = std::function< void(const std::shared_ptr< GraphicsModel > &)>
 
- Static Protected Member Functions inherited from STK::MeshGraphicsModel
static void visitTree (const std::shared_ptr< GraphicsModel > &root, visit_func func)
 

Detailed Description

TextLabel - Short description. Detailed description.

Constructor & Destructor Documentation

◆ TextLabel3D()

TextLabel3D::TextLabel3D ( const std::shared_ptr< STK::GraphicsRender2D > &  gfx_render,
const std::shared_ptr< STK::FontManager > &  font_manager,
const std::string &  name = "" 
)

Create a 3D text label as a 2D billboard. Each label wil be created by rendering a 2D text label into a texture. For efficiency, it is preferable to share the 2D renderer between 3D label instances.

Parameters
gfx_render2D Renderer for creating offscreen texture.
font_managerFont manager.
nameString ID for the scene graph node.

Member Function Documentation

◆ setBackgroundColor()

void STK::TextLabel3D::setBackgroundColor ( const STK::Color4f color)
inline

Set background color. Default is Qt::transparent

◆ setColor()

void STK::TextLabel3D::setColor ( const STK::Color4f color)
inline

Set foreground color. Default is Qt::white

◆ setOutline()

void STK::TextLabel3D::setOutline ( int  width)
inline

Set outline width.] Default is no outline (0 width)

◆ setOutlineColor()

void STK::TextLabel3D::setOutlineColor ( const STK::Color4f color)
inline

Set outline color. Default is Qt::black

◆ setText()

void STK::TextLabel3D::setText ( const std::string &  text)
inline

Set text to be rendered. Multiline text is supported with newline characters '
' in the string.

◆ updateGeometry()

void TextLabel3D::updateGeometry ( )
overrideprotectedvirtual

Reimplemented from STK::BillboardRenderItem.


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