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"
35 #include "pxr/imaging/hd/aov.h"
36 #include "pxr/imaging/hd/renderIndex.h"
37 #include "pxr/imaging/hd/sceneDelegate.h"
38 #include "pxr/imaging/hd/task.h"
40 #include "pxr/imaging/cameraUtil/framing.h"
42 #include "pxr/usd/sdf/path.h"
45 PXR_NAMESPACE_OPEN_SCOPE
52 class HdxTaskController final
63 HdRenderIndex const* GetRenderIndex()
const {
return _index; }
67 SdfPath const& GetControllerId()
const {
return _controllerId; }
76 HdTaskSharedPtrVector
const GetRenderingTasks()
const;
81 HdTaskSharedPtrVector
const GetPickingTasks()
const;
116 void SetViewportRenderOutput(
TfToken const& name);
126 void SetRenderOutputSettings(
TfToken const& name,
139 void SetPresentationOutput(
TfToken const &api,
VtValue const &framebuffer);
148 void SetLightingState(GlfSimpleLightingContextPtr
const& src);
157 void SetRenderBufferSize(
const GfVec2i &size);
175 void SetOverrideWindowPolicy(
176 const std::pair<bool, CameraUtilConformWindowPolicy> &policy);
181 void SetCameraPath(
SdfPath const&
id);
187 void SetRenderViewport(
GfVec4d const& viewport);
193 void SetFreeCameraMatrices(
GfMatrix4d const& viewMatrix,
198 void SetFreeCameraClipPlanes(std::vector<GfVec4d>
const& clipPlanes);
205 void SetEnableSelection(
bool enable);
209 void SetSelectionColor(
GfVec4f const& color);
214 void SetSelectionEnableOutline(
bool enableOutline);
220 void SetSelectionOutlineRadius(
unsigned int radius);
227 void SetEnableShadows(
bool enable);
232 void SetShadowParams(HdxShadowTaskParams
const& params);
239 bool IsConverged()
const;
255 void SetEnablePresentation(
bool enabled);
261 HdxTaskController(HdxTaskController
const&) =
delete;
262 HdxTaskController &operator=(HdxTaskController
const&) =
delete;
269 void _CreateRenderGraph();
271 void _CreateLightingTask();
272 void _CreateShadowTask();
274 void _CreateOitResolveTask();
275 void _CreateSelectionTask();
276 void _CreateColorizeSelectionTask();
277 void _CreateColorCorrectionTask();
278 void _CreateVisualizeAovTask();
279 void _CreatePickTask();
280 void _CreatePickFromRenderBufferTask();
281 void _CreateAovInputTask();
282 void _CreatePresentTask();
284 void _SetCameraParamForTasks(
SdfPath const&
id);
285 void _SetCameraFramingForTasks();
286 void _UpdateAovDimensions(
GfVec2i const& dimensions);
288 void _SetBlendStateForMaterialTag(
TfToken const& materialTag,
292 bool _ShadowsEnabled()
const;
293 bool _SelectionEnabled()
const;
294 bool _ColorizeSelectionEnabled()
const;
295 bool _ColorCorrectionEnabled()
const;
296 bool _VisualizeAovEnabled()
const;
297 bool _ColorizeQuantizationEnabled()
const;
298 bool _AovsSupported()
const;
299 bool _UsingAovs()
const;
304 SdfPathVector _GetAovEnabledTasks()
const;
308 void _SetParameters(
SdfPath const& pathName, GlfSimpleLight
const& light);
309 GlfSimpleLight _GetLightAtId(
size_t const& pathIdx);
310 void _RemoveLightSprim(
size_t const& pathIdx);
311 void _ReplaceLightSprim(
size_t const& pathIdx, GlfSimpleLight
const& light,
324 ~_Delegate()
override =
default;
327 template <
typename T>
330 _valueCacheMap[id][key] = value;
332 template <
typename T>
340 return vParams.
Get<T>();
345 vCache.count(key) > 0) {
355 TfToken const& paramName)
override;
356 bool IsEnabled(
TfToken const& option)
const override;
358 GetRenderBufferDescriptor(
SdfPath const&
id)
override;
363 using _ValueCache = TfHashMap<TfToken, VtValue, TfToken::HashFunctor>;
364 using _ValueCacheMap = TfHashMap<SdfPath, _ValueCache, SdfPath::Hash>;
365 _ValueCacheMap _valueCacheMap;
368 std::unique_ptr<class HdxFreeCameraSceneDelegate> _freeCameraSceneDelegate;
373 SdfPathVector _renderTaskIds;
377 SdfPath _colorizeSelectionTaskId;
378 SdfPath _colorCorrectionTaskId;
381 SdfPath _pickFromRenderBufferTaskId;
388 SdfPathVector _lightIds;
391 SdfPathVector _aovBufferIds;
397 std::pair<bool, CameraUtilConformWindowPolicy> _overrideWindowPolicy;
402 PXR_NAMESPACE_CLOSE_SCOPE
404 #endif // PXR_IMAGING_HDX_TASK_CONTROLLER_H
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Basic type for a vector of 2 int components.
Describes the allocation structure of a render buffer bprim.
bool IsHolding() const
Return true if this value is holding an object of type T, false otherwise.
Basic type for a vector of 4 double components.
T const & Get() const
Returns a const reference to the held object if the held object is of type T.
ColorCorrectionTask parameters.
Token for efficient comparison, assignment, and hashing of known strings.
RenderTask parameters (renderpass state).
Stores a 4x4 matrix of double elements.
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
Adapter class providing data exchange with the client scene graph.
std::vector< TfToken > TfTokenVector
Convenience types.
bool TfMapLookup(Container const &map, Key const &key, Result *valuePtr)
Checks if an item exists in a map or a TfHashMap.
A named, semantic collection of objects.
A path value used to locate objects in layers or scenegraphs.
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...
A bundle of state describing an AOV ("Arbitrary Output Variable") display channel.
Provides a container which may hold any type, and provides introspection and iteration over array typ...