Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/renderer/PatchRData.h
Show All 40 Lines | |||||
class CPatchRData : public CRenderData | class CPatchRData : public CRenderData | ||||
{ | { | ||||
public: | public: | ||||
CPatchRData(CPatch* patch, CSimulation2* simulation); | CPatchRData(CPatch* patch, CSimulation2* simulation); | ||||
~CPatchRData(); | ~CPatchRData(); | ||||
void Update(CSimulation2* simulation); | void Update(CSimulation2* simulation); | ||||
void RenderOutline(); | void RenderOutline(); | ||||
void RenderSides(CShaderProgramPtr& shader); | |||||
void RenderPriorities(CTextRenderer& textRenderer); | void RenderPriorities(CTextRenderer& textRenderer); | ||||
void RenderWater(CShaderProgramPtr& shader, bool onlyShore = false, bool fixedPipeline = false); | void RenderWater(CShaderProgramPtr& shader, bool onlyShore = false, bool fixedPipeline = false); | ||||
CPatch* GetPatch() { return m_Patch; } | CPatch* GetPatch() { return m_Patch; } | ||||
const CBoundingBoxAligned& GetWaterBounds() const { return m_WaterBounds; } | const CBoundingBoxAligned& GetWaterBounds() const { return m_WaterBounds; } | ||||
static void RenderBases( | static void RenderBases( | ||||
const std::vector<CPatchRData*>& patches, const CShaderDefines& context, ShadowMap* shadow); | const std::vector<CPatchRData*>& patches, const CShaderDefines& context, ShadowMap* shadow); | ||||
static void RenderBlends( | static void RenderBlends( | ||||
const std::vector<CPatchRData*>& patches, const CShaderDefines& context, ShadowMap* shadow); | const std::vector<CPatchRData*>& patches, const CShaderDefines& context, ShadowMap* shadow); | ||||
static void RenderStreams(const std::vector<CPatchRData*>& patches, const CShaderProgramPtr& shader, int streamflags); | static void RenderStreams(const std::vector<CPatchRData*>& patches, const CShaderProgramPtr& shader, int streamflags); | ||||
static void RenderSides(const std::vector<CPatchRData*>& patches, const CShaderProgramPtr& shader); | |||||
static void PrepareShader(const CShaderProgramPtr& shader, ShadowMap* shadow); | static void PrepareShader(const CShaderProgramPtr& shader, ShadowMap* shadow); | ||||
private: | private: | ||||
friend struct SBlendStackItem; | friend struct SBlendStackItem; | ||||
struct SSplat | struct SSplat | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | private: | ||||
void BuildSides(); | void BuildSides(); | ||||
void BuildSide(std::vector<SSideVertex>& vertices, CPatchSideFlags side); | void BuildSide(std::vector<SSideVertex>& vertices, CPatchSideFlags side); | ||||
// owner patch | // owner patch | ||||
CPatch* m_Patch; | CPatch* m_Patch; | ||||
// vertex buffer handle for side vertices | // vertex buffer handle for side vertices | ||||
CVertexBuffer::VBChunk* m_VBSides; | CVertexBufferManager::Handle m_VBSides; | ||||
// vertex buffer handle for base vertices | // vertex buffer handle for base vertices | ||||
CVertexBuffer::VBChunk* m_VBBase; | CVertexBufferManager::Handle m_VBBase; | ||||
// vertex buffer handle for base vertex indices | // vertex buffer handle for base vertex indices | ||||
CVertexBuffer::VBChunk* m_VBBaseIndices; | CVertexBufferManager::Handle m_VBBaseIndices; | ||||
// vertex buffer handle for blend vertices | // vertex buffer handle for blend vertices | ||||
CVertexBuffer::VBChunk* m_VBBlends; | CVertexBufferManager::Handle m_VBBlends; | ||||
// vertex buffer handle for blend vertex indices | // vertex buffer handle for blend vertex indices | ||||
CVertexBuffer::VBChunk* m_VBBlendIndices; | CVertexBufferManager::Handle m_VBBlendIndices; | ||||
// list of base splats to apply to this patch | // list of base splats to apply to this patch | ||||
std::vector<SSplat> m_Splats; | std::vector<SSplat> m_Splats; | ||||
// splats used in blend pass | // splats used in blend pass | ||||
std::vector<SSplat> m_BlendSplats; | std::vector<SSplat> m_BlendSplats; | ||||
// boundary of water in this patch | // boundary of water in this patch | ||||
CBoundingBoxAligned m_WaterBounds; | CBoundingBoxAligned m_WaterBounds; | ||||
// Water vertex buffer | // Water vertex buffer | ||||
CVertexBuffer::VBChunk* m_VBWater; | CVertexBufferManager::Handle m_VBWater; | ||||
CVertexBuffer::VBChunk* m_VBWaterShore; | CVertexBufferManager::Handle m_VBWaterShore; | ||||
// Water indices buffer | // Water indices buffer | ||||
CVertexBuffer::VBChunk* m_VBWaterIndices; | CVertexBufferManager::Handle m_VBWaterIndices; | ||||
CVertexBuffer::VBChunk* m_VBWaterIndicesShore; | CVertexBufferManager::Handle m_VBWaterIndicesShore; | ||||
CSimulation2* m_Simulation; | CSimulation2* m_Simulation; | ||||
// Build water vertices and indices (vertex buffer and data vector) | // Build water vertices and indices (vertex buffer and data vector) | ||||
void BuildWater(); | void BuildWater(); | ||||
// parameter allowing a varying number of triangles per patch for LOD | // parameter allowing a varying number of triangles per patch for LOD | ||||
// MUST be an exact divisor of PATCH_SIZE | // MUST be an exact divisor of PATCH_SIZE | ||||
// compiled const for the moment until/if dynamic water LOD is offered | // compiled const for the moment until/if dynamic water LOD is offered | ||||
// savings would be mostly beneficial for GPU or simple water | // savings would be mostly beneficial for GPU or simple water | ||||
static const ssize_t water_cell_size = 1; | static const ssize_t water_cell_size = 1; | ||||
}; | }; | ||||
#endif // INCLUDED_PATCHRDATA | #endif // INCLUDED_PATCHRDATA |
Wildfire Games · Phabricator