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);
202 void SetEnableSelection(
bool enable);
206 void SetSelectionColor(
GfVec4f const& color);
210 void SetSelectionLocateColor(
GfVec4f const& color);
215 void SetSelectionEnableOutline(
bool enableOutline);
221 void SetSelectionOutlineRadius(
unsigned int radius);
228 void SetEnableShadows(
bool enable);
233 void SetShadowParams(HdxShadowTaskParams
const& params);
249 bool IsConverged()
const;
272 void SetEnablePresentation(
bool enabled);
278 HdxTaskController(HdxTaskController
const&) =
delete;
279 HdxTaskController &operator=(HdxTaskController
const&) =
delete;
287 void _CreateRenderGraph();
289 void _CreateLightingTask();
290 void _CreateShadowTask();
293 void _CreateOitResolveTask();
294 void _CreateSelectionTask();
295 void _CreateColorizeSelectionTask();
296 void _CreateColorCorrectionTask();
297 void _CreateVisualizeAovTask();
298 void _CreatePickTask();
299 void _CreatePickFromRenderBufferTask();
300 void _CreateBoundingBoxTask();
301 void _CreateAovInputTask();
302 void _CreatePresentTask();
304 void _SetCameraParamForTasks(
SdfPath const&
id);
305 void _SetCameraFramingForTasks();
306 void _UpdateAovDimensions(
GfVec2i const& dimensions);
308 void _SetBlendStateForMaterialTag(
TfToken const& materialTag,
312 bool _ShadowsEnabled()
const;
313 bool _SelectionEnabled()
const;
314 bool _ColorizeSelectionEnabled()
const;
315 bool _ColorCorrectionEnabled()
const;
316 bool _VisualizeAovEnabled()
const;
317 bool _ColorizeQuantizationEnabled()
const;
318 bool _AovsSupported()
const;
319 bool _UsingAovs()
const;
324 SdfPathVector _GetAovEnabledTasks()
const;
327 bool _SupportBuiltInLightTypes();
328 void _SetBuiltInLightingState(GlfSimpleLightingContextPtr
const& src);
336 VtValue _GetDomeLightTexture(GlfSimpleLight
const& light);
337 void _SetParameters(
SdfPath const& pathName, GlfSimpleLight
const& light);
338 void _SetMaterialNetwork(
SdfPath const& pathName,
339 GlfSimpleLight
const& light);
340 GlfSimpleLight _GetLightAtId(
size_t const& pathIdx);
341 void _RemoveLightSprim(
size_t const& pathIdx);
342 void _ReplaceLightSprim(
size_t const& pathIdx, GlfSimpleLight
const& light,
355 ~_Delegate()
override =
default;
358 template <
typename T>
361 _valueCacheMap[id][key] = value;
363 template <
typename T>
371 return vParams.
Get<T>();
376 vCache.count(key) > 0) {
386 TfToken const& paramName)
override;
388 bool IsEnabled(
TfToken const& option)
const override;
390 GetRenderBufferDescriptor(
SdfPath const&
id)
override;
395 using _ValueCache = TfHashMap<TfToken, VtValue, TfToken::HashFunctor>;
396 using _ValueCacheMap = TfHashMap<SdfPath, _ValueCache, SdfPath::Hash>;
397 _ValueCacheMap _valueCacheMap;
400 std::unique_ptr<class HdxFreeCameraSceneDelegate> _freeCameraSceneDelegate;
405 SdfPathVector _renderTaskIds;
409 SdfPath _colorizeSelectionTaskId;
410 SdfPath _colorCorrectionTaskId;
413 SdfPath _pickFromRenderBufferTaskId;
421 SdfPathVector _lightIds;
424 SdfPathVector _aovBufferIds;
430 std::optional<CameraUtilConformWindowPolicy> _overrideWindowPolicy;
435PXR_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.