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
38class HdxTaskController final
44 bool gpuEnabled =
true);
50 HdRenderIndex const* GetRenderIndex()
const {
return _index; }
54 SdfPath const& GetControllerId()
const {
return _controllerId; }
63 SdfPathVector GetRenderingTaskPaths()
const;
68 SdfPathVector GetPickingTaskPaths()
const;
76 HdTaskSharedPtrVector GetRenderingTasks()
const;
84 HdTaskSharedPtrVector GetPickingTasks()
const;
119 void SetViewportRenderOutput(
TfToken const& name);
129 void SetRenderOutputSettings(
TfToken const& name,
142 void SetPresentationOutput(
TfToken const &api,
VtValue const &framebuffer);
151 void SetLightingState(GlfSimpleLightingContextPtr
const& src);
160 void SetRenderBufferSize(
const GfVec2i &size);
172 void SetOverrideWindowPolicy(
173 const std::optional<CameraUtilConformWindowPolicy> &policy);
178 void SetCameraPath(
SdfPath const&
id);
184 void SetRenderViewport(
GfVec4d const& viewport);
190 void SetFreeCameraMatrices(
GfMatrix4d const& viewMatrix,
195 void SetFreeCameraClipPlanes(std::vector<GfVec4d>
const& clipPlanes);
206 void SetEnableSelection(
bool enable);
210 void SetSelectionColor(
GfVec4f const& color);
214 void SetSelectionLocateColor(
GfVec4f const& color);
219 void SetSelectionEnableOutline(
bool enableOutline);
225 void SetSelectionOutlineRadius(
unsigned int radius);
232 void SetEnableShadows(
bool enable);
237 void SetShadowParams(HdxShadowTaskParams
const& params);
253 bool IsConverged()
const;
276 void SetEnablePresentation(
bool enabled);
282 HdxTaskController(HdxTaskController
const&) =
delete;
283 HdxTaskController &operator=(HdxTaskController
const&) =
delete;
291 void _CreateRenderGraph();
293 void _CreateLightingTask();
294 void _CreateShadowTask();
297 void _CreateOitResolveTask();
298 void _CreateSelectionTask();
299 void _CreateColorizeSelectionTask();
300 void _CreateColorCorrectionTask();
301 void _CreateVisualizeAovTask();
302 void _CreatePickTask();
303 void _CreatePickFromRenderBufferTask();
304 void _CreateBoundingBoxTask();
305 void _CreateAovInputTask();
306 void _CreatePresentTask();
308 void _SetCameraParamForTasks(
SdfPath const&
id);
309 void _SetCameraFramingForTasks();
310 void _UpdateAovDimensions(
GfVec2i const& dimensions);
312 void _SetBlendStateForMaterialTag(
TfToken const& materialTag,
316 bool _ShadowsEnabled()
const;
317 bool _SelectionEnabled()
const;
318 bool _ColorizeSelectionEnabled()
const;
319 bool _ColorCorrectionEnabled()
const;
320 bool _VisualizeAovEnabled()
const;
321 bool _ColorizeQuantizationEnabled()
const;
322 bool _AovsSupported()
const;
323 bool _UsingAovs()
const;
328 SdfPathVector _GetAovEnabledTasks()
const;
331 bool _SupportBuiltInLightTypes();
332 void _SetBuiltInLightingState(GlfSimpleLightingContextPtr
const& src);
340 VtValue _GetDomeLightTexture(GlfSimpleLight
const& light);
341 void _SetParameters(
SdfPath const& pathName, GlfSimpleLight
const& light);
342 void _SetMaterialNetwork(
SdfPath const& pathName,
343 GlfSimpleLight
const& light);
344 GlfSimpleLight _GetLightAtId(
size_t const& pathIdx);
345 void _RemoveLightSprim(
size_t const& pathIdx);
346 void _ReplaceLightSprim(
size_t const& pathIdx, GlfSimpleLight
const& light,
359 ~_Delegate()
override =
default;
362 template <
typename T>
365 _valueCacheMap[id][key] = value;
367 template <
typename T>
375 return vParams.
Get<T>();
380 vCache.count(key) > 0) {
390 TfToken const& paramName)
override;
392 bool IsEnabled(
TfToken const& option)
const override;
394 GetRenderBufferDescriptor(
SdfPath const&
id)
override;
399 using _ValueCache = TfHashMap<TfToken, VtValue, TfToken::HashFunctor>;
400 using _ValueCacheMap = TfHashMap<SdfPath, _ValueCache, SdfPath::Hash>;
401 _ValueCacheMap _valueCacheMap;
404 std::unique_ptr<class HdxFreeCameraSceneDelegate> _freeCameraSceneDelegate;
409 SdfPathVector _renderTaskIds;
413 SdfPath _colorizeSelectionTaskId;
414 SdfPath _colorCorrectionTaskId;
417 SdfPath _pickFromRenderBufferTaskId;
425 SdfPathVector _lightIds;
428 SdfPathVector _aovBufferIds;
434 std::optional<CameraUtilConformWindowPolicy> _overrideWindowPolicy;
439PXR_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 Hydra render index is a flattened representation of the client scene graph, which may be composed...
A named, semantic collection of objects.
Adapter class providing data exchange with the client scene graph.
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.