Pyrogenesis trunk
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CSceneRenderer Class Reference

#include <SceneRenderer.h>

Inheritance diagram for CSceneRenderer:
Inheritance graph
[legend]
Collaboration diagram for CSceneRenderer:
Collaboration graph
[legend]

Classes

class  Internals
 Struct CSceneRendererInternals: Truly hide data that is supposed to be hidden in this structure so it won't even appear in header files. More...
 

Public Types

enum  CullGroup {
  CULL_DEFAULT , CULL_SHADOWS_CASCADE_0 , CULL_SHADOWS_CASCADE_1 , CULL_SHADOWS_CASCADE_2 ,
  CULL_SHADOWS_CASCADE_3 , CULL_REFLECTIONS , CULL_REFRACTIONS , CULL_SILHOUETTE_OCCLUDER ,
  CULL_SILHOUETTE_CASTER , CULL_MAX
}
 

Public Member Functions

 CSceneRenderer (Renderer::Backend::IDevice *device)
 
 ~CSceneRenderer ()
 
void Initialize ()
 
void Resize (int width, int height)
 
void BeginFrame ()
 
void EndFrame ()
 
void SetSimulation (CSimulation2 *simulation)
 Set simulation context for rendering purposes. More...
 
void MakeShadersDirty ()
 
void SetSceneCamera (const CCamera &viewCamera, const CCamera &cullCamera)
 Set up the camera used for rendering the next scene; this includes setting OpenGL state like viewport, projection and modelview matrices. More...
 
void PrepareScene (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, Scene &scene)
 Enumerate and submit all objects of the given scene which should be rendered. More...
 
