5 #include "RenderableBase.h"
8 #include "AllVertexTypes.h"
9 #include "BatchedTextRangeBuilder.h"
25 bool IsStencilMaskPass;
26 bool NeedsShaderSetup;
33 static Rendering::SortKey MakeSortKeyForLayer(Rendering::LayerIds::Values layerId,
int subLayer,
bool isHaloLayer);
40 int vertexStrideBytes,
50 virtual bool ShouldRender()
const
52 return GetVertexCount() > 0;
55 virtual void Finalize();
57 virtual void Upload() = 0;
61 bool IsHaloLayer()
const
63 return m_pDrawState->IsHaloLayer;
66 bool IsStencilMaskPass()
const
68 return m_pDrawState->IsStencilMaskPass;
71 bool NeedsShaderSetup()
const
73 return m_pDrawState->NeedsShaderSetup;
79 virtual int GetVertexCount()
const = 0;
81 virtual const void* GetVertexData(
int quadOffset,
int quadCount)
const = 0;
84 void EndRange(
int currentIndexCount)
const;
86 int GetCurrentQuadCount()
const;
90 typedef std::deque<Text::BatchedTextRange> TAppearanceRanges;
91 TAppearanceRanges* m_pAppearanceRanges;
98 template <
typename TVertex>
102 typedef TVertex VertexType;
104 typedef std::vector<VertexType> VertexListType;
113 :
BatchedTextRenderable(pMaterial, pVertexBinding, sortKey, static_cast<int>(
sizeof(VertexType)), quadIndexBuffer)
114 , m_pPrimary(pPrimary)
115 , m_vertexBuffer(vertexBuffer)
116 , m_pVertexList((pPrimary == NULL) ? Eegeo_NEW(VertexListType)() : NULL)
117 , m_vertexBufferElementOffset(0)
123 Eegeo_DELETE m_pVertexList;
130 m_vertexBufferElementOffset = m_vertexBuffer.GetElementOffset();
131 m_vertexBuffer.Upload(*m_pVertexList);
135 m_vertexBufferElementOffset = -1;
141 BatchedTextRenderable::Reset();
142 if (m_pVertexList) m_pVertexList->clear();
147 const int quadOffset = GetVertexBufferElementOffset() / 4;
149 m_vertexBuffer.Bind();
151 BatchedTextRenderable::Draw(glState, quadOffset);
153 m_vertexBuffer.Unbind();
157 m_pVertexList->clear();
161 VertexListType& GetVertexList()
const
166 : m_pPrimary->GetVertexList();
169 bool IsPrimary()
const
171 return m_pPrimary == NULL;
174 bool IsReplica()
const
181 int GetVertexBufferElementOffset()
const
183 const int vertexBufferElementOffset = IsPrimary()
184 ? m_vertexBufferElementOffset
185 : m_pPrimary->GetVertexBufferElementOffset();
187 return vertexBufferElementOffset;
190 virtual int GetVertexCount()
const
192 return static_cast<int>(GetVertexList().size());
195 virtual const void* GetVertexData(
int quadOffset,
int quadCount)
const
197 const VertexListType& vertexList = GetVertexList();
198 Eegeo_ASSERT((quadOffset+quadCount)*4 <= vertexList.size());
200 const VertexType* pVertexData = &(vertexList[quadOffset*4]);
202 return static_cast<const void*
>(pVertexData);
207 VertexListType* m_pVertexList;
208 int m_vertexBufferElementOffset;
222 :
ThisType::ThisType(pMaterial, pVertexBinding, sortKey, pPrimary, quadIndexBuffer, screenTextVertexBuffer)
239 :
ThisType::ThisType(pMaterial, pVertexBinding, sortKey, pPrimary, quadIndexBuffer, worldTextVertexBuffer)