/* ZSolidFontRenderer.hpp Author: Patrick Baggett Purpose: TODO Changelog 2011/09/18 - creation (ptbaggett) */ #pragma once #ifndef _ZSOLIDFONTRENDERER_H #define _ZSOLIDFONTRENDERER_H #include #include #include #include #include #include #include FT_FREETYPE_H #define TRICACHE_SIZE (8*1024) //Cache up to 8K polygons before drawing class ZSolidFontRenderer : public ZFontRendererBase { protected: ZRenderer* renderer; ZPtr tricache; const ZDataBufferStream* posstream; const ZDataBufferStream* colorstream; const ZDataBufferBlock* matrixBlock; const ZDataBufferBlock* indexBlock; ZPtr shaderprogram; ZPtr shaderparams; ZPtr indexparams; ZPtr vertexparams; ZPtr uniforms; ZPtr indexes; ZFrameContext ctx; SST_Mat44f xform; //Internal used struct for vertex / color pairing struct SolidVertex { float x, y; float rgba[4]; }; SolidVertex* vtx_dma; FT_Library library; float color[4]; size_t nrTrisWritten; bool inRendering; void flushTriCache(); public: /* Constructor. @param _renderer - the current renderer instance. */ ZSolidFontRenderer(ZRenderer* _renderer); /* Destructor. */ virtual ~ZSolidFontRenderer(); //Subclass Implementation virtual ZFontFace CreateFontFace(int pixelSize, const void* fontData, unsigned int dataSize); //Subclass Implementation virtual void DeleteFontFace(ZFontFace face); //Subclass Implementation virtual void BeginText(ZFrameContext _ctx, const SST_Mat44f& _xform); //Subclass Implementation virtual void EndText(); //Subclass Implementation virtual void RenderText(int x, int y, const char* text); //Subclass Implementation virtual void ComputeBounds(const char* text, ZFontBounds* bounds); //Subclass Implementation virtual void SetColor(float r, float g, float b, float a); }; #endif