Other minor clean up.

--HG--
branch : dev
This commit is contained in:
Martí­n Lucas Golini
2017-03-19 19:18:30 -03:00
parent 95cc075cc6
commit 8fe28f8d99
5 changed files with 106 additions and 91 deletions

View File

@@ -32,11 +32,6 @@ inline Uint32 fontVAlignGet( Uint32 Flags ) {
#define FONT_DRAW_ALIGN_MASK ( FONT_DRAW_VALIGN_MASK | FONT_DRAW_HALIGN_MASK )
struct VertexCoords {
Float TexCoords[2];
Float Vertex[2];
};
#define EE_TTF_FONT_MAGIC ( ( 'E' << 0 ) | ( 'E' << 8 ) | ( 'F' << 16 ) | ( 'N' << 24 ) )
}}

View File

@@ -101,7 +101,10 @@ class EE_API Text {
void setStyleConfig( const FontStyleConfig& styleConfig );
protected:
void ensureGeometryUpdate();
struct VertexCoords {
Vector2f texCoords;
Vector2f position;
};
String mString; ///< String to display
Font * mFont; ///< FontTrueType used to display the string
@@ -131,8 +134,14 @@ class EE_API Text {
std::vector<ColorA> mOutlineColors;
std::vector<Float> mLinesWidth;
void ensureGeometryUpdate();
/** Force to cache the width of the current text */
void cacheWidth();
static void addLine(std::vector<VertexCoords>& vertices, std::vector<ColorA>& colors, Float lineLength, Float lineTop, const EE::System::ColorA& color, Float offset, Float thickness, Float outlineThickness, Sizei textureSize, Int32 centerDiffX);
static void addGlyphQuad(std::vector<VertexCoords>& vertices, std::vector<ColorA>& colors, Vector2f position, const EE::System::ColorA& color, const EE::Graphics::Glyph& glyph, Float italic, Float outlineThickness, Sizei textureSize, Int32 centerDiffX);
};
}}

View File

@@ -7,7 +7,7 @@
namespace EE { namespace Graphics {
/** @brief The vertex buffer class holds vertex data. The vertex position, colors, texture coordinates and indexes.
* This is useful to accelerate and encapsulate data. GPU VBOs are much faster because the data is in the GPU once is uploaded. eepp will try to use GPU VBOs if the GPU support them.
* This is useful to accelerate and encapsulate data.
*/
class EE_API VertexBuffer {
public:
@@ -20,6 +20,9 @@ class EE_API VertexBuffer {
*/
static VertexBuffer * New( const Uint32& VertexFlags = VERTEX_FLAGS_DEFAULT, EE_DRAW_MODE DrawType = DM_QUADS, const Int32& ReserveVertexSize = 0, const Int32& ReserveIndexSize = 0, EE_VBO_USAGE_TYPE UsageType = VBO_USAGE_TYPE_STATIC );
/** Creates the simple vertex array implementation ( without VBOs or VAO ), which it's faster for many cases. */
static VertexBuffer * NewVertexArray( const Uint32& VertexFlags = VERTEX_FLAGS_DEFAULT, EE_DRAW_MODE DrawType = DM_QUADS, const Int32& ReserveVertexSize = 0, const Int32& ReserveIndexSize = 0, EE_VBO_USAGE_TYPE UsageType = VBO_USAGE_TYPE_STATIC );
virtual ~VertexBuffer();
/** @brief Adds a vertex of the type indicated to the buffer
@@ -35,7 +38,7 @@ class EE_API VertexBuffer {
* @param VertexCoord The vertex texture coordinate.
* @param TextureLevel Indicates the texture level if it's using multitextures.
*/
void addVertexCoord( const Vector2f& VertexCoord, const Uint32& TextureLevel = 0 );
void addTextureCoord( const Vector2f& VertexCoord, const Uint32& TextureLevel = 0 );
/** @brief Adds a color to the buffer.
* @param Color The color value.