#pragma once #include #include "Runtime/GuiSys/CGuiWidget.hpp" #include #include #include #include #include #include #include namespace urde { class CGlyph; class CFontImageDef; class CTextRenderBuffer; class CTextSupportShader { friend class CTextRenderBuffer; static boo::ObjToken s_TextAlphaPipeline; static boo::ObjToken s_TextAddPipeline; static boo::ObjToken s_TextAddOverdrawPipeline; static boo::ObjToken s_ImageAlphaPipeline; static boo::ObjToken s_ImageAddPipeline; static boo::ObjToken s_ImageAddOverdrawPipeline; struct Uniform { zeus::CMatrix4f m_mvp; zeus::CColor m_uniformColor; }; struct CharacterInstance { std::array m_pos; std::array m_uv; zeus::CColor m_fontColor; zeus::CColor m_outlineColor; zeus::CColor m_mulColor; void SetMetrics(const CGlyph& glyph, const zeus::CVector2i& offset); }; struct ImageInstance { std::array m_pos; std::array m_uv; zeus::CColor m_color; void SetMetrics(const CFontImageDef& imgDef, const zeus::CVector2i& offset); }; static hecl::VertexBufferPool s_CharInsts; static hecl::VertexBufferPool s_ImgInsts; static hecl::UniformBufferPool s_Uniforms; public: static boo::ObjToken SelectTextPipeline(CGuiWidget::EGuiModelDrawFlags df) { switch (df) { case CGuiWidget::EGuiModelDrawFlags::Shadeless: case CGuiWidget::EGuiModelDrawFlags::Opaque: case CGuiWidget::EGuiModelDrawFlags::Alpha: case CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw: return s_TextAlphaPipeline; case CGuiWidget::EGuiModelDrawFlags::Additive: return s_TextAddPipeline; default: return {}; } } static boo::ObjToken SelectImagePipeline(CGuiWidget::EGuiModelDrawFlags df) { switch (df) { case CGuiWidget::EGuiModelDrawFlags::Shadeless: case CGuiWidget::EGuiModelDrawFlags::Opaque: case CGuiWidget::EGuiModelDrawFlags::Alpha: case CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw: return s_ImageAlphaPipeline; case CGuiWidget::EGuiModelDrawFlags::Additive: return s_ImageAddPipeline; default: return {}; } } static boo::ObjToken GetTextAdditiveOverdrawPipeline() { return s_TextAddOverdrawPipeline; } static boo::ObjToken GetImageAdditiveOverdrawPipeline() { return s_ImageAddOverdrawPipeline; } static void UpdateBuffers() { s_CharInsts.updateBuffers(); s_ImgInsts.updateBuffers(); s_Uniforms.updateBuffers(); } static void Initialize(); static void Shutdown(); }; } // namespace urde