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 HdTaskSharedPtrVector
const GetRenderingTasks()
const;
68 HdTaskSharedPtrVector
const GetPickingTasks()
const;
103 void SetViewportRenderOutput(
TfToken const& name);
113 void SetRenderOutputSettings(
TfToken const& name,
126 void SetPresentationOutput(
TfToken const &api,
VtValue const &framebuffer);
135 void SetLightingState(GlfSimpleLightingContextPtr
const& src);
144 void SetRenderBufferSize(
const GfVec2i &size);
156 void SetOverrideWindowPolicy(
157 const std::optional<CameraUtilConformWindowPolicy> &policy);
162 void SetCameraPath(
SdfPath const&
id);
168 void SetRenderViewport(
GfVec4d const& viewport);
174 void SetFreeCameraMatrices(
GfMatrix4d const& viewMatrix,
179 void SetFreeCameraClipPlanes(std::vector<GfVec4d>
const& clipPlanes);
186 void SetEnableSelection(
bool enable);
190 void SetSelectionColor(
GfVec4f const& color);
194 void SetSelectionLocateColor(
GfVec4f const& color);
199 void SetSelectionEnableOutline(
bool enableOutline);
205 void SetSelectionOutlineRadius(
unsigned int radius);
212 void SetEnableShadows(
bool enable);
217 void SetShadowParams(HdxShadowTaskParams
const& params);
224 bool IsConverged()
const;
247 void SetEnablePresentation(
bool enabled);
253 HdxTaskController(HdxTaskController
const&) =
delete;
254 HdxTaskController &operator=(HdxTaskController
const&) =
delete;
262 void _CreateRenderGraph();
264 void _CreateLightingTask();
265 void _CreateShadowTask();
268 void _CreateOitResolveTask();
269 void _CreateSelectionTask();
270 void _CreateColorizeSelectionTask();
271 void _CreateColorCorrectionTask();
272 void _CreateVisualizeAovTask();
273 void _CreatePickTask();
274 void _CreatePickFromRenderBufferTask();
275 void _CreateBoundingBoxTask();
276 void _CreateAovInputTask();
277 void _CreatePresentTask();
279 void _SetCameraParamForTasks(
SdfPath const&
id);
280 void _SetCameraFramingForTasks();
281 void _UpdateAovDimensions(
GfVec2i const& dimensions);
283 void _SetBlendStateForMaterialTag(
TfToken const& materialTag,
287 bool _ShadowsEnabled()
const;
288 bool _SelectionEnabled()
const;
289 bool _ColorizeSelectionEnabled()
const;
290 bool _ColorCorrectionEnabled()
const;
291 bool _VisualizeAovEnabled()
const;
292 bool _ColorizeQuantizationEnabled()
const;
293 bool _AovsSupported()
const;
294 bool _UsingAovs()
const;
299 SdfPathVector _GetAovEnabledTasks()
const;
302 bool _SupportBuiltInLightTypes();
303 void _SetBuiltInLightingState(GlfSimpleLightingContextPtr
const& src);
311 VtValue _GetDomeLightTexture(GlfSimpleLight
const& light);
312 void _SetParameters(
SdfPath const& pathName, GlfSimpleLight
const& light);
313 void _SetMaterialNetwork(
SdfPath const& pathName,
314 GlfSimpleLight
const& light);
315 GlfSimpleLight _GetLightAtId(
size_t const& pathIdx);
316 void _RemoveLightSprim(
size_t const& pathIdx);
317 void _ReplaceLightSprim(
size_t const& pathIdx, GlfSimpleLight
const& light,
330 ~_Delegate()
override =
default;
333 template <
typename T>
336 _valueCacheMap[id][key] = value;
338 template <
typename T>
346 return vParams.
Get<T>();
351 vCache.count(key) > 0) {
361 TfToken const& paramName)
override;
363 bool IsEnabled(
TfToken const& option)
const override;
365 GetRenderBufferDescriptor(
SdfPath const&
id)
override;
370 using _ValueCache = TfHashMap<TfToken, VtValue, TfToken::HashFunctor>;
371 using _ValueCacheMap = TfHashMap<SdfPath, _ValueCache, SdfPath::Hash>;
372 _ValueCacheMap _valueCacheMap;
375 std::unique_ptr<class HdxFreeCameraSceneDelegate> _freeCameraSceneDelegate;
380 SdfPathVector _renderTaskIds;
384 SdfPath _colorizeSelectionTaskId;
385 SdfPath _colorCorrectionTaskId;
388 SdfPath _pickFromRenderBufferTaskId;
396 SdfPathVector _lightIds;
399 SdfPathVector _aovBufferIds;
405 std::optional<CameraUtilConformWindowPolicy> _overrideWindowPolicy;
410PXR_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.