Pyrogenesis  trunk
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>

Collaboration diagram for TerrainRenderer:
Collaboration graph
[legend]

Public Member Functions

 TerrainRenderer ()
 
 ~TerrainRenderer ()
 
void SetSimulation (CSimulation2 *simulation)
 Set the simulation context for this frame. More...
 
void Submit (int cullGroup, CPatch *patch)
 Submit: Add a patch for rendering in this frame. More...
 
void Submit (int cullGroup, 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...
 
void RenderTerrain (int cullGroup)
 RenderTerrain: Render textured terrain (including blends between different terrain types). More...
 
void RenderTerrainShader (const CShaderDefines &context, int cullGroup, ShadowMap *shadow)
 Render textured terrain, as with RenderTerrain, but using shaders instead of multitexturing. More...
 
void RenderPatches (int cullGroup)
 RenderPatches: Render all patches un-textured as polygons. More...
 
void RenderOutlines (int cullGroup)
 RenderOutlines: Render the outline of patches as lines. More...
 
void RenderWater (const CShaderDefines &context, int cullGroup, ShadowMap *shadow)
 RenderWater: Render water for all patches that have been submitted this frame. More...
 
CBoundingBoxAligned ScissorWater (int cullGroup, const CMatrix3D &viewproj)
 Calculate a scissor rectangle for the visible water patches. More...
 
void RenderPriorities (int cullGroup)
 Render priority text for all submitted patches, for debugging. More...
 
void RenderTerrainOverlayTexture (int cullGroup, 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, int cullGroup, ShadowMap *shadow)
 RenderFancyWater: internal rendering method for fancy water. More...
 
void RenderSimpleWater (int cullGroup)
 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.

Constructor & Destructor Documentation

TerrainRenderer::TerrainRenderer ( )
TerrainRenderer::~TerrainRenderer ( )

Member Function Documentation

void TerrainRenderer::EndFrame ( )

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

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.

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

Set up all the uniforms for a shader pass.

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

RenderFancyWater: internal rendering method for fancy water.

Returns false if unable to render with fancy water.

void TerrainRenderer::RenderOutlines ( int  cullGroup)

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.
void TerrainRenderer::RenderPatches ( int  cullGroup)

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.
void TerrainRenderer::RenderPriorities ( int  cullGroup)

Render priority text for all submitted patches, for debugging.

void TerrainRenderer::RenderSimpleWater ( int  cullGroup)
private

RenderSimpleWater: internal rendering method for water.

void TerrainRenderer::RenderTerrain ( int  cullGroup)

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

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

void TerrainRenderer::RenderTerrainOverlayTexture ( int  cullGroup,
CMatrix3D textureMatrix 
)

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

Intended for use by TerrainTextureOverlay.

void TerrainRenderer::RenderTerrainShader ( const CShaderDefines context,
int  cullGroup,
ShadowMap shadow 
)

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

Parameters
shadowA prepared shadow map, in case rendering with shadows is enabled.
void TerrainRenderer::RenderWater ( const CShaderDefines context,
int  cullGroup,
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.

CBoundingBoxAligned TerrainRenderer::ScissorWater ( int  cullGroup,
const CMatrix3D viewproj 
)

Calculate a scissor rectangle for the visible water patches.

void TerrainRenderer::SetSimulation ( CSimulation2 simulation)

Set the simulation context for this frame.

Call at start of frame, before any other Submits.

void TerrainRenderer::Submit ( int  cullGroup,
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
void TerrainRenderer::Submit ( int  cullGroup,
CModelDecal decal 
)

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

Friends And Related Function Documentation

friend class CDecalRData
friend
friend class CPatchRData
friend

Member Data Documentation

TerrainRendererInternals* TerrainRenderer::m
private

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