Overte C++ Documentation
render::Args Class Reference

#include <Args.h>

Collaboration diagram for render::Args:

Public Types

enum  RenderMode { DEFAULT_RENDER_MODE , SHADOW_RENDER_MODE , MIRROR_RENDER_MODE , SECONDARY_CAMERA_RENDER_MODE }
 

Public Member Functions

 Args (const gpu::ContextPointer &context, float sizeScale=1.0f, int boundaryLevelAdjust=0, float lodFarAngleHalfTan=0.1f, float lodNearAngleHalfTan=0.01f, float lodFarDist=200.0f, float lodNearDist=4.0f, RenderMode renderMode=DEFAULT_RENDER_MODE, DisplayMode displayMode=MONO, RenderMethod renderMethod=DEFERRED, gpu::Batch *batch=nullptr)
 
bool hasViewFrustum () const
 
void setViewFrustum (const ViewFrustum &viewFrustum)
 Removes currently stored view frustums and adds a given one. More...
 
const ViewFrustum & getViewFrustum () const
 Returns reference to the top view frustum on the stack. More...
 
void pushViewFrustum (const ViewFrustum &viewFrustum)
 Adds a view frustum to the top of the stack. More...
 
void popViewFrustum ()
 Removes the top view frustum from the stack. More...
 
bool isStereo () const
 

Public Attributes

std::shared_ptr< gpu::Framebuffer > _blitFramebuffer
 
std::shared_ptr< render::ShapePipeline > _shapePipeline
 Temporarily set to a proper pipeline when generating batch commands to render shapes.
 
std::stack< ViewFrustum > _viewFrustums
 
glm::ivec4 _viewport { 0.0f, 0.0f, 1.0f, 1.0f }
 Viewport rectangle in pixels.
 
float _sizeScale { 1.0f }
 
int _boundaryLevelAdjust { 0 }
 
float _lodFarAngleHalfTan { 0.1f }
 
float _lodFarAngleHalfTanSq { _lodFarAngleHalfTan * _lodFarAngleHalfTan }
 See _lodFarAngleHalfTan.
 
float _lodNearAngleHalfTan { 0.01f }
 
float _lodNearAngleHalfTanSq { _lodNearAngleHalfTan * _lodNearAngleHalfTan }
 See _lodFarAngleHalfTan.
 
float _lodFarDist { 200.0f }
 
float _lodNearDist { 4.0f }
 Distance in meters at which _lodNearAngleHalfTan applies for size-based culling.
 
float _lodFarDistSq { _lodFarDist * _lodFarDist }
 See _lodNearDist.
 
float _lodNearDistSq { _lodNearDist * _lodNearDist }
 See _lodFarDist.
 
RenderMode _renderMode { DEFAULT_RENDER_MODE }
 
DisplayMode _displayMode { MONO }
 Current display mode. It can be temporarily overridden for secondary camera task and then restored when task is done.
 
RenderMethod _renderMethod { DEFERRED }
 
gpu::Batch * _batch = nullptr
 Current batch to which the commands will be written.
 
uint32_t _globalShapeKey { 0 }
 
uint32_t _itemShapeKey { 0 }
 
bool _enableTexturing { true }
 Set to false in MakeLightingModel task if texturing is disabled.
 
bool _enableBlendshape { true }
 Set to false in MakeLightingModel task if blendshapes are disabled.
 
bool _enableSkinning { true }
 Set to false in MakeLightingModel task if skinning is disabled.
 
RenderDetails _details
 Contains statistics about culling in current frame.
 
render::ScenePointer _scene
 Pointer to the main 3D scene.
 
int8_t _cameraMode { -1 }
 
std::function< void(gpu::Batch &, const gpu::TexturePointer &)> _hudOperator { nullptr }
 Used to generate commands for drawing HUD.
 
gpu::TexturePointer _hudTexture { nullptr }
 Texture that will be drawn as HUD.
 
bool _takingSnapshot { false }
 
StencilMaskMode _stencilMaskMode { StencilMaskMode::NONE }
 
std::function< void(gpu::Batch &)> _stencilMaskOperator
 Function that adds batch commands to draw stencil mesh for VR views.
 
ItemID _ignoreItem { 0 }
 
size_t _mirrorDepth { 0 }
 Current mirror depth. 0 for main view, 1 for a view reflected once so on.
 
size_t _numMirrorFlips { 0 }
 Incremented on each reflection. Not incremented for portals.
 

Detailed Description

Used by AppRenderArgs class in GraphicsEngine. They contain current frame setup and some statistics. During some of the rendering steps, render arguments are modified and then restored, for example during rendering of mirrored views.

Member Enumeration Documentation

◆ RenderMode

Enumerator
DEFAULT_RENDER_MODE 

Used for regular view.

SHADOW_RENDER_MODE 

Used for shadows and maybe highlight effect(?).

MIRROR_RENDER_MODE 

This is for the mirror camera mode for the main camera and not for actual mirrors in-game.

SECONDARY_CAMERA_RENDER_MODE 

Secondary camera can render to texture for effects such as mirrors or to screen.

Constructor & Destructor Documentation

◆ Args()

