mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-16 10:57:02 +00:00
platform-sensitive system init
This commit is contained in:
@@ -10,43 +10,42 @@
|
||||
|
||||
namespace Specter
|
||||
{
|
||||
class ViewSystem;
|
||||
|
||||
class TextView : public View
|
||||
{
|
||||
boo::IGraphicsBufferD* m_glyphBuf;
|
||||
int m_validDynamicSlots = 0;
|
||||
size_t m_curGlyphCapacity;
|
||||
const FontAtlas& m_fontAtlas;
|
||||
boo::IVertexFormat* m_vtxFmt = nullptr; /* OpenGL only */
|
||||
boo::IVertexFormat* m_bgVtxFmt = nullptr; /* OpenGL only */
|
||||
|
||||
public:
|
||||
class System
|
||||
{
|
||||
friend class ViewSystem;
|
||||
friend class TextView;
|
||||
boo::IGraphicsDataFactory* m_factory;
|
||||
FontCache& m_fcache;
|
||||
boo::IShaderPipeline* m_regular;
|
||||
boo::IShaderPipeline* m_subpixel;
|
||||
boo::IGraphicsBufferS* m_quadVBO;
|
||||
FontCache* m_fcache = nullptr;
|
||||
boo::IShaderPipeline* m_regular = nullptr;
|
||||
boo::IShaderPipeline* m_subpixel = nullptr;
|
||||
boo::IVertexFormat* m_vtxFmt = nullptr; /* Not OpenGL */
|
||||
|
||||
System(boo::IGraphicsDataFactory* factory, FontCache& fcache)
|
||||
: m_factory(factory), m_fcache(fcache) {}
|
||||
};
|
||||
static System BuildTextSystem(boo::GLDataFactory* factory, FontCache& fcache);
|
||||
void init(boo::GLDataFactory* factory, FontCache* fcache);
|
||||
#if _WIN32
|
||||
static Shaders BuildTextSystem(boo::ID3DDataFactory* factory, FontCache& fcache);
|
||||
void init(boo::ID3DDataFactory* factory, FontCache* fcache);
|
||||
#elif BOO_HAS_METAL
|
||||
static Shaders BuildTextSystem(boo::MetalDataFactory* factory, FontCache& fcache);
|
||||
void init(boo::MetalDataFactory* factory, FontCache* fcache);
|
||||
#endif
|
||||
};
|
||||
|
||||
TextView(System& system, FontTag font, size_t initGlyphCapacity=256);
|
||||
TextView(ViewSystem& system, FontTag font, size_t initGlyphCapacity=256);
|
||||
|
||||
struct RenderGlyph
|
||||
{
|
||||
Zeus::CMatrix4f m_mvp;
|
||||
Zeus::CVector3f m_pos[4];
|
||||
Zeus::CMatrix4f m_mv;
|
||||
Zeus::CVector3f m_uv[4];
|
||||
Zeus::CColor m_color;
|
||||
|
||||
RenderGlyph(int& adv, const FontAtlas::Glyph& glyph, Zeus::CColor defaultColor);
|
||||
};
|
||||
std::vector<RenderGlyph>& accessGlyphs() {return m_glyphs;}
|
||||
void updateGlyphs() {m_validDynamicSlots = 0;}
|
||||
|
||||
Reference in New Issue
Block a user