- reworked fonts to now use 3d matrix positioning and render performance is much better.

*NOTE: Still need to deal with some letters getting partially chopped off in some cases.
This commit is contained in:
Mark Vejvoda
2011-06-10 03:09:19 +00:00
parent ca75809f2d
commit 06999a8f88
18 changed files with 528 additions and 156 deletions

View File

@@ -38,7 +38,7 @@ public:
virtual ~TextRenderer2DGl();
virtual void begin(Font2D *font);
virtual void render(const string &text, int x, int y, bool centered, Vec3f *color=NULL);
virtual void render(const string &text, float x, float y, bool centered=false, Vec3f *color=NULL);
virtual void end();
};
@@ -51,12 +51,14 @@ private:
Font3DGl *font;
bool rendering;
void internalRender(const string &text, float x, float y, bool centered, Vec3f *color);
public:
TextRenderer3DGl();
virtual ~TextRenderer3DGl();
virtual void begin(Font3D *font);
virtual void render(const string &text, float x, float y, bool centered);
virtual void render(const string &text, float x, float y, bool centered=false, Vec3f *color=NULL);
virtual void end();
};

View File

@@ -25,26 +25,32 @@ namespace Shared { namespace Graphics {
// class TextRenderer2D
// =====================================================
class TextRenderer2D {
class TextRenderer {
public:
virtual void render(const string &text, float x, float y, bool centered=false, Vec3f *color=NULL) = 0;
virtual void end()= 0;
};
class TextRenderer2D : public TextRenderer {
public:
virtual ~TextRenderer2D(){};
virtual void begin(Font2D *font)= 0;
virtual void render(const string &text, int x, int y, bool centered= false,Vec3f *color=NULL)= 0;
virtual void end()= 0;
//virtual void render(const string &text, int x, int y, bool centered= false,Vec3f *color=NULL)= 0;
//virtual void end()= 0;
};
// =====================================================
// class TextRenderer3D
// =====================================================
class TextRenderer3D {
class TextRenderer3D : public TextRenderer {
public:
virtual ~TextRenderer3D(){};
virtual void begin(Font3D *font)= 0;
virtual void render(const string &text, float x, float y, bool centered= false)= 0;
virtual void end()= 0;
//virtual void render(const string &text, float x, float y, bool centered= false,Vec3f *color=NULL)= 0;
//virtual void end()= 0;
};
}}//end namespace