Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
TerrainRenderer Class Reference

Class TerrainRenderer: Render everything related to the terrain, especially patches and water. More...

#include <TerrainRenderer.h>

Public Member Functions

 TerrainRenderer ()
 
 ~TerrainRenderer ()
 
void SetSimulation (CSimulation2 *simulation)
 Set the simulation context for this frame. More...
 
void Submit (CPatch *patch)
 Submit: Add a patch for rendering in this frame. More...
 
void Submit (CModelDecal *decal)
 Submit: Add a terrain decal for rendering in this frame. More...
 
void PrepareForRendering ()
 PrepareForRendering: Prepare internal data structures like vertex buffers for rendering. More...
 
void EndFrame ()
 EndFrame: Remove all patches from the list of submitted patches. More...
 
bool CullPatches (const CFrustum *frustum)
 CullPatches: Culls patches and decals against a frustum, and stores the results in a special filtered list that is used when calling render functions with filtered true. More...
 
void RenderTerrain (bool filtered=false)
 RenderTerrain: Render textured terrain (including blends between different terrain types). More...
 
void RenderTerrainShader (const CShaderDefines &context, ShadowMap *shadow, bool filtered=false)
 Render textured terrain, as with RenderTerrain, but using shaders instead of multitexturing. More...
 
void RenderPatches (bool filtered=false)
 RenderPatches: Render all patches un-textured as polygons. More...
 
void RenderOutlines (bool filtered=false)
 RenderOutlines: Render the outline of patches as lines. More...
 
void RenderWater (const CShaderDefines &context, ShadowMap *shadow)
 RenderWater: Render water for all patches that have been submitted this frame. More...
 
CBoundingBoxAligned ScissorWater (const CMatrix3D &viewproj)
 Calculate a scissor rectangle for the visible water patches. More...
 
void RenderPriorities ()
 Render priority text for all submitted patches, for debugging. More...
 
void RenderTerrainOverlayTexture (CMatrix3D &textureMatrix)
 Render texture unit 0 over the terrain mesh, with UV coords calculated by the given texture matrix. More...
 

Private Member Functions

bool RenderFancyWater (const CShaderDefines &context, ShadowMap *shadow)
 RenderFancyWater: internal rendering method for fancy water. More...
 
void RenderSimpleWater ()
 RenderSimpleWater: internal rendering method for water. More...
 

Static Private Member Functions

static void PrepareShader (const CShaderProgramPtr &shader, ShadowMap *shadow)
 Set up all the uniforms for a shader pass. More...
 

Private Attributes

TerrainRendererInternalsm
 

Friends

class CPatchRData
 
class CDecalRData
 

Detailed Description

Class TerrainRenderer: Render everything related to the terrain, especially patches and water.

Definition at line 37 of file TerrainRenderer.h.

Constructor & Destructor Documentation

TerrainRenderer::TerrainRenderer ( )

Definition at line 100 of file TerrainRenderer.cpp.

TerrainRenderer::~TerrainRenderer ( )

Definition at line 106 of file TerrainRenderer.cpp.

Member Function Documentation

bool TerrainRenderer::CullPatches ( const CFrustum frustum)

CullPatches: Culls patches and decals against a frustum, and stores the results in a special filtered list that is used when calling render functions with filtered true.

Definition at line 176 of file TerrainRenderer.cpp.

void TerrainRenderer::EndFrame ( )

EndFrame: Remove all patches from the list of submitted patches.

Definition at line 163 of file TerrainRenderer.cpp.

void TerrainRenderer::PrepareForRendering ( )

PrepareForRendering: Prepare internal data structures like vertex buffers for rendering.

All patches must have been submitted before the call to PrepareForRendering. PrepareForRendering must be called before any rendering calls.

Definition at line 154 of file TerrainRenderer.cpp.

void TerrainRenderer::PrepareShader ( const CShaderProgramPtr shader,
ShadowMap shadow 
)
staticprivate

Set up all the uniforms for a shader pass.

Definition at line 469 of file TerrainRenderer.cpp.

