TerminalDisplay: Rendering performance improvements.

VertexBuffer: Added some helper functions to add and set quads.
GlyphDrawable: Added a function to draw the glyph into a VertexBuffer.
This commit is contained in:
Martín Lucas Golini
2022-08-25 02:59:20 -03:00
parent 0924b715ee
commit eec04b3a0b
8 changed files with 442 additions and 96 deletions

View File

@@ -7,6 +7,8 @@
namespace EE { namespace Graphics {
class VertexBuffer;
class EE_API GlyphDrawable : public DrawableResource {
public:
static GlyphDrawable* New( Texture* texture, const Rect& srcRect,
@@ -27,6 +29,9 @@ class EE_API GlyphDrawable : public DrawableResource {
virtual void draw( const Vector2f& position, const Sizef& size );
virtual void drawIntoVertexBuffer( VertexBuffer* vbo, const Vector2u& gridPos,
const Vector2f& pos, const Uint32& textureLevel = 0 );
virtual bool isStateful();
/** @return The texture instance used by the GlyphDrawable. */

View File

@@ -109,6 +109,21 @@ class EE_API VertexBuffer {
*/
void resizeIndices( const Uint32& size );
void addQuad( const Vector2f& pos, const Sizef& size, const Color& color );
void setQuad( const Vector2u& gridPos, const Vector2f& pos, const Sizef& size,
const Color& color );
void setQuadColor( const Vector2u& gridPos, const Color& color );
void setQuadFree( const Vector2u& gridPos, const Vector2f& pos0, const Vector2f& pos1,
const Vector2f& pos2, const Vector2f& pos3, const Color& color );
void setQuadTexCoords( const Vector2u& gridPos, const Rectf& coords,
const Uint32& textureLevel );
void setGridSize( const Sizei& size );
/** @return The position array */
std::vector<Vector2f>& getPositionArray();
@@ -177,6 +192,7 @@ class EE_API VertexBuffer {
std::vector<Vector2f> mTexCoordArray[4];
std::vector<Color> mColorArray;
std::vector<Uint32> mIndexArray;
Sizei mGridSize;
VertexBuffer( const Uint32& VertexFlags = VERTEX_FLAGS_DEFAULT,
PrimitiveType DrawType = PRIMITIVE_QUADS, const Int32& ReserveVertexSize = 0,