6 #include "IScreenTextRenderer.h"
7 #include "DebugRendering.h"
10 #include "BatchedTextAppearanceBuilder.h"
12 #include "FontInstance.h"
14 #include "FontMaterialSetProperties.h"
25 bool enableSupersampling,
31 m_fontInstanceChanged = m_pFontInstance != pFontInstance;
32 m_pFontInstance = pFontInstance;
35 void SetDefaultState();
37 void SetTextSize(
float pixelHeight)
39 m_textAppearanceBuilder.SetSize(pixelHeight);
40 m_textAppearanceChanged =
true;
41 if (m_pFontInstance != NULL)
43 const bool prevMinifying = m_batchedTextAppearance.GetSize() < m_pFontInstance->GetHeight();
44 const bool minifying = pixelHeight < m_pFontInstance->GetHeight();
45 m_minificationChanged = minifying != prevMinifying;
49 void SetGlyphColor(
const v4& color)
51 m_textAppearanceBuilder.SetGlyphColor(color);
52 m_textAppearanceChanged =
true;
55 void SetOutlineColor(
const v4& color)
57 m_textAppearanceBuilder.SetOutlineColor(color);
58 m_textAppearanceChanged =
true;
61 void SetHaloStyle(
const v4& color,
float haloWidth,
float haloHardness)
63 m_textAppearanceBuilder.SetHaloColor(color);
64 m_textAppearanceBuilder.SetHaloWidth(haloWidth);
65 m_textAppearanceBuilder.SetHaloHardness(haloHardness);
66 m_textAppearanceChanged =
true;
69 void SetTransform(
const v2& translate,
const v2& rotate,
const v2& scale)
71 m_translate = translate;
76 void SetDepthTest(
bool depthTest)
78 m_textAppearanceBuilder.SetDepthTest(depthTest);
79 m_textAppearanceChanged =
true;
82 void SetStencilTest(
bool stencilTest)
84 m_textAppearanceBuilder.SetStencilTest(stencilTest);
85 m_textAppearanceChanged =
true;
88 void SetStencilFunc(GLenum stencilFunc,
int stencilRef, u32 stencilMask)
90 m_textAppearanceBuilder.SetStencilFunc(stencilFunc, stencilRef, stencilMask);
91 m_textAppearanceChanged =
true;
94 void SetStencilMaskedStyle(
bool enable, GLenum stencilFunc,
const v4& glyphColor,
const v4& haloColor)
96 m_textAppearanceBuilder.SetStencilMaskedStyle(enable, stencilFunc, glyphColor, haloColor);
97 m_textAppearanceChanged =
true;
100 void SetRenderLayer(Rendering::LayerIds::Values layer,
int subLayer)
102 m_layerChanged = m_layer != layer || m_subLayer != subLayer;
104 m_subLayer = subLayer;
107 void SetAlpha(
float alpha)
112 v2 GetTranslate()
const {
return m_translate; }
113 v2 GetRotate()
const {
return m_rotate; }
114 v2 GetScale()
const {
return m_scale; }
115 float GetAlpha()
const {
return m_alpha; }
117 Rendering::LayerIds::Values GetLayer()
const {
return m_layer; }
118 int GetSubLayer()
const {
return m_subLayer; }
121 bool NeedsCachedStateUpdate()
const {
return m_textAppearanceChanged || m_fontInstanceChanged || m_minificationChanged || m_layerChanged; }
123 bool NeedsRenderableSetup()
const {
return m_fontInstanceChanged || m_minificationChanged || m_layerChanged; }
126 void UpdateCachedState();
130 const Fonts::FontMaterialSet* GetFontMaterialSetForeground()
const {
return m_pFontMaterialSetForeground; }
136 const Fonts::FontCharacter& GetFontCharacter(u32 codepointUtf32) {
return m_pFontInstance->GetCharacter(codepointUtf32); }
157 Rendering::LayerIds::Values m_layer;
160 bool m_textAppearanceChanged;
161 bool m_fontInstanceChanged;
162 bool m_minificationChanged;
164 const bool m_enableSupersampling;
165 const bool m_uniformScale;