bool TerrainRenderer::RenderFancyWater ( const CShaderDefines context,
ShadowMap shadow 
)
private

RenderFancyWater: internal rendering method for fancy water.

Returns false if unable to render with fancy water.

Definition at line 646 of file TerrainRenderer.cpp.

void TerrainRenderer::RenderOutlines ( bool  filtered = false)

RenderOutlines: Render the outline of patches as lines.

preconditions : PrepareForRendering must have been called this frame before calling RenderOutlines.

Parameters
filteredIf true then only render objects that passed CullPatches.

Definition at line 574 of file TerrainRenderer.cpp.

void TerrainRenderer::RenderPatches ( bool  filtered = false)

RenderPatches: Render all patches un-textured as polygons.

preconditions : PrepareForRendering must have been called this frame before calling RenderPatches.

Parameters
filteredIf true then only render objects that passed CullPatches.

Definition at line 549 of file TerrainRenderer.cpp.

void TerrainRenderer::RenderPriorities ( )

Render priority text for all submitted patches, for debugging.

Definition at line 993 of file TerrainRenderer.cpp.

void TerrainRenderer::RenderSimpleWater ( )
private

RenderSimpleWater: internal rendering method for water.

Definition at line 877 of file TerrainRenderer.cpp.

void TerrainRenderer::RenderTerrain ( bool  filtered = false)

RenderTerrain: Render textured terrain (including blends between different terrain types).

preconditions : PrepareForRendering must have been called this frame before calling RenderTerrain.

Parameters
filteredIf true then only render objects that passed CullPatches.

Definition at line 197 of file TerrainRenderer.cpp.

void TerrainRenderer::RenderTerrainOverlayTexture ( CMatrix3D textureMatrix)

Render texture unit 0 over the terrain mesh, with UV coords calculated by the given texture matrix.

Intended for use by TerrainTextureOverlay.

Definition at line 400 of file TerrainRenderer.cpp.

void TerrainRenderer::RenderTerrainShader ( const CShaderDefines context,
ShadowMap shadow,
bool  filtered = false 
)

Render textured terrain, as with RenderTerrain, but using shaders instead of multitexturing.

Parameters
shadowA prepared shadow map, in case rendering with shadows is enabled.
filteredIf true then only render objects that passed CullPatches.

Definition at line 497 of file TerrainRenderer.cpp.

void TerrainRenderer::RenderWater ( const CShaderDefines context,
ShadowMap shadow 
)

RenderWater: Render water for all patches that have been submitted this frame.

preconditions : PrepareForRendering must have been called this frame before calling RenderWater.

Definition at line 983 of file TerrainRenderer.cpp.

CBoundingBoxAligned TerrainRenderer::ScissorWater ( const CMatrix3D viewproj)

Calculate a scissor rectangle for the visible water patches.

Definition at line 595 of file TerrainRenderer.cpp.

void TerrainRenderer::SetSimulation ( CSimulation2 simulation)

Set the simulation context for this frame.

Call at start of frame, before any other Submits.

Definition at line 111 of file TerrainRenderer.cpp.

void TerrainRenderer::Submit ( CPatch patch)

Submit: Add a patch for rendering in this frame.

preconditions : PrepareForRendering must not have been called for this frame yet. The patch must not have been submitted in this frame yet (i.e. you can only submit a frame once).

Parameters
patchthe patch

Definition at line 118 of file TerrainRenderer.cpp.

void TerrainRenderer::Submit ( CModelDecal decal)

Submit: Add a terrain decal for rendering in this frame.

Definition at line 136 of file TerrainRenderer.cpp.

Friends And Related Function Documentation

friend class CDecalRData
friend

Definition at line 40 of file TerrainRenderer.h.

friend class CPatchRData
friend

Definition at line 39 of file TerrainRenderer.h.

Member Data Documentation

TerrainRendererInternals* TerrainRenderer::m
private

Definition at line 158 of file TerrainRenderer.h.


The documentation for this class was generated from the following files: