#ifndef _PATCHRDATA_H #define _PATCHRDATA_H #include #include "Color.h" #include "Vector3D.h" #include "RenderableObject.h" #include "VertexBufferManager.h" class CPatch; ////////////////////////////////////////////////////////////////////////////////////////////////// // CPatchRData: class encapsulating logic for rendering terrain patches; holds per // patch data, plus some supporting static functions for batching, etc class CPatchRData : public CRenderData { public: CPatchRData(CPatch* patch); ~CPatchRData(); void Update(); void RenderBase(); void RenderBlends(); void RenderOutline(); void RenderStreams(u32 streamflags); private: struct SSplat { SSplat() : m_Texture(0), m_IndexCount(0) {} // handle of texture to apply during splat Handle m_Texture; // offset into the index array for this patch where splat starts u32 m_IndexStart; // number of indices used by splat u32 m_IndexCount; }; struct SBaseVertex { // vertex position CVector3D m_Position; // vertex color SColor4ub m_Color; // vertex uvs for base texture float m_UVs[2]; }; struct SBlendVertex { // vertex position CVector3D m_Position; // vertex color SColor4ub m_Color; // vertex uvs for base texture float m_UVs[2]; // vertex uvs for alpha texture float m_AlphaUVs[2]; }; struct STex { bool operator==(const STex& rhs) const { return m_Handle==rhs.m_Handle; } bool operator<(const STex& rhs) const { return m_Priority m_Indices; // indices into base vertices for the shadow map pass std::vector m_ShadowMapIndices; // list of base splats to apply to this patch std::vector m_Splats; // vertices to use for blending transition texture passes std::vector m_BlendVertices; // remembers the index in the m_Vertices array of each blend vertex, so that we can // properly update its color for fog of war and shroud of darkness std::vector m_BlendVertexIndices; // indices into blend vertices for the blend splats std::vector m_BlendIndices; // splats used in blend pass std::vector m_BlendSplats; }; #endif