void RenderScene (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 Render submitted objects of the previously given scene. More...
 
void RenderSceneOverlays (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 Render overlays of the previously given scene. More...
 
SceneGetScene ()
 Return the scene that is currently being rendered. More...
 
void RenderTextOverlays (CCanvas2D &canvas)
 Render text overlays on top of the scene. More...
 
void SetLightEnv (CLightEnv *lightenv)
 
void SetTerrainRenderMode (ERenderMode mode)
 
ERenderMode GetTerrainRenderMode () const
 
void SetWaterRenderMode (ERenderMode mode)
 
ERenderMode GetWaterRenderMode () const
 
void SetModelRenderMode (ERenderMode mode)
 
ERenderMode GetModelRenderMode () const
 
ERenderMode GetOverlayRenderMode () const
 
void SetOverlayRenderMode (ERenderMode mode)
 
void SetDisplayTerrainPriorities (bool enabled)
 
const CLightEnvGetLightEnv ()
 
const CCameraGetViewCamera () const
 
void SetViewCamera (const CCamera &camera)
 
const CCameraGetCullCamera () const
 
WaterManagerGetWaterManager ()
 GetWaterManager: Return the renderer's water manager. More...
 
SkyManagerGetSkyManager ()
 GetSkyManager: Return the renderer's sky manager. More...
 
CParticleManagerGetParticleManager ()
 
TerrainRendererGetTerrainRenderer ()
 
CMaterialManagerGetMaterialManager ()
 
ShadowMapGetShadowMap ()
 
void ResetState ()
 Resets the render state to default, that was before a game started. More...
 
void ReloadShaders (Renderer::Backend::IDevice *device)
 
- Public Member Functions inherited from SceneCollector
virtual ~SceneCollector ()
 
virtual void Submit (CPatch *patch)=0
 Submit a terrain patch that is part of the scene. More...
 
virtual void Submit (SOverlayLine *overlay)=0
 Submit a line-based overlay. More...
 
virtual void Submit (SOverlayTexturedLine *overlay)=0
 Submit a textured line overlay. More...
 
virtual void Submit (SOverlaySprite *overlay)=0
 Submit a sprite overlay. More...
 
virtual void Submit (SOverlayQuad *overlay)=0
 Submit a textured quad overlay. More...
 
virtual void Submit (SOverlaySphere *overlay)=0
 Submit a sphere overlay. More...
 
virtual void Submit (CModelDecal *decal)=0
 Submit a terrain decal. More...
 
virtual void Submit (CParticleEmitter *emitter)=0
 Submit a particle emitter. More...
 
virtual void SubmitNonRecursive (CModel *model)=0
 Submit a model that is part of the scene, without submitting attached models. More...
 
virtual void SubmitRecursive (CModelAbstract *model)
 Submit a model that is part of the scene, including attached sub-models. More...
 

Protected Member Functions

void Submit (CPatch *patch) override
 Submit a terrain patch that is part of the scene. More...
 
void Submit (SOverlayLine *overlay) override
 Submit a line-based overlay. More...
 
void Submit (SOverlayTexturedLine *overlay) override
 Submit a textured line overlay. More...
 
void Submit (SOverlaySprite *overlay) override
 Submit a sprite overlay. More...
 
void Submit (SOverlayQuad *overlay) override
 Submit a textured quad overlay. More...
 
void Submit (CModelDecal *decal) override
 Submit a terrain decal. More...
 
void Submit (CParticleEmitter *emitter) override
 Submit a particle emitter. More...
 
void Submit (SOverlaySphere *overlay) override
 Submit a sphere overlay. More...
 
void SubmitNonRecursive (CModel *model) override
 Submit a model that is part of the scene, without submitting attached models. More...
 
void PrepareSubmissions (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CBoundingBoxAligned &waterScissor)
 Update and upload all needed data for submitted objects. More...
 
void RenderSubmissions (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CBoundingBoxAligned &waterScissor)
 
void RenderPatches (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CShaderDefines &context, int cullGroup)
 
void RenderModels (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CShaderDefines &context, int cullGroup)
 
void RenderTransparentModels (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CShaderDefines &context, int cullGroup, ETransparentMode transparentMode)
 
void RenderSilhouettes (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CShaderDefines &context)
 
void RenderParticles (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, int cullGroup)
 
void RenderShadowMap (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CShaderDefines &context)
 
void RenderReflections (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CShaderDefines &context, const CBoundingBoxAligned &scissor)
 
void RenderRefractions (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CShaderDefines &context, const CBoundingBoxAligned &scissor)
 
void ComputeReflectionCamera (CCamera &camera, const CBoundingBoxAligned &scissor) const
 
void ComputeRefractionCamera (CCamera &camera, const CBoundingBoxAligned &scissor) const
 
void DisplayFrustum ()
 
void SetObliqueFrustumClipping (CCamera &camera, const CVector4D &clipPlane) const
 

Protected Attributes

std::unique_ptr< Internalsm
 
ERenderMode m_TerrainRenderMode
 
ERenderMode m_WaterRenderMode
 
ERenderMode m_ModelRenderMode
 
ERenderMode m_OverlayRenderMode
 
CCamera m_ViewCamera
 m_ViewCamera: determines the eye position for rendering More...
 
CCamera m_CullCamera
 m_CullCamera: determines the frustum for culling and shadowmap calculations More...
 
Scenem_CurrentScene
 
int m_CurrentCullGroup
 
CBoundingBoxAligned m_WaterScissor
 
CLightEnvm_LightEnv
 
bool m_DisplayTerrainPriorities
 Enable rendering of terrain tile priority text overlay, for debugging. More...
 

Member Enumeration Documentation

◆ CullGroup

Enumerator
CULL_DEFAULT 
CULL_SHADOWS_CASCADE_0 
CULL_SHADOWS_CASCADE_1 
CULL_SHADOWS_CASCADE_2 
CULL_SHADOWS_CASCADE_3 
CULL_REFLECTIONS 
CULL_REFRACTIONS 
CULL_SILHOUETTE_OCCLUDER 
CULL_SILHOUETTE_CASTER 
CULL_MAX 

Constructor & Destructor Documentation

◆ CSceneRenderer()

CSceneRenderer::CSceneRenderer ( Renderer::Backend::IDevice device)

◆ ~CSceneRenderer()

CSceneRenderer::~CSceneRenderer ( )

Member Function Documentation

◆ BeginFrame()

void CSceneRenderer::BeginFrame ( )

◆ ComputeReflectionCamera()

void CSceneRenderer::ComputeReflectionCamera ( CCamera camera,
const CBoundingBoxAligned scissor 
) const
protected

◆ ComputeRefractionCamera()

void CSceneRenderer::ComputeRefractionCamera ( CCamera camera,
const CBoundingBoxAligned scissor 
) const
protected

◆ DisplayFrustum()

void CSceneRenderer::DisplayFrustum ( )
protected

◆ EndFrame()

void CSceneRenderer::EndFrame ( )

◆ GetCullCamera()

const CCamera & CSceneRenderer::GetCullCamera ( ) const
inline

◆ GetLightEnv()

const CLightEnv & CSceneRenderer::GetLightEnv ( )
inline

◆ GetMaterialManager()

CMaterialManager & CSceneRenderer::GetMaterialManager ( )

◆ GetModelRenderMode()

ERenderMode CSceneRenderer::GetModelRenderMode ( ) const
inline

◆ GetOverlayRenderMode()

ERenderMode CSceneRenderer::GetOverlayRenderMode ( ) const
inline

◆ GetParticleManager()

CParticleManager & CSceneRenderer::GetParticleManager ( )

◆ GetScene()

Scene & CSceneRenderer::GetScene ( )

Return the scene that is currently being rendered.

Only valid when the renderer is in a RenderScene call.

◆ GetShadowMap()

ShadowMap & CSceneRenderer::GetShadowMap ( )

◆ GetSkyManager()

SkyManager & CSceneRenderer::GetSkyManager ( )

GetSkyManager: Return the renderer's sky manager.

Returns
the SkyManager object used by the renderer

◆ GetTerrainRenderer()

TerrainRenderer & CSceneRenderer::GetTerrainRenderer ( )

◆ GetTerrainRenderMode()

ERenderMode CSceneRenderer::GetTerrainRenderMode ( ) const
inline

◆ GetViewCamera()

const CCamera & CSceneRenderer::GetViewCamera ( ) const
inline

◆ GetWaterManager()

WaterManager & CSceneRenderer::GetWaterManager ( )

GetWaterManager: Return the renderer's water manager.

Returns
the WaterManager object used by the renderer

◆ GetWaterRenderMode()

ERenderMode CSceneRenderer::GetWaterRenderMode ( ) const
inline

◆ Initialize()

void CSceneRenderer::Initialize ( )

◆ MakeShadersDirty()

void CSceneRenderer::MakeShadersDirty ( )

◆ PrepareScene()

void CSceneRenderer::PrepareScene ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
Scene scene 
)

Enumerate and submit all objects of the given scene which should be rendered.

Must be called before RenderScene.

◆ PrepareSubmissions()

void CSceneRenderer::PrepareSubmissions ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CBoundingBoxAligned waterScissor 
)
protected

