2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2017-01-29 03:58:16 +00:00
|
|
|
|
|
|
|
#include "GuiSys/CGuiWidget.hpp"
|
|
|
|
#include "hecl/VertexBufferPool.hpp"
|
|
|
|
#include "hecl/UniformBufferPool.hpp"
|
2018-10-07 02:59:17 +00:00
|
|
|
#include "zeus/CVector2i.hpp"
|
2017-01-29 03:58:16 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
class CGlyph;
|
|
|
|
class CTextRenderBuffer;
|
2017-01-30 06:58:59 +00:00
|
|
|
class CFontImageDef;
|
2017-01-29 03:58:16 +00:00
|
|
|
|
|
|
|
class CTextSupportShader
|
|
|
|
{
|
|
|
|
friend class CTextRenderBuffer;
|
|
|
|
|
2017-11-05 06:17:12 +00:00
|
|
|
static boo::ObjToken<boo::IShaderPipeline> s_TextAlphaPipeline;
|
|
|
|
static boo::ObjToken<boo::IShaderPipeline> s_TextAddPipeline;
|
2017-12-20 06:06:54 +00:00
|
|
|
static boo::ObjToken<boo::IShaderPipeline> s_TextAddOverdrawPipeline;
|
2017-01-29 03:58:16 +00:00
|
|
|
|
2017-11-05 06:17:12 +00:00
|
|
|
static boo::ObjToken<boo::IShaderPipeline> s_ImageAlphaPipeline;
|
|
|
|
static boo::ObjToken<boo::IShaderPipeline> s_ImageAddPipeline;
|
2017-12-20 06:06:54 +00:00
|
|
|
static boo::ObjToken<boo::IShaderPipeline> s_ImageAddOverdrawPipeline;
|
2017-01-29 03:58:16 +00:00
|
|
|
|
|
|
|
struct Uniform
|
|
|
|
{
|
|
|
|
zeus::CMatrix4f m_mvp;
|
|
|
|
zeus::CColor m_uniformColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CharacterInstance
|
|
|
|
{
|
|
|
|
zeus::CVector3f m_pos[4];
|
|
|
|
zeus::CVector3f m_uv[4];
|
|
|
|
zeus::CColor m_fontColor;
|
|
|
|
zeus::CColor m_outlineColor;
|
2017-01-30 04:16:20 +00:00
|
|
|
zeus::CColor m_mulColor;
|
2017-01-29 03:58:16 +00:00
|
|
|
void SetMetrics(const CGlyph& glyph, const zeus::CVector2i& offset);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ImageInstance
|
|
|
|
{
|
|
|
|
zeus::CVector3f m_pos[4];
|
|
|
|
zeus::CVector2f m_uv[4];
|
|
|
|
zeus::CColor m_color;
|
2017-01-30 06:58:59 +00:00
|
|
|
void SetMetrics(const CFontImageDef& imgDef, const zeus::CVector2i& offset);
|
2017-01-29 03:58:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static hecl::VertexBufferPool<CharacterInstance> s_CharInsts;
|
|
|
|
static hecl::VertexBufferPool<ImageInstance> s_ImgInsts;
|
|
|
|
static hecl::UniformBufferPool<Uniform> s_Uniforms;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2017-11-05 06:17:12 +00:00
|
|
|
static boo::ObjToken<boo::IShaderPipeline> SelectTextPipeline(CGuiWidget::EGuiModelDrawFlags df)
|
2017-01-29 03:58:16 +00:00
|
|
|
{
|
|
|
|
switch (df)
|
|
|
|
{
|
|
|
|
case CGuiWidget::EGuiModelDrawFlags::Shadeless:
|
|
|
|
case CGuiWidget::EGuiModelDrawFlags::Opaque:
|
|
|
|
case CGuiWidget::EGuiModelDrawFlags::Alpha:
|
2017-12-20 06:06:54 +00:00
|
|
|
case CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
2017-01-29 03:58:16 +00:00
|
|
|
return s_TextAlphaPipeline;
|
|
|
|
case CGuiWidget::EGuiModelDrawFlags::Additive:
|
|
|
|
return s_TextAddPipeline;
|
|
|
|
default:
|
2017-11-05 06:17:12 +00:00
|
|
|
return {};
|
2017-01-29 03:58:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-05 06:17:12 +00:00
|
|
|
static boo::ObjToken<boo::IShaderPipeline> SelectImagePipeline(CGuiWidget::EGuiModelDrawFlags df)
|
2017-01-29 03:58:16 +00:00
|
|
|
{
|
|
|
|
switch (df)
|
|
|
|
{
|
|
|
|
case CGuiWidget::EGuiModelDrawFlags::Shadeless:
|
|
|
|
case CGuiWidget::EGuiModelDrawFlags::Opaque:
|
|
|
|
case CGuiWidget::EGuiModelDrawFlags::Alpha:
|
2017-12-20 06:06:54 +00:00
|
|
|
case CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
2017-01-29 03:58:16 +00:00
|
|
|
return s_ImageAlphaPipeline;
|
|
|
|
case CGuiWidget::EGuiModelDrawFlags::Additive:
|
|
|
|
return s_ImageAddPipeline;
|
|
|
|
default:
|
2017-11-05 06:17:12 +00:00
|
|
|
return {};
|
2017-01-29 03:58:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-20 06:06:54 +00:00
|
|
|
static boo::ObjToken<boo::IShaderPipeline> GetTextAdditiveOverdrawPipeline()
|
|
|
|
{
|
|
|
|
return s_TextAddOverdrawPipeline;
|
|
|
|
}
|
|
|
|
|
|
|
|
static boo::ObjToken<boo::IShaderPipeline> GetImageAdditiveOverdrawPipeline()
|
|
|
|
{
|
|
|
|
return s_ImageAddOverdrawPipeline;
|
|
|
|
}
|
|
|
|
|
2017-01-29 03:58:16 +00:00
|
|
|
static void UpdateBuffers()
|
|
|
|
{
|
|
|
|
s_CharInsts.updateBuffers();
|
|
|
|
s_ImgInsts.updateBuffers();
|
|
|
|
s_Uniforms.updateBuffers();
|
|
|
|
}
|
2017-11-05 06:17:12 +00:00
|
|
|
|
2018-10-07 02:59:17 +00:00
|
|
|
static void Initialize();
|
2017-11-05 06:17:12 +00:00
|
|
|
static void Shutdown();
|
2017-01-29 03:58:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|