| 1 |
#ifndef RenderableCharacterBatch_h__ |
| 2 |
#define RenderableCharacterBatch_h__ |
| 3 |
|
| 4 |
#include "igl.h" |
| 5 |
#include "irender.h" |
| 6 |
#include <memory> |
| 7 |
|
| 8 |
#include "TextParts.h" |
| 9 |
|
| 10 |
// Define this to use VBOs instead of regular vertex arrays |
| 11 |
//#define RENDERABLE_CHARACTER_BATCH_USE_VBO 1 |
| 12 |
|
| 13 |
namespace gui |
| 14 |
{ |
| 15 |
|
| 16 |
/** |
| 17 |
* A container holding the render information of a bunch of characters, |
| 18 |
* all referencing the same font texture. The geometry of the characters |
| 19 |
* is arranged into a vertex buffer object on compile(). |
| 20 |
*/ |
| 21 |
class RenderableCharacterBatch |
| 22 |
{ |
| 23 |
private: |
| 24 |
// The local vertex buffer |
| 25 |
typedef std::vector<Vertex2D> Vertices; |
| 26 |
Vertices _verts; |
| 27 |
|
| 28 |
#ifdef RENDERABLE_CHARACTER_BATCH_USE_VBO |
| 29 |
// Vertex buffer objects |
| 30 |
GLuint _vboData; |
| 31 |
#endif |
| 32 |
|
| 33 |
public: |
| 34 |
RenderableCharacterBatch(); |
| 35 |
|
| 36 |
~RenderableCharacterBatch(); |
| 37 |
|
| 38 |
// Add a single glyph to this batch |
| 39 |
void addGlyph(const TextChar& ch); |
| 40 |
|
| 41 |
void compile(); |
| 42 |
|
| 43 |
void render() const; |
| 44 |
}; |
| 45 |
typedef std::shared_ptr<RenderableCharacterBatch> RenderableCharacterBatchPtr; |
| 46 |
|
| 47 |
} // namespace |
| 48 |
|
| 49 |
#endif // RenderableCharacterBatch_h__ |