Update and upload all needed data for submitted objects.

◆ ReloadShaders()

void CSceneRenderer::ReloadShaders ( Renderer::Backend::IDevice device)

◆ RenderModels()

void CSceneRenderer::RenderModels ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CShaderDefines context,
int  cullGroup 
)
protected

◆ RenderParticles()

void CSceneRenderer::RenderParticles ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
int  cullGroup 
)
protected

◆ RenderPatches()

void CSceneRenderer::RenderPatches ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CShaderDefines context,
int  cullGroup 
)
protected

◆ RenderReflections()

void CSceneRenderer::RenderReflections ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CShaderDefines context,
const CBoundingBoxAligned scissor 
)
protected

◆ RenderRefractions()

void CSceneRenderer::RenderRefractions ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CShaderDefines context,
const CBoundingBoxAligned scissor 
)
protected

◆ RenderScene()

void CSceneRenderer::RenderScene ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)

Render submitted objects of the previously given scene.

◆ RenderSceneOverlays()

void CSceneRenderer::RenderSceneOverlays ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)

Render overlays of the previously given scene.

Must be called after RenderScene.

◆ RenderShadowMap()

void CSceneRenderer::RenderShadowMap ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CShaderDefines context 
)
protected

◆ RenderSilhouettes()

void CSceneRenderer::RenderSilhouettes ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CShaderDefines context 
)
protected

◆ RenderSubmissions()

void CSceneRenderer::RenderSubmissions ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CBoundingBoxAligned waterScissor 
)
protected

◆ RenderTextOverlays()

void CSceneRenderer::RenderTextOverlays ( CCanvas2D canvas)

Render text overlays on top of the scene.

Assumes the caller has set up the GL environment for orthographic rendering with texturing and blending.

◆ RenderTransparentModels()

void CSceneRenderer::RenderTransparentModels ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CShaderDefines context,
int  cullGroup,
ETransparentMode  transparentMode 
)
protected

◆ ResetState()

void CSceneRenderer::ResetState ( )

Resets the render state to default, that was before a game started.

◆ Resize()

void CSceneRenderer::Resize ( int  width,
int  height 
)

◆ SetDisplayTerrainPriorities()

void CSceneRenderer::SetDisplayTerrainPriorities ( bool  enabled)
inline

◆ SetLightEnv()

void CSceneRenderer::SetLightEnv ( CLightEnv lightenv)
inline

◆ SetModelRenderMode()

void CSceneRenderer::SetModelRenderMode ( ERenderMode  mode)
inline

◆ SetObliqueFrustumClipping()

