Initial commit

This commit is contained in:
2026-04-03 00:22:39 -05:00
commit eca1e8c458
945 changed files with 218160 additions and 0 deletions

View File

@@ -0,0 +1,101 @@
/*
ZSolidFontRenderer.hpp
Author: Patrick Baggett <ptbaggett@762studios.com>
Purpose: TODO
Changelog
2011/09/18 - creation (ptbaggett)
*/
#pragma once
#ifndef _ZSOLIDFONTRENDERER_H
#define _ZSOLIDFONTRENDERER_H
#include <SST/SST_Mat44.h>
#include <ZRenderer/ZRenderer.hpp>
#include <ZRenderer/ZDataBuffer.hpp>
#include <ZRendererUtil/ZFontRendererBase.hpp>
#include <ZRendererUtil/ZSolidFontFace.hpp>
#include <ft2build.h>
#include FT_FREETYPE_H
#define TRICACHE_SIZE (8*1024) //Cache up to 8K polygons before drawing
class ZSolidFontRenderer : public ZFontRendererBase
{
protected:
ZRenderer* renderer;
ZPtr<ZDataBuffer> tricache;
const ZDataBufferStream* posstream;
const ZDataBufferStream* colorstream;
const ZDataBufferBlock* matrixBlock;
const ZDataBufferBlock* indexBlock;
ZPtr<ZShaderProgram> shaderprogram;
ZPtr<ZShaderParams> shaderparams;
ZPtr<ZIndexParams> indexparams;
ZPtr<ZVertexParams> vertexparams;
ZPtr<ZDataBuffer> uniforms;
ZPtr<ZDataBuffer> 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