24#ifndef PXR_IMAGING_HDX_TASK_CONTROLLER_H
25#define PXR_IMAGING_HDX_TASK_CONTROLLER_H
29#include "pxr/imaging/hdx/api.h"
30#include "pxr/imaging/hdx/selectionTracker.h"
31#include "pxr/imaging/hdx/renderSetupTask.h"
32#include "pxr/imaging/hdx/shadowTask.h"
33#include "pxr/imaging/hdx/colorCorrectionTask.h"
34#include "pxr/imaging/hdx/boundingBoxTask.h"
36#include "pxr/imaging/hd/aov.h"
37#include "pxr/imaging/hd/renderIndex.h"
38#include "pxr/imaging/hd/sceneDelegate.h"
39#include "pxr/imaging/hd/task.h"
41#include "pxr/imaging/cameraUtil/framing.h"
43#include "pxr/usd/sdf/path.h"
48PXR_NAMESPACE_OPEN_SCOPE
55class HdxTaskController final
61 bool gpuEnabled =
true);
67 HdRenderIndex const* GetRenderIndex()
const {
return _index; }
71 SdfPath const& GetControllerId()
const {
return _controllerId; }
80 HdTaskSharedPtrVector
const GetRenderingTasks()
const;
85 HdTaskSharedPtrVector
const GetPickingTasks()
const;
120 void SetViewportRenderOutput(
TfToken const& name);
130 void SetRenderOutputSettings(
TfToken const& name,
143 void SetPresentationOutput(
TfToken const &api,
VtValue const &framebuffer);
152 void SetLightingState(GlfSimpleLightingContextPtr
const& src);
161 void SetRenderBufferSize(
const GfVec2i &size);
173 void SetOverrideWindowPolicy(
174 const std::optional<CameraUtilConformWindowPolicy> &policy);
179 void SetCameraPath(
SdfPath const&
id);
185 void SetRenderViewport(
GfVec4d const& viewport);
191 void SetFreeCameraMatrices(
GfMatrix4d const& viewMatrix,
196 void SetFreeCameraClipPlanes(std::vector<GfVec4d>
const& clipPlanes);
203 void SetEnableSelection(
bool enable);
207 void SetSelectionColor(
GfVec4f const& color);
211 void SetSelectionLocateColor(
GfVec4f const& color);
216 void SetSelectionEnableOutline(
bool enableOutline);
222 void SetSelectionOutlineRadius(
unsigned int radius);
229 void SetEnableShadows(
bool enable);
234 void SetShadowParams(HdxShadowTaskParams
const& params);
241 bool IsConverged()
const;
264 void SetEnablePresentation(
bool enabled);
270 HdxTaskController(HdxTaskController
const&) =
delete;
271 HdxTaskController &operator=(HdxTaskController
const&) =
delete;
279 void _CreateRenderGraph();
281 void _CreateLightingTask();
282 void _CreateShadowTask();
285 void _CreateOitResolveTask();
286 void _CreateSelectionTask();
287 void _CreateColorizeSelectionTask();
288 void _CreateColorCorrectionTask();
289 void _CreateVisualizeAovTask();
290 void _CreatePickTask();
291 void _CreatePickFromRenderBufferTask();
292 void _CreateBoundingBoxTask();
293 void _CreateAovInputTask();
294 void _CreatePresentTask();
296 void _SetCameraParamForTasks(
SdfPath const&
id);
297 void _SetCameraFramingForTasks();
298 void _UpdateAovDimensions(
GfVec2i const& dimensions);
300 void _SetBlendStateForMaterialTag(
TfToken const& materialTag,
304 bool _ShadowsEnabled()
const;
305 bool _SelectionEnabled()
const;
306 bool _ColorizeSelectionEnabled()
const;
307 bool _ColorCorrectionEnabled()
const;
308 bool _VisualizeAovEnabled()
const;
309 bool _ColorizeQuantizationEnabled()
const;
310 bool _AovsSupported()
const;
311 bool _UsingAovs()
const;
316 SdfPathVector _GetAovEnabledTasks()
const;
319 bool _SupportBuiltInLightTypes();
320 void _SetBuiltInLightingState(GlfSimpleLightingContextPtr
const& src);
328 VtValue _GetDomeLightTexture(GlfSimpleLight
const& light);
329 void _SetParameters(
SdfPath const& pathName, GlfSimpleLight
const& light);
330 void _SetMaterialNetwork(
SdfPath const& pathName,
331 GlfSimpleLight
const& light);
332 GlfSimpleLight _GetLightAtId(
size_t const& pathIdx);
333 void _RemoveLightSprim(
size_t const& pathIdx);
334 void _ReplaceLightSprim(
size_t const& pathIdx, GlfSimpleLight
const& light,
347 ~_Delegate()
override =
default;
350 template <
typename T>
353 _valueCacheMap[id][key] = value;
355 template <
typename T>
363 return vParams.
Get<T>();
368 vCache.count(key) > 0) {
378 TfToken const& paramName)
override;
380 bool IsEnabled(
TfToken const& option)
const override;
382 GetRenderBufferDescriptor(
SdfPath const&
id)
override;
387 using _ValueCache = TfHashMap<TfToken, VtValue, TfToken::HashFunctor>;
388 using _ValueCacheMap = TfHashMap<SdfPath, _ValueCache, SdfPath::Hash>;
389 _ValueCacheMap _valueCacheMap;
392 std::unique_ptr<class HdxFreeCameraSceneDelegate> _freeCameraSceneDelegate;
397 SdfPathVector _renderTaskIds;
401 SdfPath _colorizeSelectionTaskId;
402 SdfPath _colorCorrectionTaskId;
405 SdfPath _pickFromRenderBufferTaskId;
413 SdfPathVector _lightIds;
416 SdfPathVector _aovBufferIds;
422 std::optional<CameraUtilConformWindowPolicy> _overrideWindowPolicy;
427PXR_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.