18#ifndef STK_TEXT_BILLBOARD_HPP
19#define STK_TEXT_BILLBOARD_HPP
21#include "font/font_with_face.hpp"
22#include "graphics/gl_headers.hpp"
23#include "graphics/sp/sp_instanced_data.hpp"
24#include "utils/no_copy.hpp"
26#include <ISceneNode.h>
28#include <unordered_map>
49 core::vector3df m_position;
50 video::SColor m_color;
57 video::ITexture* m_texture;
59 core::rect<float> m_dest_rect;
61 core::rect<s32> m_source_rect;
65 const core::rect<float>& dest_rect,
66 const core::rect<irr::s32>& source_rect,
67 const video::SColor*
const colors)
70 m_dest_rect = dest_rect;
71 m_source_rect = source_rect;
77 GLuint m_instanced_array = 0;
79 std::vector<STKTextBillboardChar>* m_chars = NULL;
81 video::SColor m_color_top;
83 video::SColor m_color_bottom;
85 std::unordered_map<video::ITexture*, std::vector<std::array<GLTB, 4> > >
88 std::unordered_map<video::ITexture*, std::pair<GLuint, GLuint> >
91 std::unordered_map<video::ITexture*, scene::IMeshBuffer*> m_gl_mb;
93 core::aabbox3df m_bbox;
99 IMeshSceneNode* m_ge_node;
108 const video::SColor& color_bottom, ISceneNode* parent,
109 ISceneManager* mgr, s32
id,
110 const core::vector3df& position,
111 const core::vector3df& scale = core::vector3df(1, 1, 1));
123 virtual void collectChar(video::ITexture* texture,
124 const core::rect<float>& dest_rect,
125 const core::rect<irr::s32>& source_rect,
126 const video::SColor*
const colors);
128 virtual void updateAbsolutePosition();
130 virtual void OnRegisterSceneNode();
132 virtual void render();
134 virtual const core::aabbox3df& getBoundingBox()
const {
return m_bbox; }
136 void init(
const core::stringw& text,
FontWithFace* face);
138 void initLegacy(
const core::stringw& text,
FontWithFace* face);
140 void draw(video::ITexture* tex)
const
143 glBindVertexArray(m_vao_vbos.at(tex).first);
144 for (
unsigned i = 0; i < m_gl_tbs.at(tex).size(); i++)
146 glDrawArraysInstanced(GL_TRIANGLE_STRIP, i * 4, 4, 1);
151 std::vector<video::ITexture*> getAllTBTextures()
const
153 std::vector<video::ITexture*> ret;
154 for (
auto& p : m_vao_vbos)
156 ret.push_back(p.first);
161 void updateGLInstanceData()
const
164 glBindBuffer(GL_ARRAY_BUFFER, m_instanced_array);
165 glBufferSubData(GL_ARRAY_BUFFER, 0, 36, m_instanced_data.getData());
166 glBindBuffer(GL_ARRAY_BUFFER, 0);
170 static void updateAllTextBillboards();
A class for STKTextBillboard to get font info to render billboard text.
Definition: font_with_face.hpp:77
An abstract class which contains functions which convert vector fonts into bitmap and render them in ...
Definition: font_with_face.hpp:72
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
Definition: sp_instanced_data.hpp:32
Definition: stk_text_billboard.hpp:45
Definition: stk_text_billboard.hpp:48
Definition: stk_text_billboard.hpp:56