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" 48 PXR_NAMESPACE_OPEN_SCOPE
55 class 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);
179 void SetOverrideWindowPolicy(
180 const std::pair<bool, CameraUtilConformWindowPolicy> &policy);
185 void SetCameraPath(
SdfPath const&
id);
191 void SetRenderViewport(
GfVec4d const& viewport);
197 void SetFreeCameraMatrices(
GfMatrix4d const& viewMatrix,
202 void SetFreeCameraClipPlanes(std::vector<GfVec4d>
const& clipPlanes);
209 void SetEnableSelection(
bool enable);
213 void SetSelectionColor(
GfVec4f const& color);
217 void SetSelectionLocateColor(
GfVec4f const& color);
222 void SetSelectionEnableOutline(
bool enableOutline);
228 void SetSelectionOutlineRadius(
unsigned int radius);
235 void SetEnableShadows(
bool enable);
240 void SetShadowParams(HdxShadowTaskParams
const& params);
247 bool IsConverged()
const;
270 void SetEnablePresentation(
bool enabled);
276 HdxTaskController(HdxTaskController
const&) =
delete;
277 HdxTaskController &operator=(HdxTaskController
const&) =
delete;
285 void _CreateRenderGraph();
287 void _CreateLightingTask();
288 void _CreateShadowTask();
291 void _CreateOitResolveTask();
292 void _CreateSelectionTask();
293 void _CreateColorizeSelectionTask();
294 void _CreateColorCorrectionTask();
295 void _CreateVisualizeAovTask();
296 void _CreatePickTask();
297 void _CreatePickFromRenderBufferTask();
298 void _CreateBoundingBoxTask();
299 void _CreateAovInputTask();
300 void _CreatePresentTask();
302 void _SetCameraParamForTasks(
SdfPath const&
id);
303 void _SetCameraFramingForTasks();
304 void _UpdateAovDimensions(
GfVec2i const& dimensions);
306 void _SetBlendStateForMaterialTag(
TfToken const& materialTag,
310 bool _ShadowsEnabled()
const;
311 bool _SelectionEnabled()
const;
312 bool _ColorizeSelectionEnabled()
const;
313 bool _ColorCorrectionEnabled()
const;
314 bool _VisualizeAovEnabled()
const;
315 bool _ColorizeQuantizationEnabled()
const;
316 bool _AovsSupported()
const;
317 bool _UsingAovs()
const;
322 SdfPathVector _GetAovEnabledTasks()
const;
325 bool _SupportBuiltInLightTypes();
326 void _SetBuiltInLightingState(GlfSimpleLightingContextPtr
const& src);
334 VtValue _GetDomeLightTexture(GlfSimpleLight
const& light);
335 void _SetParameters(
SdfPath const& pathName, GlfSimpleLight
const& light);
336 void _SetMaterialNetwork(
SdfPath const& pathName,
337 GlfSimpleLight
const& light);
338 GlfSimpleLight _GetLightAtId(
size_t const& pathIdx);
339 void _RemoveLightSprim(
size_t const& pathIdx);
340 void _ReplaceLightSprim(
size_t const& pathIdx, GlfSimpleLight
const& light,
353 ~_Delegate()
override =
default;
356 template <
typename T>
359 _valueCacheMap[id][key] = value;
361 template <
typename T>
369 return vParams.
Get<T>();
374 vCache.count(key) > 0) {
384 TfToken const& paramName)
override;
386 bool IsEnabled(
TfToken const& option)
const override;
388 GetRenderBufferDescriptor(
SdfPath const&
id)
override;
393 using _ValueCache = TfHashMap<TfToken, VtValue, TfToken::HashFunctor>;
394 using _ValueCacheMap = TfHashMap<SdfPath, _ValueCache, SdfPath::Hash>;
395 _ValueCacheMap _valueCacheMap;
398 std::unique_ptr<class HdxFreeCameraSceneDelegate> _freeCameraSceneDelegate;
403 SdfPathVector _renderTaskIds;
407 SdfPath _colorizeSelectionTaskId;
408 SdfPath _colorCorrectionTaskId;
411 SdfPath _pickFromRenderBufferTaskId;
419 SdfPathVector _lightIds;
422 SdfPathVector _aovBufferIds;
428 std::pair<bool, CameraUtilConformWindowPolicy> _overrideWindowPolicy;
433 PXR_NAMESPACE_CLOSE_SCOPE
435 #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.
Basic type for a vector of 4 double components.
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.
T const & Get() const &
Returns a const reference to the held object if the held object is of type T.
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.
bool IsHolding() const
Return true if this value is holding an object of type T, false otherwise.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
BoundingBoxTask parameters.