Diligent Engine
 
Loading...
Searching...
No Matches
Diligent::USD::HnTaskManager Class Reference

Task manager implementation in Hydrogent. More...

#include <HnTaskManager.hpp>

Public Member Functions

const pxr::HdTaskSharedPtrVector GetTasks (const std::vector< TaskUID > *TaskOrder=nullptr) const
 
void SetCollection (const pxr::HdRprimCollection &Collection)
 Sets new collection for the render tasks.
 
void SetRenderTags (const pxr::TfTokenVector &RenderTags)
 Sets new render tags for the render tasks.
 
void SetParameter (const pxr::SdfPath &TaskId, const pxr::TfToken &ValueKey, pxr::VtValue Value)
 Sets the parameter value.
 
template<typename ParamterType>
void SetParameter (const pxr::SdfPath &TaskId, const pxr::TfToken &ValueKey, ParamterType &&Value)
 Sets the parameter value.
 
template<typename ParamterType>
void SetParameter (const pxr::TfToken &TaskName, const pxr::TfToken &ValueKey, ParamterType &&Value)
 Sets the parameter value.
 
template<typename TaskType, typename TaskParamsType>
void CreateTask (const pxr::SdfPath &TaskId, TaskUID UID, TaskParamsType &&Params, bool Enabled=true)
 
template<typename TaskType, typename TaskParamsType>
void CreateTask (const pxr::TfToken &TaskName, TaskUID UID, TaskParamsType &&Params, bool Enabled=true)
 
const pxr::SdfPath * GetSelectedRPrimId () const
 
void EnableMaterial (const pxr::TfToken &MaterialTag, bool Enable)
 Enables or disables the tasks associated with the specified material tag.
 
void EnableEnvironmentMap (bool Enable)
 Enables or disables environment map rendering.
 
bool IsEnvironmentMapEnabled () const
 Returns true if environment map rendering is enabled.
 
bool IsMaterialEnabled (const pxr::TfToken &MaterialTag) const
 Returns true if the tasks associated with the specified material tag are enabled.
 
void EnableSelectedPrimBoundBox (bool Enable)
 Enables or disables the rendering of the selected Rprim's bounding box.
 
bool IsSelectedPrimBoundBoxEnabled () const
 Returns true if the rendering of the selected Rprim's bounding box is enabled.
 
void ResetTAA ()
 Resets temporal anti-aliasing.
 
void SuspendSuperSampling ()
 Suspends temporal super-sampling.
 

Detailed Description

Task manager implementation in Hydrogent.

Member Function Documentation

◆ CreateTask() [1/2]

template<typename TaskType, typename TaskParamsType>
void Diligent::USD::HnTaskManager::CreateTask ( const pxr::SdfPath & TaskId,
TaskUID UID,
TaskParamsType && Params,
bool Enabled = true )

Creates a new render task.

Parameters
[in]TaskId- The task ID that will be used to register the task in the render index.
[in]UID- The task UID that will be used to identify the task in the task manager.
[in]Params- The task parameters that will be associated with the task using the task ID.
[in]Enabled- Whether the task is enabled.

◆ CreateTask() [2/2]

template<typename TaskType, typename TaskParamsType>
void Diligent::USD::HnTaskManager::CreateTask ( const pxr::TfToken & TaskName,
TaskUID UID,
TaskParamsType && Params,
bool Enabled = true )

Creates a new render task.

This is method is similar to the one above, but it automatically appends the task ID as child of the manager ID.

◆ GetSelectedRPrimId()

const pxr::SdfPath * Diligent::USD::HnTaskManager::GetSelectedRPrimId ( ) const

Returns the Id of the selected Rprim:

  • if no selected Rprim data is available, returns nullptr.
  • if no Rprim is selected, returns empty path.
  • if an Rprim is selected, returns the Sdf Path of the selected Rprim.

◆ GetTasks()

const pxr::HdTaskSharedPtrVector Diligent::USD::HnTaskManager::GetTasks ( const std::vector< TaskUID > * TaskOrder = nullptr) const

Returns the list of tasks that can be passed to the Hydra engine for execution.

Parameters
[in]TaskOrder- Optional task order. If not specified, the following default order is used:
  • BeginFrame
    • Prepares render targets and other frame resources
  • RenderShadows
  • BeginMainPass
    • Binds the Color and Mesh Id render targes and the the selection depth buffer
  • RenderRprimsDefaultSelected
    • Renders only selected Rprims with the default material tag
  • RenderRprimsMaskedSelected
    • Renders only selected Rprims with the masked material tag
  • CopySelectionDepth
    • Copies the selection depth buffer to the main depth buffer
    • Binds the Color and Mesh Id render targes and the main depth buffer
  • RenderRprimsDefaultUnselected
    • Renders only unselected Rprims with the default material tag
  • RenderRprimsMaskedUnselected
    • Renders only unselected Rprims with the masked material tag
  • RenderEnvMap
  • RenderBoundBox
  • BeginOITPass
    • Binds and clears OIT layers for rendering
  • RenderRprimsOITLayers
  • EndOITPass
    • Applies OIT attenuation to color, base color, material and IBL targets
  • RenderRprimsAdditive
    • Renders all Rprims with additive material tag
  • RenderRprimsTranslucent
    • Renders all Rprims with translucent material tag
    • If OIT is enabled, does not write Mesh ID, Motion Vectors, Normals, Depth
  • RenderRprimsTranslucentMeshId
    • Renders all Rprims with translucent material tag (Mesh ID, Motion Vectors, Normals, Depth)
  • RenderRprimsAdditiveSelected
    • Renders only selected Rprims with the additive material tag (depth only)
  • RenderRprimsTranslucentSelected
    • Renders only selected Rprims with the translucent material tag (depth only)
  • ComputeDepthBounds
  • ReadRprimId
  • ProcessSelection
    • Generates the closest selected location texture using the Jump-Flood algorithm
  • PostProcess
Task Selected Rprims Unselected Rprims Color Mesh ID G-Buffer Selection Detph Main Depth
BeginFrame
RenderShadows
BeginMainPass
RenderRprimsDefaultSelected V V V V V
RenderRprimsMaskedSelected V V V V V
CopySelectionDepth V—copy– ---->V
RenderRprimsDefaultUnselected V V V V V
RenderRprimsMaskedUnselected V V V V V
RenderEnvMap V
RenderBoundBox V
RenderRprimsAdditive V V V V V V
BeginOITPass
RenderRprimsOITLayers V V
EndOITPass
RenderRprimsTranslucent V V V V V V
RenderRprimsTranslucentMeshId V V V MV, N V
RenderRprimsAdditiveSelected V V
RenderRprimsTranslucentSelected V V
ComputeDepthBounds
ReadRprimId
ProcessSelection
PostProcess
Returns
The list of tasks that can be passed to pxr::HdEngine::Execute.
Remarks
Only enabled tasks are returned.