Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
OverlayRenderer Class Reference

Class OverlayRenderer: Render various bits of data that overlay the game world (selection circles, health bars, etc). More...

#include <OverlayRenderer.h>

Collaboration diagram for OverlayRenderer:

Public Member Functions

 OverlayRenderer ()
 
 ~OverlayRenderer ()
 
void Initialize ()
 Performs one-time initialization. More...
 
void Submit (SOverlayLine *overlay)
 Add a line overlay for rendering in this frame. More...
 
void Submit (SOverlayTexturedLine *overlay)
 Add a textured line overlay for rendering in this frame. More...
 
void Submit (SOverlaySprite *overlay)
 Add a sprite overlay for rendering in this frame. More...
 
void Submit (SOverlayQuad *overlay)
 Add a textured quad overlay for rendering in this frame. More...
 
void Submit (SOverlaySphere *overlay)
 Add a sphere overlay for rendering in this frame. More...
 
void PrepareForRendering ()
 Prepare internal data structures for rendering. More...
 
void Upload (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 Upload prepared data to backend. More...
 
void EndFrame ()
 Reset the list of submitted overlays. More...
 
void RenderOverlaysBeforeWater (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 Render all the submitted overlays that are embedded in the world (i.e. More...
 
void RenderOverlaysAfterWater (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 Render all the submitted overlays that are embedded in the world (i.e. More...
 
void RenderForegroundOverlays (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CCamera &viewCamera)
 Render all the submitted overlays that should appear on top of everything in the world. More...
 

Static Public Attributes

static const float OVERLAY_VOFFSET = 0.2f
 Small vertical offset of overlays from terrain to prevent visual glitches. More...
 

Private Member Functions

 NONCOPYABLE (OverlayRenderer)
 
void RenderTexturedOverlayLines (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 Helper method; renders all overlay lines currently registered in the internals. More...
 
void RenderTexturedOverlayLines (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, Renderer::Backend::IShaderProgram *shader, bool alwaysVisible)
 Helper method; renders those overlay lines currently registered in the internals (i.e. More...
 
void RenderQuadOverlays (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 Helper method; batch-renders all registered quad overlays, batched by their texture for effiency. More...
 
void RenderSphereOverlays (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 Helper method; batch-renders all sphere quad overlays. More...
 

Private Attributes

OverlayRendererInternalsm
 

Detailed Description

Class OverlayRenderer: Render various bits of data that overlay the game world (selection circles, health bars, etc).

Constructor & Destructor Documentation

◆ OverlayRenderer()

OverlayRenderer::OverlayRenderer ( )

◆ ~OverlayRenderer()

OverlayRenderer::~OverlayRenderer ( )

Member Function Documentation

◆ EndFrame()

void OverlayRenderer::EndFrame ( )

Reset the list of submitted overlays.

◆ Initialize()

void OverlayRenderer::Initialize ( )

Performs one-time initialization.

Called by CRenderer::Open after graphics capabilities and the shader path have been determined.

◆ NONCOPYABLE()

OverlayRenderer::NONCOPYABLE ( OverlayRenderer  )
private

◆ PrepareForRendering()

void OverlayRenderer::PrepareForRendering ( )

Prepare internal data structures for rendering.

Must be called after all Submit calls for a frame, and before uploading data.

◆ RenderForegroundOverlays()

void OverlayRenderer::RenderForegroundOverlays ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CCamera viewCamera 
)

Render all the submitted overlays that should appear on top of everything in the world.

Parameters
viewCameracamera to be used for billboard computations

◆ RenderOverlaysAfterWater()

void OverlayRenderer::RenderOverlaysAfterWater ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)

Render all the submitted overlays that are embedded in the world (i.e.

rendered behind other objects in the normal 3D way) and should be drawn after water (i.e. may be visible on top of the water)

◆ RenderOverlaysBeforeWater()

void OverlayRenderer::RenderOverlaysBeforeWater ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)

Render all the submitted overlays that are embedded in the world (i.e.

rendered behind other objects in the normal 3D way) and should be drawn before water (i.e. may be visible under the water)

◆ RenderQuadOverlays()

void OverlayRenderer::RenderQuadOverlays ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)
private

Helper method; batch-renders all registered quad overlays, batched by their texture for effiency.

◆ RenderSphereOverlays()

void OverlayRenderer::RenderSphereOverlays ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)
private

Helper method; batch-renders all sphere quad overlays.

◆ RenderTexturedOverlayLines() [1/2]

void OverlayRenderer::RenderTexturedOverlayLines ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)
private

Helper method; renders all overlay lines currently registered in the internals.

Batch- renders textured overlay lines batched according to their visibility status by delegating to RenderTexturedOverlayLines(IShaderProgram, bool).

◆ RenderTexturedOverlayLines() [2/2]

void OverlayRenderer::RenderTexturedOverlayLines ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
Renderer::Backend::IShaderProgram shader,
bool  alwaysVisible 
)
private

Helper method; renders those overlay lines currently registered in the internals (i.e.

in m->texlines) for which the 'always visible' flag equals alwaysVisible. Used for batch rendering the overlay lines according to their alwaysVisible status, as this requires a separate shader to be used.

◆ Submit() [1/5]

void OverlayRenderer::Submit ( SOverlayLine overlay)

Add a line overlay for rendering in this frame.

Parameters
overlayMust be non-null. The pointed-to object must remain valid at least until the end of the frame.

◆ Submit() [2/5]

void OverlayRenderer::Submit ( SOverlayQuad overlay)

Add a textured quad overlay for rendering in this frame.

Parameters
overlayMust be non-null. The pointed-to object must remain valid at least until the end of the frame.

◆ Submit() [3/5]

void OverlayRenderer::Submit ( SOverlaySphere overlay)

Add a sphere overlay for rendering in this frame.

Parameters
overlayMust be non-null. The pointed-to object must remain valid at least until the end of the frame.

◆ Submit() [4/5]

void OverlayRenderer::Submit ( SOverlaySprite overlay)

Add a sprite overlay for rendering in this frame.

Parameters
overlayMust be non-null. The pointed-to object must remain valid at least until the end of the frame.

◆ Submit() [5/5]

void OverlayRenderer::Submit ( SOverlayTexturedLine overlay)

Add a textured line overlay for rendering in this frame.

Parameters
overlayMust be non-null. The pointed-to object must remain valid at least until the end of the frame.

◆ Upload()

void OverlayRenderer::Upload ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)

Upload prepared data to backend.

Must be called after preparing, and before any rendering calls.

Member Data Documentation

◆ m

OverlayRendererInternals* OverlayRenderer::m
private

◆ OVERLAY_VOFFSET

const float OverlayRenderer::OVERLAY_VOFFSET = 0.2f
static

Small vertical offset of overlays from terrain to prevent visual glitches.


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