render::Args::Args ( const gpu::ContextPointer &  context,
float  sizeScale = 1.0f,
int  boundaryLevelAdjust = 0,
float  lodFarAngleHalfTan = 0.1f,
float  lodNearAngleHalfTan = 0.01f,
float  lodFarDist = 200.0f,
float  lodNearDist = 4.0f,
RenderMode  renderMode = DEFAULT_RENDER_MODE,
DisplayMode  displayMode = MONO,
RenderMethod  renderMethod = DEFERRED,
gpu::Batch *  batch = nullptr 
)
inline
Parameters
contextShared pointer to the GPU context.
sizeScaleRefer to _sizeScale comment.
boundaryLevelAdjustA coefficient related to octree depth.
lodFarAngleHalfTanPrecomputed half tangent of angle threshold for size-based culling. Applied at distance _lodFarDist.
lodNearAngleHalfTanPrecomputed half tangent of angle threshold for size-based culling. Applied at distance _lodNearDist.
lodFarDistDistance in meters at which _lodFarAngleHalfTan applies for size-based culling.
lodNearDistDistance in meters at which _lodNearAngleHalfTan applies for size-based culling.
renderModeDEFAULT_RENDER_MODE is always passed here.
displayModeTODO: It's always set to MONO in Application::updateRenderArgs() but then set to correct value soon after.
renderMethodTODO: It's always set to DEFERRED?
batchnullptr is passed here.

Member Function Documentation

◆ getViewFrustum()

const ViewFrustum& render::Args::getViewFrustum ( ) const
inline

Returns reference to the top view frustum on the stack.

This function should never be called when frustum stack is empty.

Returns
Top view frustum from the stack.

◆ hasViewFrustum()

bool render::Args::hasViewFrustum ( ) const
inline
Returns
true if there is one or more frustums stored currently.

◆ isStereo()

bool render::Args::isStereo ( ) const
inline
Returns
True if view is rendered in stereo (both HMD and desktop 3D displays).

◆ popViewFrustum()

void render::Args::popViewFrustum ( )
inline

Removes the top view frustum from the stack.

Should never be called on empty stack.

◆ pushViewFrustum()

void render::Args::pushViewFrustum ( const ViewFrustum &  viewFrustum)
inline

Adds a view frustum to the top of the stack.

Used for mirrors, secondary camera, shadow cameras and debugging purposes.

Parameters
viewFrustumView frustum to be added to the stack.

◆ setViewFrustum()

void render::Args::setViewFrustum ( const ViewFrustum &  viewFrustum)
inline

Removes currently stored view frustums and adds a given one.

Parameters
viewFrustumView frustum to add.

Member Data Documentation

◆ _blitFramebuffer

std::shared_ptr<gpu::Framebuffer> render::Args::_blitFramebuffer

Framebuffer where rendered image will be stored. For regular frame it's the final framebuffer. It's temporarily changed to other buffers when rendering mirrors and for secondary camera.

◆ _boundaryLevelAdjust

int render::Args::_boundaryLevelAdjust { 0 }

A coefficient related to octree depth. DOCTODO: needs to be documented in LODManager.

◆ _cameraMode

int8_t render::Args::_cameraMode { -1 }

Current camera mode for the primary camera. It's set once before command generation for a given frame starts.

◆ _globalShapeKey

uint32_t render::Args::_globalShapeKey { 0 }

Contains shared settings for all rendered shapes. Currently used to render all shapes as wireframe.

◆ _ignoreItem

ItemID render::Args::_ignoreItem { 0 }

Used to avoid drawing mirror or portal item. Set temporarily for mirror/portal views and then restored.

◆ _itemShapeKey

uint32_t render::Args::_itemShapeKey { 0 }

Settings for the currently rendered shape. It's set before generating batch commands for rendering a shape and set to 0 after it's finished.

◆ _lodFarAngleHalfTan

float render::Args::_lodFarAngleHalfTan { 0.1f }

Precomputed half tangent of angle threshold for size-based culling. Applied at distance _lodFarDist.

◆ _lodFarDist

float render::Args::_lodFarDist { 200.0f }

Distance in meters at which _lodFarAngleHalfTan applies for size-based culling. For distances between _lodFarDist and _lodNearDist the value is interpolated between near and far value.

◆ _lodNearAngleHalfTan

float render::Args::_lodNearAngleHalfTan { 0.01f }

Precomputed half tangent of angle threshold for size-based culling. Applied at distance _lodNearDist.

◆ _renderMethod

RenderMethod render::Args::_renderMethod { DEFERRED }

Current render method. Sometimes it's overridden locally and then restored, for example in DrawLayered3D::run. It's also set by SetRenderMethod job, for example in RenderForwardTask and RenderShadowsAndDeferredTask.

◆ _renderMode

RenderMode render::Args::_renderMode { DEFAULT_RENDER_MODE }

Current render mode for a given task. During execution of tasks that generate batch commands this is changed to reflect current task and then restored. This happens for example for shadow rendering task.

◆ _sizeScale

float render::Args::_sizeScale { 1.0f }

DOCTODO: this is very confusing. When Args are created, lodManager->getVisibilityDistance() is put here, even though variable is called scale. It seems to be used only when fetching spatial tree for orthographic camera and for drawing LOD reticle.

◆ _stencilMaskMode

StencilMaskMode render::Args::_stencilMaskMode { StencilMaskMode::NONE }

Used for view stencil in VR. Temporarily changed to StencilMaskMode::NONE for secondary camera and then set back to previous value.

◆ _takingSnapshot

bool render::Args::_takingSnapshot { false }

true when snapshot is being taken on primary camera. false when snapshot is being taken on secondary camera or not taken at all.

◆ _viewFrustums

std::stack<ViewFrustum> render::Args::_viewFrustums

Stores view frustums. Storing multiple frustums is required when tasks such as generating render batches for mirrors, shadows and secondary camera are executed.


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