void CSceneRenderer::SetObliqueFrustumClipping ( CCamera camera,
const CVector4D clipPlane 
) const
protected

◆ SetOverlayRenderMode()

void CSceneRenderer::SetOverlayRenderMode ( ERenderMode  mode)
inline

◆ SetSceneCamera()

void CSceneRenderer::SetSceneCamera ( const CCamera viewCamera,
const CCamera cullCamera 
)

Set up the camera used for rendering the next scene; this includes setting OpenGL state like viewport, projection and modelview matrices.

Parameters
viewCamerathis camera determines the eye position for rendering
cullCamerathis camera determines the frustum for culling in the renderer and for shadow calculations

◆ SetSimulation()

void CSceneRenderer::SetSimulation ( CSimulation2 simulation)

Set simulation context for rendering purposes.

Must be called at least once when the game has started and before frames are rendered.

◆ SetTerrainRenderMode()

void CSceneRenderer::SetTerrainRenderMode ( ERenderMode  mode)
inline

◆ SetViewCamera()

void CSceneRenderer::SetViewCamera ( const CCamera camera)
inline

◆ SetWaterRenderMode()

void CSceneRenderer::SetWaterRenderMode ( ERenderMode  mode)
inline

◆ Submit() [1/8]

void CSceneRenderer::Submit ( CModelDecal decal)
overrideprotectedvirtual

Submit a terrain decal.

Implements SceneCollector.

◆ Submit() [2/8]

void CSceneRenderer::Submit ( CParticleEmitter emitter)
overrideprotectedvirtual

Submit a particle emitter.

Implements SceneCollector.

◆ Submit() [3/8]

void CSceneRenderer::Submit ( CPatch patch)
overrideprotectedvirtual

Submit a terrain patch that is part of the scene.

Implements SceneCollector.

◆ Submit() [4/8]

void CSceneRenderer::Submit ( SOverlayLine overlay)
overrideprotectedvirtual

Submit a line-based overlay.

Implements SceneCollector.

◆ Submit() [5/8]

void CSceneRenderer::Submit ( SOverlayQuad overlay)
overrideprotectedvirtual

Submit a textured quad overlay.

Implements SceneCollector.

◆ Submit() [6/8]

void CSceneRenderer::Submit ( SOverlaySphere overlay)
overrideprotectedvirtual

Submit a sphere overlay.

Implements SceneCollector.

◆ Submit() [7/8]

void CSceneRenderer::Submit ( SOverlaySprite overlay)
overrideprotectedvirtual

Submit a sprite overlay.

Implements SceneCollector.

◆ Submit() [8/8]

void CSceneRenderer::Submit ( SOverlayTexturedLine overlay)
overrideprotectedvirtual

Submit a textured line overlay.

Implements SceneCollector.

◆ SubmitNonRecursive()

void CSceneRenderer::SubmitNonRecursive ( CModel model)
overrideprotectedvirtual

Submit a model that is part of the scene, without submitting attached models.

Implements SceneCollector.

Member Data Documentation

◆ m

std::unique_ptr<Internals> CSceneRenderer::m
protected

◆ m_CullCamera

CCamera CSceneRenderer::m_CullCamera
protected

m_CullCamera: determines the frustum for culling and shadowmap calculations

See also
CGameView::m_ViewCamera

◆ m_CurrentCullGroup

int CSceneRenderer::m_CurrentCullGroup
protected

◆ m_CurrentScene

Scene* CSceneRenderer::m_CurrentScene
protected

◆ m_DisplayTerrainPriorities

bool CSceneRenderer::m_DisplayTerrainPriorities
protected

Enable rendering of terrain tile priority text overlay, for debugging.

◆ m_LightEnv

CLightEnv* CSceneRenderer::m_LightEnv
protected

◆ m_ModelRenderMode

ERenderMode CSceneRenderer::m_ModelRenderMode
protected

◆ m_OverlayRenderMode

ERenderMode CSceneRenderer::m_OverlayRenderMode
protected

◆ m_TerrainRenderMode

ERenderMode CSceneRenderer::m_TerrainRenderMode
protected

◆ m_ViewCamera

CCamera CSceneRenderer::m_ViewCamera
protected

m_ViewCamera: determines the eye position for rendering

See also
CGameView::m_ViewCamera

◆ m_WaterRenderMode

ERenderMode CSceneRenderer::m_WaterRenderMode
protected

◆ m_WaterScissor

CBoundingBoxAligned CSceneRenderer::m_WaterScissor
protected

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