7#ifndef PXR_IMAGING_HDX_TASK_CONTROLLER_H
8#define PXR_IMAGING_HDX_TASK_CONTROLLER_H
12#include "pxr/imaging/hdx/api.h"
13#include "pxr/imaging/hdx/selectionTracker.h"
14#include "pxr/imaging/hdx/renderSetupTask.h"
15#include "pxr/imaging/hdx/shadowTask.h"
16#include "pxr/imaging/hdx/colorCorrectionTask.h"
17#include "pxr/imaging/hdx/boundingBoxTask.h"
19#include "pxr/imaging/hd/aov.h"
20#include "pxr/imaging/hd/renderIndex.h"
21#include "pxr/imaging/hd/sceneDelegate.h"
22#include "pxr/imaging/hd/task.h"
24#include "pxr/imaging/cameraUtil/framing.h"
26#include "pxr/usd/sdf/path.h"
31PXR_NAMESPACE_OPEN_SCOPE
47 bool gpuEnabled =
true);
176 const std::optional<CameraUtilConformWindowPolicy> &policy);
294 void _CreateRenderGraph();
296 void _CreateLightingTask();
297 void _CreateShadowTask();
300 void _CreateOitResolveTask();
301 void _CreateSelectionTask();
302 void _CreateColorizeSelectionTask();
303 void _CreateColorCorrectionTask();
304 void _CreateVisualizeAovTask();
305 void _CreatePickTask();
306 void _CreatePickFromRenderBufferTask();
307 void _CreateBoundingBoxTask();
308 void _CreateAovInputTask();
309 void _CreatePresentTask();
311 void _SetCameraParamForTasks(
SdfPath const&
id);
312 void _SetCameraFramingForTasks();
313 void _UpdateAovDimensions(
GfVec2i const& dimensions);
315 void _SetBlendStateForMaterialTag(
TfToken const& materialTag,
319 bool _ShadowsEnabled()
const;
320 bool _SelectionEnabled()
const;
321 bool _ColorizeSelectionEnabled()
const;
322 bool _ColorCorrectionEnabled()
const;
323 bool _VisualizeAovEnabled()
const;
324 bool _ColorizeQuantizationEnabled()
const;
325 bool _AovsSupported()
const;
326 bool _UsingAovs()
const;
331 SdfPathVector _GetAovEnabledTasks()
const;
334 bool _SupportBuiltInLightTypes();
335 void _SetBuiltInLightingState(GlfSimpleLightingContextPtr
const& src);
343 VtValue _GetDomeLightTexture(GlfSimpleLight
const& light);
344 void _SetParameters(
SdfPath const& pathName, GlfSimpleLight
const& light);
345 void _SetMaterialNetwork(
SdfPath const& pathName,
346 GlfSimpleLight
const& light);
347 GlfSimpleLight _GetLightAtId(
size_t const& pathIdx);
348 void _RemoveLightSprim(
size_t const& pathIdx);
349 void _ReplaceLightSprim(
size_t const& pathIdx, GlfSimpleLight
const& light,
362 ~_Delegate()
override =
default;
365 template <
typename T>
368 _valueCacheMap[id][key] = value;
370 template <
typename T>
378 return vParams.
Get<T>();
383 vCache.count(key) > 0) {
393 TfToken const& paramName)
override;
395 bool IsEnabled(
TfToken const& option)
const override;
397 GetRenderBufferDescriptor(
SdfPath const&
id)
override;
402 using _ValueCache = TfHashMap<TfToken, VtValue, TfToken::HashFunctor>;
403 using _ValueCacheMap = TfHashMap<SdfPath, _ValueCache, SdfPath::Hash>;
404 _ValueCacheMap _valueCacheMap;
407 std::unique_ptr<class HdxFreeCameraSceneDelegate> _freeCameraSceneDelegate;
412 SdfPathVector _renderTaskIds;
416 SdfPath _colorizeSelectionTaskId;
417 SdfPath _colorCorrectionTaskId;
420 SdfPath _pickFromRenderBufferTaskId;
428 SdfPathVector _lightIds;
431 SdfPathVector _aovBufferIds;
437 std::optional<CameraUtilConformWindowPolicy> _overrideWindowPolicy;
442PXR_NAMESPACE_CLOSE_SCOPE
Stores a 4x4 matrix of double elements.
Basic type for a vector of 2 int components.
Basic type for a vector of 4 double components.
Basic type for a vector of 4 float components.
A render buffer is a handle to a data resource that can be rendered into, such as a 2d image for a dr...
The render index is part of the Hydra 1.0 API and is only used for emulation purposes so that HdScene...
A named, semantic collection of objects.
Adapter class providing data exchange with the client scene graph.
HDX_API void SetViewportRenderOutput(TfToken const &name)
Set which output should be rendered to the viewport.
HDX_API void SetSelectionColor(GfVec4f const &color)
Set the selection color.
HDX_API void SetRenderOutputSettings(TfToken const &name, HdAovDescriptor const &desc)
Set custom parameters for an AOV.
HDX_API void SetCameraPath(SdfPath const &id)
– Scene camera – Set the camera param on tasks to a USD camera path.
HDX_API SdfPathVector GetPickingTaskPaths() const
Obtain paths to tasks managed by the task controller, for picking.
HDX_API void SetCollection(HdRprimCollection const &collection)
Set the collection to be rendered.
HDX_API void SetFreeCameraClipPlanes(std::vector< GfVec4d > const &clipPlanes)
Set the free camera clip planes.
HDX_API void SetColorCorrectionParams(HdxColorCorrectionTaskParams const ¶ms)
Configure color correction by settings params.
HDX_API bool IsConverged() const
Return whether the image has converged.
HDX_API void SetOverrideWindowPolicy(const std::optional< CameraUtilConformWindowPolicy > &policy)
Specifies whether to force a window policy when conforming the frustum of the camera to match the dis...
HDX_API HdTaskSharedPtrVector GetPickingTasks() const
HDX_API void SetSelectionLocateColor(GfVec4f const &color)
Set the selection locate (over) color.
HdRenderIndex * GetRenderIndex()
Return the render index this controller is bound to.
HDX_API void SetRenderParams(HdxRenderTaskParams const ¶ms)
Set the render params.
HDX_API void SetLightingState(GlfSimpleLightingContextPtr const &src)
Set the lighting state for the scene.
HDX_API SdfPathVector GetRenderingTaskPaths() const
Obtain paths to the tasks managed by the task controller, for image generation.
HDX_API void SetSelectionEnableOutline(bool enableOutline)
Set if the selection highlight should be rendered as an outline around the selected objects or as a s...
HDX_API SdfPath GetFreeCameraPath()
Get the free camera's Hydra prim path.
HDX_API HdRenderBuffer * GetRenderOutput(TfToken const &name)
Get the buffer for a rendered output.
HDX_API void SetPresentationOutput(TfToken const &api, VtValue const &framebuffer)
The destination API (e.g., OpenGL, see hgiInterop for details) and framebuffer that the AOVs are pres...
HDX_API void SetFraming(const CameraUtilFraming &framing)
Determines how the filmback of the camera is mapped into the pixels of the render buffer and what pix...
HDX_API void SetRenderOutputs(TfTokenVector const &names)
Set the list of outputs to be rendered.
HDX_API void SetFreeCameraMatrices(GfMatrix4d const &viewMatrix, GfMatrix4d const &projectionMatrix)
– Free camera – Set the view and projection matrices for the free camera.
HDX_API void SetRenderBufferSize(const GfVec2i &size)
Set the size of the render buffers backing the AOVs.
HDX_API void SetSelectionOutlineRadius(unsigned int radius)
Set the selection outline radius (thickness) in pixels.
HDX_API void SetEnablePresentation(bool enabled)
Enable / disable presenting the render to bound framebuffer.
HDX_API void SetEnableShadows(bool enable)
Turns the shadow task on or off.
HDX_API HdTaskSharedPtrVector GetRenderingTasks() const
HDX_API void SetRenderTags(TfTokenVector const &renderTags)
Set the "view" opinion of the scenes render tags.
SdfPath const & GetControllerId() const
Return the controller's scene-graph id (prefixed to any scene graph objects it creates).
HDX_API void SetBBoxParams(const HdxBoundingBoxTaskParams ¶ms)
Set the bounding box params.
HDX_API HdAovDescriptor GetRenderOutputSettings(TfToken const &name) const
Get parameters for an AOV.
HDX_API void SetEnableSelection(bool enable)
Turns the selection task on or off.
HDX_API void SetRenderViewport(GfVec4d const &viewport)
Set the viewport param on tasks.
HDX_API void SetShadowParams(HdxShadowTaskParams const ¶ms)
Set the shadow params.
A path value used to locate objects in layers or scenegraphs.
Token for efficient comparison, assignment, and hashing of known strings.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
T const & Get() const &
Returns a const reference to the held object if the held object is of type T.
bool IsHolding() const
Return true if this value is holding an object of type T, false otherwise.
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
bool TfMapLookup(Container const &map, Key const &key, Result *valuePtr)
Checks if an item exists in a map or a TfHashMap.
A bundle of state describing an AOV ("Arbitrary Output Variable") display channel.
Describes the allocation structure of a render buffer bprim.
BoundingBoxTask parameters.
ColorCorrectionTask parameters.
RenderTask parameters (renderpass state).
std::vector< TfToken > TfTokenVector
Convenience types.