HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
engine.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 
8 /// \file usdImagingGL/engine.h
9 
10 #ifndef PXR_USD_IMAGING_USD_IMAGING_GL_ENGINE_H
11 #define PXR_USD_IMAGING_USD_IMAGING_GL_ENGINE_H
12 
14 #include "pxr/pxr.h"
18 
21 
23 
24 #include "pxr/imaging/hd/driver.h"
25 #include "pxr/imaging/hd/engine.h"
28 
31 
32 #include "pxr/imaging/hgi/hgi.h"
33 
36 
37 #include "pxr/imaging/hgi/hgi.h"
38 
39 #include "pxr/usd/sdf/path.h"
40 #include "pxr/usd/usd/timeCode.h"
41 
42 #include "pxr/base/gf/frustum.h"
43 #include "pxr/base/gf/matrix4d.h"
44 #include "pxr/base/gf/vec4d.h"
45 #include "pxr/base/gf/vec4f.h"
46 #include "pxr/base/gf/vec4i.h"
47 
48 #include "pxr/base/vt/dictionary.h"
49 
51 
53 
54 class UsdPrim;
55 class HdRenderIndex;
56 class HdxTaskController;
57 class UsdImagingDelegate;
58 
69 
71 
72 namespace UsdImagingGLEngine_Impl
73 {
74  using _AppSceneIndicesSharedPtr = std::shared_ptr<struct _AppSceneIndices>;
75 }
76 
77 /// \class UsdImagingGLEngine
78 ///
79 /// The UsdImagingGLEngine is the main entry point API for rendering USD scenes.
80 ///
82 {
83 public:
84  /// Parameters to construct UsdImagingGLEngine.
85  struct Parameters
86  {
91  /// An HdDriver, containing the Hgi of your choice, can be optionally passed
92  /// in during construction. This can be helpful if your application creates
93  /// multiple UsdImagingGLEngine's that wish to use the same HdDriver / Hgi.
95  /// The \p rendererPluginId argument indicates the renderer plugin that
96  /// Hydra should use. If the empty token is passed in, a default renderer
97  /// plugin will be chosen depending on the value of \p gpuEnabled.
99  /// The \p gpuEnabled argument determines if this instance will allow Hydra
100  /// to use the GPU to produce images.
101  bool gpuEnabled = true;
102  /// \p displayUnloadedPrimsWithBounds draws bounding boxes for unloaded
103  /// prims if they have extents/extentsHint authored.
105  /// \p allowAsynchronousSceneProcessing indicates to constructed hydra
106  /// scene indices that asynchronous processing is allowow. Applications
107  /// should perodically call PollForAsynchronousUpdates on the engine.
109  };
110 
111  // ---------------------------------------------------------------------
112  /// \name Construction
113  /// @{
114  // ---------------------------------------------------------------------
115 
118 
119  /// An HdDriver, containing the Hgi of your choice, can be optionally passed
120  /// in during construction. This can be helpful if you application creates
121  /// multiple UsdImagingGLEngine that wish to use the same HdDriver / Hgi.
122  /// The \p rendererPluginId argument indicates the renderer plugin that
123  /// Hyrda should use. If the empty token is passed in, a default renderer
124  /// plugin will be chosen depending on the value of \p gpuEnabled.
125  /// The \p gpuEnabled argument determines if this instance will allow Hydra
126  /// to use the GPU to produce images.
128  UsdImagingGLEngine(const HdDriver& driver = HdDriver(),
129  const TfToken& rendererPluginId = TfToken(),
130  bool gpuEnabled = true);
131 
133  UsdImagingGLEngine(const SdfPath& rootPath,
134  const SdfPathVector& excludedPaths,
135  const SdfPathVector& invisedPaths = SdfPathVector(),
136  const SdfPath& sceneDelegateID =
138  const HdDriver& driver = HdDriver(),
139  const TfToken& rendererPluginId = TfToken(),
140  bool gpuEnabled = true,
141  bool displayUnloadedPrimsWithBounds = false,
142  bool allowAsynchronousSceneProcessing = false);
143 
144  // Disallow copies
145  UsdImagingGLEngine(const UsdImagingGLEngine&) = delete;
147 
150 
151  /// @}
152 
153  // ---------------------------------------------------------------------
154  /// \name Rendering
155  /// @{
156  // ---------------------------------------------------------------------
157 
158  /// Support for batched drawing
160  void PrepareBatch(const UsdPrim& root,
163  void RenderBatch(const SdfPathVector& paths,
165 
166  /// Entry point for kicking off a render
168  void Render(const UsdPrim& root,
170 
171  /// Returns true if the resulting image is fully converged.
172  /// (otherwise, caller may need to call Render() again to refine the result)
174  bool IsConverged() const;
175 
176  /// @}
177 
178  // ---------------------------------------------------------------------
179  /// \name Root Transform and Visibility
180  /// @{
181  // ---------------------------------------------------------------------
182 
183  /// Sets the root transform.
185  void SetRootTransform(GfMatrix4d const& xf);
186 
187  /// Sets the root visibility.
189  void SetRootVisibility(bool isVisible);
190 
191  /// @}
192 
193  // ---------------------------------------------------------------------
194  /// \name Camera State
195  /// @{
196  // ---------------------------------------------------------------------
197 
198  /// Scene camera API
199  /// Set the scene camera path to use for rendering.
201  void SetCameraPath(SdfPath const& id);
202 
203  /// Determines how the filmback of the camera is mapped into
204  /// the pixels of the render buffer and what pixels of the render
205  /// buffer will be rendered into.
207  void SetFraming(CameraUtilFraming const& framing);
208 
209  /// Specifies whether to force a window policy when conforming
210  /// the frustum of the camera to match the display window of
211  /// the camera framing.
212  ///
213  /// If set to {false, ...}, the window policy of the specified camera
214  /// will be used.
215  ///
216  /// Note: std::pair<bool, ...> is used instead of std::optional<...>
217  /// because the latter is only available in C++17 or later.
220  const std::optional<CameraUtilConformWindowPolicy> &policy);
221 
222  /// Set the size of the render buffers baking the AOVs.
223  /// GUI applications should set this to the size of the window.
224  ///
226  void SetRenderBufferSize(GfVec2i const& size);
227 
228  /// Set the viewport to use for rendering as (x,y,w,h), where (x,y)
229  /// represents the lower left corner of the viewport rectangle, and (w,h)
230  /// is the width and height of the viewport in pixels.
231  ///
232  /// \deprecated Use SetFraming and SetRenderBufferSize instead.
234  void SetRenderViewport(GfVec4d const& viewport);
235 
236  /// Set the window policy to use.
237  /// XXX: This is currently used for scene cameras set via SetCameraPath.
238  /// See comment in SetCameraState for the free cam.
241 
242  /// Free camera API
243  /// Set camera framing state directly (without pointing to a camera on the
244  /// USD stage). The projection matrix is expected to be pre-adjusted for the
245  /// window policy.
247  void SetCameraState(const GfMatrix4d& viewMatrix,
248  const GfMatrix4d& projectionMatrix);
249 
250  /// @}
251 
252  // ---------------------------------------------------------------------
253  /// \name Light State
254  /// @{
255  // ---------------------------------------------------------------------
256 
257  /// Copy lighting state from another lighting context.
259  void SetLightingState(GlfSimpleLightingContextPtr const &src);
260 
261  /// Set lighting state
262  /// Derived classes should ensure that passing an empty lights
263  /// vector disables lighting.
264  /// \param lights is the set of lights to use, or empty to disable lighting.
266  void SetLightingState(GlfSimpleLightVector const &lights,
267  GlfSimpleMaterial const &material,
268  GfVec4f const &sceneAmbient);
269 
270  /// @}
271 
272  // ---------------------------------------------------------------------
273  /// \name Selection Highlighting
274  /// @{
275  // ---------------------------------------------------------------------
276 
277  /// Sets (replaces) the list of prim paths that should be included in
278  /// selection highlighting. These paths may include root paths which will
279  /// be expanded internally.
281  void SetSelected(SdfPathVector const& paths);
282 
283  /// Clear the list of prim paths that should be included in selection
284  /// highlighting.
286  void ClearSelected();
287 
288  /// Add a path with instanceIndex to the list of prim paths that should be
289  /// included in selection highlighting. UsdImagingDelegate::ALL_INSTANCES
290  /// can be used for highlighting all instances if path is an instancer.
292  void AddSelected(SdfPath const &path, int instanceIndex);
293 
294  /// Sets the selection highlighting color.
296  void SetSelectionColor(GfVec4f const& color);
297 
298  /// @}
299 
300  // ---------------------------------------------------------------------
301  /// \name Picking
302  /// @{
303  // ---------------------------------------------------------------------
304 
305  /// Finds closest point of intersection with a frustum by rendering.
306  ///
307  /// This method uses a PickRender and a customized depth buffer to find an
308  /// approximate point of intersection by rendering. This is less accurate
309  /// than implicit methods or rendering with GL_SELECT, but leverages any
310  /// data already cached in the renderer.
311  ///
312  /// Returns whether a hit occurred and if so, \p outHitPoint will contain
313  /// the intersection point in world space (i.e. \p projectionMatrix and
314  /// \p viewMatrix factored back out of the result), and \p outHitNormal
315  /// will contain the world space normal at that point.
316  ///
317  /// \p outHitPrimPath will point to the gprim selected by the pick.
318  /// \p outHitInstancerPath will point to the point instancer (if applicable)
319  /// of that gprim. For nested instancing, outHitInstancerPath points to
320  /// the closest instancer.
321  ///
322  /// \deprecated Please use the override of TestIntersection that takes
323  /// PickParams and returns an IntersectionResultVector instead!
325  bool TestIntersection(
326  const GfMatrix4d &viewMatrix,
327  const GfMatrix4d &projectionMatrix,
328  const UsdPrim& root,
330  GfVec3d *outHitPoint,
331  GfVec3d *outHitNormal,
332  SdfPath *outHitPrimPath = NULL,
333  SdfPath *outHitInstancerPath = NULL,
334  int *outHitInstanceIndex = NULL,
335  HdInstancerContext *outInstancerContext = NULL);
336 
337  // Pick result
339  {
346  };
347 
348  typedef std::vector<struct IntersectionResult> IntersectionResultVector;
349 
350  // Pick params
351  struct PickParams
352  {
354  };
355 
356  /// Perform picking by finding the intersection of objects in the scene with a renderered frustum.
357  /// Depending on the resolve mode it may find all objects intersecting the frustum or the closest
358  /// point of intersection within the frustum.
359  ///
360  /// If resolve mode is set to resolveDeep it uses Deep Selection to gather all paths within
361  /// the frustum even if obscured by other visible objects.
362  /// If resolve mode is set to resolveNearestToCenter it uses a PickRender and
363  /// a customized depth buffer to find all approximate points of intersection by rendering.
364  /// This is less accurate than implicit methods or rendering with GL_SELECT, but leverages any
365  /// data already cached in the renderer.
366  ///
367  /// Returns whether a hit occurred and if so, \p outResults will point to all the
368  /// gprims selected by the pick as determined by the resolve mode.
369  /// \p outHitPoint will contain the intersection point in world space
370  /// (i.e. \p projectionMatrix and \p viewMatrix factored back out of the result)
371  /// \p outHitNormal will contain the world space normal at that point.
372  /// \p hitPrimPath will point to the gprim selected by the pick.
373  /// \p hitInstancerPath will point to the point instancer (if applicable) of each gprim.
374  ///
376  bool TestIntersection(
377  const PickParams& pickParams,
378  const GfMatrix4d& viewMatrix,
379  const GfMatrix4d& projectionMatrix,
380  const UsdPrim& root,
382  IntersectionResultVector* outResults);
383 
384  /// Decodes a pick result given hydra prim ID/instance ID (like you'd get
385  /// from an ID render), where ID is represented as a vec4 color.
387  bool DecodeIntersection(
388  unsigned char const primIdColor[4],
389  unsigned char const instanceIdColor[4],
390  SdfPath *outHitPrimPath = NULL,
391  SdfPath *outHitInstancerPath = NULL,
392  int *outHitInstanceIndex = NULL,
393  HdInstancerContext *outInstancerContext = NULL);
394 
395  /// Decodes a pick result given hydra prim ID/instance ID (like you'd get
396  /// from an ID render), where ID is represented as a int.
398  bool DecodeIntersection(
399  int primIdx,
400  int instanceIdx,
401  SdfPath *outHitPrimPath = NULL,
402  SdfPath *outHitInstancerPath = NULL,
403  int *outHitInstanceIndex = NULL,
404  HdInstancerContext *outInstancerContext = NULL);
405 
406  /// @}
407 
408  // ---------------------------------------------------------------------
409  /// \name Renderer Plugin Management
410  /// @{
411  // ---------------------------------------------------------------------
412 
413  /// Return the vector of available render-graph delegate plugins.
416 
417  /// Return the user-friendly name of a renderer plugin.
419  static std::string GetRendererDisplayName(TfToken const &id);
420 
421  /// Return the user-friendly name of the Hgi implementation.
422  /// For example: OpenGL, Metal, Vulkan. This is only available
423  /// if a render plugin was set and it uses Hgi.
425  std::string GetRendererHgiDisplayName() const;
426 
427  /// Return if the GPU is enabled and can be used for any rendering tasks.
429  bool GetGPUEnabled() const;
430 
431  /// Return the id of the currently used renderer plugin.
434 
435  /// Set the current render-graph delegate to \p id.
436  /// the plugin will be loaded if it's not yet.
438  bool SetRendererPlugin(TfToken const &id);
439 
440  /// @}
441 
442  // ---------------------------------------------------------------------
443  /// \name AOVs
444  /// @{
445  // ---------------------------------------------------------------------
446 
447  /// Return the vector of available renderer AOV settings.
450 
451  /// Set the current renderer AOV to \p id.
453  bool SetRendererAov(TfToken const& id);
454 
455  /// Set the current renderer AOVs to a list of \p ids.
457  bool SetRendererAovs(TfTokenVector const &ids);
458 
459  /// Returns an AOV texture handle for the given token.
462 
463  /// Returns the AOV render buffer for the given token.
466 
467  // ---------------------------------------------------------------------
468  /// \name Render Settings (Legacy)
469  /// @{
470  // ---------------------------------------------------------------------
471 
472  /// Returns the list of renderer settings.
475 
476  /// Gets a renderer setting's current value.
478  VtValue GetRendererSetting(TfToken const& id) const;
479 
480  /// Sets a renderer setting's value.
482  void SetRendererSetting(TfToken const& id,
483  VtValue const& value);
484 
485  /// @}
486 
487  // ---------------------------------------------------------------------
488  /// \name Scene-defined Render Pass and Render Settings
489  /// \note Support is WIP.
490  /// @{
491  // ---------------------------------------------------------------------
492 
493  /// Set active render pass prim to use to drive rendering.
495  void SetActiveRenderPassPrimPath(SdfPath const &);
496 
497  /// Set active render settings prim to use to drive rendering.
500 
501  /// Utility method to query available render settings prims.
503  static SdfPathVector
505 
506  /// @}
507 
508  // ---------------------------------------------------------------------
509  /// \name Presentation
510  /// @{
511  // ---------------------------------------------------------------------
512 
513  /// Enable / disable presenting the render to bound framebuffer.
514  /// An application may choose to manage the AOVs that are rendered into
515  /// itself and skip the engine's presentation.
517  void SetEnablePresentation(bool enabled);
518 
519  /// The destination API (e.g., OpenGL, see hgiInterop for details) and
520  /// framebuffer that the AOVs are presented into. The framebuffer
521  /// is a VtValue that encoding a framebuffer in a destination API
522  /// specific way.
523  /// E.g., a uint32_t (aka GLuint) for framebuffer object for OpenGL.
525  void SetPresentationOutput(TfToken const &api, VtValue const &framebuffer);
526 
527  /// @}
528 
529  // ---------------------------------------------------------------------
530  /// \name Renderer Command API
531  /// @{
532  // ---------------------------------------------------------------------
533 
534  /// Return command deescriptors for commands supported by the active
535  /// render delegate.
536  ///
539 
540  /// Invokes command on the active render delegate. If successful, returns
541  /// \c true, returns \c false otherwise. Note that the command will not
542  /// succeeed if it is not among those returned by
543  /// GetRendererCommandDescriptors() for the same active render delegate.
544  ///
547  const TfToken &command,
548  const HdCommandArgs &args = HdCommandArgs()) const;
549 
550  // ---------------------------------------------------------------------
551  /// \name Control of background rendering threads.
552  /// @{
553  // ---------------------------------------------------------------------
554 
555  /// Query the renderer as to whether it supports pausing and resuming.
557  bool IsPauseRendererSupported() const;
558 
559  /// Pause the renderer.
560  ///
561  /// Returns \c true if successful.
563  bool PauseRenderer();
564 
565  /// Resume the renderer.
566  ///
567  /// Returns \c true if successful.
569  bool ResumeRenderer();
570 
571  /// Query the renderer as to whether it supports stopping and restarting.
573  bool IsStopRendererSupported() const;
574 
575  /// Stop the renderer.
576  ///
577  /// Returns \c true if successful.
579  bool StopRenderer();
580 
581  /// Restart the renderer.
582  ///
583  /// Returns \c true if successful.
585  bool RestartRenderer();
586 
587  /// @}
588 
589  // ---------------------------------------------------------------------
590  /// \name Color Correction
591  /// @{
592  // ---------------------------------------------------------------------
593 
594  /// Set \p ccType to one of the HdxColorCorrectionTokens:
595  /// {disabled, sRGB, openColorIO}
596  ///
597  /// If 'openColorIO' is used, \p ocioDisplay, \p ocioView, \p ocioColorSpace
598  /// and \p ocioLook are options the client may supply to configure OCIO.
599  /// \p ocioColorSpace refers to the input (source) color space.
600  /// The default value is substituted if an option isn't specified.
601  /// You can find the values for these strings inside the
602  /// profile/config .ocio file. For example:
603  ///
604  /// displays:
605  /// rec709g22:
606  /// !<View> {name: studio, colorspace: linear, looks: studio_65_lg2}
607  ///
610  TfToken const& ccType,
611  TfToken const& ocioDisplay = {},
612  TfToken const& ocioView = {},
613  TfToken const& ocioColorSpace = {},
614  TfToken const& ocioLook = {});
615 
616  /// @}
617 
618  /// Returns true if the platform is color correction capable.
620  static bool IsColorCorrectionCapable();
621 
622  // ---------------------------------------------------------------------
623  /// \name Render Statistics
624  /// @{
625  // ---------------------------------------------------------------------
626 
627  /// Returns render statistics.
628  ///
629  /// The contents of the dictionary will depend on the current render
630  /// delegate.
631  ///
634 
635  /// @}
636 
637  // ---------------------------------------------------------------------
638  /// \name HGI
639  /// @{
640  // ---------------------------------------------------------------------
641 
642  /// Returns the HGI interface.
643  ///
645  Hgi* GetHgi();
646 
647  /// @}
648 
649  // ---------------------------------------------------------------------
650  /// \name Asynchronous
651  /// @{
652  // ---------------------------------------------------------------------
653 
654  /// If \p allowAsynchronousSceneProcessing is true within the Parameters
655  /// provided to the UsdImagingGLEngine constructor, an application can
656  /// periodically call this from the main thread.
657  ///
658  /// A return value of true indicates that the scene has changed and the
659  /// render should be updated.
661  bool PollForAsynchronousUpdates() const;
662 
663  /// @}
664 
665 protected:
666 
667  /// Open some protected methods for whitebox testing.
669 
670  /// Returns the render index of the engine, if any. This is only used for
671  /// whitebox testing.
674 
675  /// \deprecated.
676  /// Use _Execute(const UsdImaginGLRenderParams &, const SdfPathVector &).
679  const HdTaskSharedPtrVector tasks);
680 
683  const SdfPathVector &taskPaths);
684 
686  bool _CanPrepare(const UsdPrim& root);
691 
694 
697 
700 
703 
704  using BBoxVector = std::vector<GfBBox3d>;
705 
707  void _SetBBoxParams(
708  const BBoxVector& bboxes,
709  const GfVec4f& bboxLineColor,
710  float bboxLineDashSize);
711 
712  // Create a hydra collection given root paths and render params.
713  // Returns true if the collection was updated.
715  static bool _UpdateHydraCollection(HdRprimCollection *collection,
716  SdfPathVector const& roots,
723  TfTokenVector *renderTags);
724 
727 
731 
734 
737 
740 
741  /// Get a direct pointer to the scene delegate.
742  /// \deprecated Existing instances of this call will be replaced with new
743  /// APIs on this class, to support multiplexing between the
744  /// scene delegate and scene index. This API is scheduled for
745  /// deletion.
748 
751 
754 
757 
758 protected:
759 
760  // Note that any of the fields below might become private
761  // in the future and subclasses should use the above getters
762  // to access them instead.
763 
765  // Similar for HdDriver.
767 
769 
770 protected:
774  std::unique_ptr<HdRenderIndex> _renderIndex;
775 
777 
778  std::unique_ptr<HdxTaskController> _taskController;
779  HdxTaskControllerSceneIndexRefPtr _taskControllerSceneIndex;
780 
784 
785  GlfSimpleLightingContextRefPtr _lightingContextForOpenGLState;
786 
787  // Data we want to live across render plugin switches:
790 
795 
796 private:
797  // Registers app-managed scene indices with the scene index plugin registry.
798  // This needs to be called once *before* the render index is constructed.
799  static void _RegisterApplicationSceneIndices();
800 
801  // Creates and returns the scene globals scene index. This callback is
802  // registered prior to render index construction and is invoked during
803  // render index construction via
804  // HdSceneIndexPluginRegistry::AppendSceneIndicesForRenderer(..).
805  static HdSceneIndexBaseRefPtr
806  _AppendSceneGlobalsSceneIndexCallback(
807  const std::string &renderInstanceId,
808  const HdSceneIndexBaseRefPtr &inputScene,
809  const HdContainerDataSourceHandle &inputArgs);
810 
811  HdSceneIndexBaseRefPtr
812  _AppendOverridesSceneIndices(
813  const HdSceneIndexBaseRefPtr &inputScene);
814 
816 
817  void _DestroyHydraObjects();
818 
819  // Note that we'll only ever use one of _sceneIndex/_sceneDelegate
820  // at a time.
821  UsdImagingStageSceneIndexRefPtr _stageSceneIndex;
822  HdNoticeBatchingSceneIndexRefPtr _postInstancingNoticeBatchingSceneIndex;
823  UsdImagingSelectionSceneIndexRefPtr _selectionSceneIndex;
824  UsdImagingRootOverridesSceneIndexRefPtr _rootOverridesSceneIndex;
825  HdsiLegacyDisplayStyleOverrideSceneIndexRefPtr _displayStyleSceneIndex;
826  HdsiPrimTypePruningSceneIndexRefPtr _materialPruningSceneIndex;
827  HdsiPrimTypePruningSceneIndexRefPtr _lightPruningSceneIndex;
828  HdSceneIndexBaseRefPtr _sceneIndex;
829 
830  std::unique_ptr<UsdImagingDelegate> _sceneDelegate;
831 
832  std::unique_ptr<HdEngine> _engine;
833 
834  bool _allowAsynchronousSceneProcessing = false;
835 };
836 
837 
839 
840 #endif // PXR_USD_IMAGING_USD_IMAGING_GL_ENGINE_H
USDIMAGINGGL_API void SetRenderViewport(GfVec4d const &viewport)
USDIMAGINGGL_API bool GetGPUEnabled() const
Return if the GPU is enabled and can be used for any rendering tasks.
USDIMAGINGGL_API SdfPath _ComputeControllerPath(const HdPluginRenderDelegateUniqueHandle &)
USDIMAGINGGL_API TfToken GetCurrentRendererId() const
Return the id of the currently used renderer plugin.
static SDF_API const SdfPath & AbsoluteRootPath()
GlfSimpleLightingContextRefPtr _lightingContextForOpenGLState
Definition: engine.h:785
HdRprimCollection _intersectCollection
Definition: engine.h:783
hboost::math::policies::policy< hboost::math::policies::domain_error< hboost::math::policies::ignore_error >, hboost::math::policies::pole_error< hboost::math::policies::ignore_error >, hboost::math::policies::overflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::underflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::denorm_error< hboost::math::policies::ignore_error >, hboost::math::policies::rounding_error< hboost::math::policies::ignore_error >, hboost::math::policies::evaluation_error< hboost::math::policies::ignore_error >, hboost::math::policies::indeterminate_result_error< hboost::math::policies::ignore_error > > policy
Definition: SYS_MathCbrt.h:35
USDIMAGINGGL_API void SetSelectionColor(GfVec4f const &color)
Sets the selection highlighting color.
Definition: vec2i.h:43
USDIMAGINGGL_API HdSelectionSharedPtr _GetSelection() const
USDIMAGINGGL_API void SetOverrideWindowPolicy(const std::optional< CameraUtilConformWindowPolicy > &policy)
TF_DECLARE_REF_PTRS(HdNoticeBatchingSceneIndex)
TF_DECLARE_WEAK_AND_REF_PTRS(GlfSimpleLightingContext)
USDIMAGINGGL_API bool _CanPrepare(const UsdPrim &root)
GT_API const UT_StringHolder time
SdfPath const _sceneDelegateId
Definition: engine.h:776
HdPluginRenderDelegateUniqueHandle _renderDelegate
Definition: engine.h:773
static USDIMAGINGGL_API HdxRenderTaskParams _MakeHydraUsdImagingGLRenderParams(UsdImagingGLRenderParams const &params)
GLsizei const GLfloat * value
Definition: glcorearb.h:824
USDIMAGINGGL_API bool TestIntersection(const GfMatrix4d &viewMatrix, const GfMatrix4d &projectionMatrix, const UsdPrim &root, const UsdImagingGLRenderParams &params, GfVec3d *outHitPoint, GfVec3d *outHitNormal, SdfPath *outHitPrimPath=NULL, SdfPath *outHitInstancerPath=NULL, int *outHitInstanceIndex=NULL, HdInstancerContext *outInstancerContext=NULL)
USDIMAGINGGL_API void SetCameraPath(SdfPath const &id)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
static USDIMAGINGGL_API bool _UpdateHydraCollection(HdRprimCollection *collection, SdfPathVector const &roots, UsdImagingGLRenderParams const &params)
SdfPathVector invisedPaths
Definition: engine.h:89
USDIMAGINGGL_API Hgi * GetHgi()
SdfPathVector excludedPaths
Definition: engine.h:88
USDIMAGINGGL_API void _InitializeHgiIfNecessary()
USDIMAGINGGL_API bool PauseRenderer()
USDIMAGINGGL_API void SetActiveRenderSettingsPrimPath(SdfPath const &)
Set active render settings prim to use to drive rendering.
UsdImagingGLEngine & operator=(const UsdImagingGLEngine &)=delete
Definition: vec4d.h:45
int HgiHandle< class HgiTexture > HgiTextureHandle
bool _domeLightCameraVisibility
Definition: engine.h:789
static USDIMAGINGGL_API bool IsColorCorrectionCapable()
Returns true if the platform is color correction capable.
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glcorearb.h:2539
std::vector< HdTaskSharedPtr > HdTaskSharedPtrVector
Definition: renderIndex.h:58
USDIMAGINGGL_API bool SetRendererAovs(TfTokenVector const &ids)
Set the current renderer AOVs to a list of ids.
bool _displayUnloadedPrimsWithBounds
Definition: engine.h:771
GLenum const GLfloat * params
Definition: glcorearb.h:105
UsdStagePtr UsdStageWeakPtr
Definition: common.h:38
USDIMAGINGGL_API bool IsPauseRendererSupported() const
Query the renderer as to whether it supports pausing and resuming.
USDIMAGINGGL_API void _PreSetTime(const UsdImagingGLRenderParams &params)
USDIMAGINGGL_API bool PollForAsynchronousUpdates() const
USDIMAGINGGL_API UsdImagingDelegate * _GetSceneDelegate() const
std::shared_ptr< class HdxSelectionTracker > HdxSelectionTrackerSharedPtr
std::vector< std::pair< SdfPath, int > > HdInstancerContext
Instancer context: a pair of instancer paths and instance indices.
Definition: sceneDelegate.h:44
USDIMAGINGGL_API void SetCameraState(const GfMatrix4d &viewMatrix, const GfMatrix4d &projectionMatrix)
USDIMAGINGGL_API bool SetRendererPlugin(TfToken const &id)
USDIMAGINGGL_API void SetFraming(CameraUtilFraming const &framing)
Parameters to construct UsdImagingGLEngine.
Definition: engine.h:85
USDIMAGINGGL_API void SetRenderBufferSize(GfVec2i const &size)
friend class UsdImagingGL_UnitTestGLDrawing
Open some protected methods for whitebox testing.
Definition: engine.h:668
Definition: token.h:70
VtValue _userFramebuffer
Definition: engine.h:768
GLuint framebuffer
Definition: glcorearb.h:1287
#define USDIMAGINGGL_API
Definition: api.h:23
static USDIMAGINGGL_API void _ComputeRenderTags(UsdImagingGLRenderParams const &params, TfTokenVector *renderTags)
USDIMAGINGGL_API void _PostSetTime(const UsdImagingGLRenderParams &params)
USDIMAGINGGL_API void AddSelected(SdfPath const &path, int instanceIndex)
GfVec4f _selectionColor
Definition: engine.h:788
HdRprimCollection _renderCollection
Definition: engine.h:782
USDIMAGINGGL_API void _SetBBoxParams(const BBoxVector &bboxes, const GfVec4f &bboxLineColor, float bboxLineDashSize)
USDIMAGINGGL_API HgiTextureHandle GetAovTexture(TfToken const &name) const
Returns an AOV texture handle for the given token.
std::vector< class SdfPath > SdfPathVector
std::vector< struct IntersectionResult > IntersectionResultVector
Definition: engine.h:348
std::vector< HdCommandDescriptor > HdCommandDescriptors
Definition: command.h:91
USDIMAGINGGL_API void SetSelected(SdfPathVector const &paths)
USDIMAGINGGL_API HdRenderIndex * _GetRenderIndex() const
static USDIMAGINGGL_API TfTokenVector GetRendererPlugins()
Return the vector of available render-graph delegate plugins.
USDIMAGINGGL_API void SetRootTransform(GfMatrix4d const &xf)
Sets the root transform.
USDIMAGINGGL_API void SetWindowPolicy(CameraUtilConformWindowPolicy policy)
USDIMAGINGGL_API ~UsdImagingGLEngine()
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
USDIMAGINGGL_API bool SetRendererAov(TfToken const &id)
Set the current renderer AOV to id.
USDIMAGINGGL_API bool InvokeRendererCommand(const TfToken &command, const HdCommandArgs &args=HdCommandArgs()) const
GLuint const GLchar * name
Definition: glcorearb.h:786
Definition: path.h:273
USDIMAGINGGL_API void _SetSceneGlobalsCurrentFrame(UsdTimeCode const &time)
HdxSelectionTrackerSharedPtr _selTracker
Definition: engine.h:781
HdxTaskControllerSceneIndexRefPtr _taskControllerSceneIndex
Definition: engine.h:779
USDIMAGINGGL_API UsdImagingGLRendererSettingsList GetRendererSettingsList() const
Returns the list of renderer settings.
std::unique_ptr< HdRenderIndex > _renderIndex
Definition: engine.h:774
USDIMAGINGGL_API bool IsConverged() const
USDIMAGINGGL_API void SetRendererSetting(TfToken const &id, VtValue const &value)
Sets a renderer setting's value.
Definition: vec4f.h:45
CameraUtilConformWindowPolicy
Definition: conformWindow.h:27
USDIMAGINGGL_API void Render(const UsdPrim &root, const UsdImagingGLRenderParams &params)
Entry point for kicking off a render.
SdfPathVector _invisedPrimPaths
Definition: engine.h:793
Definition: hgi.h:93
GLsizeiptr size
Definition: glcorearb.h:664
USDIMAGINGGL_API void _SetActiveRenderSettingsPrimFromStageMetadata(UsdStageWeakPtr stage)
std::unique_ptr< HdxTaskController > _taskController
Definition: engine.h:778
USDIMAGINGGL_API void PrepareBatch(const UsdPrim &root, const UsdImagingGLRenderParams &params)
Support for batched drawing.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
USDIMAGINGGL_API void _PrepareRender(const UsdImagingGLRenderParams &params)
GLuint color
Definition: glcorearb.h:1261
VtDictionary HdCommandArgs
Definition: command.h:54
USDIMAGINGGL_API bool StopRenderer()
USDIMAGINGGL_API void _SetRenderDelegateAndRestoreState(HdPluginRenderDelegateUniqueHandle &&)
USDIMAGINGGL_API bool RestartRenderer()
USDIMAGINGGL_API HdRenderBuffer * GetAovRenderBuffer(TfToken const &name) const
Returns the AOV render buffer for the given token.
USDIMAGINGGL_API void ClearSelected()
HgiUniquePtr _hgi
Definition: engine.h:764
std::vector< GfBBox3d > BBoxVector
Definition: engine.h:704
USDIMAGINGGL_API bool IsStopRendererSupported() const
Query the renderer as to whether it supports stopping and restarting.
std::vector< UsdImagingGLRendererSetting > UsdImagingGLRendererSettingsList
USDIMAGINGGL_API void SetLightingState(GlfSimpleLightingContextPtr const &src)
Copy lighting state from another lighting context.
HdDriver _hgiDriver
Definition: engine.h:766
Definition: vec3d.h:45
USDIMAGINGGL_API void RenderBatch(const SdfPathVector &paths, const UsdImagingGLRenderParams &params)
Support for batched drawing.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
USDIMAGINGGL_API UsdImagingGLEngine(const Parameters &params)
USDIMAGINGGL_API TfTokenVector GetRendererAovs() const
Return the vector of available renderer AOV settings.
USDIMAGINGGL_API void SetColorCorrectionSettings(TfToken const &ccType, TfToken const &ocioDisplay={}, TfToken const &ocioView={}, TfToken const &ocioColorSpace={}, TfToken const &ocioLook={})
**If you just want to fire and args
Definition: thread.h:618
USDIMAGINGGL_API VtValue GetRendererSetting(TfToken const &id) const
Gets a renderer setting's current value.
USDIMAGINGGL_API bool ResumeRenderer()
SdfPathVector _excludedPrimPaths
Definition: engine.h:792
USDIMAGINGGL_API void _Execute(const UsdImagingGLRenderParams &params, const HdTaskSharedPtrVector tasks)
static USDIMAGINGGL_API std::string GetRendererDisplayName(TfToken const &id)
Return the user-friendly name of a renderer plugin.
std::shared_ptr< struct _AppSceneIndices > _AppSceneIndicesSharedPtr
Definition: engine.h:74
USDIMAGINGGL_API HdEngine * _GetHdEngine()
USDIMAGINGGL_API void _UpdateDomeLightCameraVisibility()
USDIMAGINGGL_API void SetActiveRenderPassPrimPath(SdfPath const &)
Set active render pass prim to use to drive rendering.
USDIMAGINGGL_API VtDictionary GetRenderStats() const
USDIMAGINGGL_API void _SetRenderDelegate(HdPluginRenderDelegateUniqueHandle &&)
USDIMAGINGGL_API HdCommandDescriptors GetRendererCommandDescriptors() const
std::shared_ptr< class HdSelection > HdSelectionSharedPtr
Definition: selection.h:23
HdInstancerContext instancerContext
Definition: engine.h:345
GLuint * ids
Definition: glcorearb.h:652
USDIMAGINGGL_API bool DecodeIntersection(unsigned char const primIdColor[4], unsigned char const instanceIdColor[4], SdfPath *outHitPrimPath=NULL, SdfPath *outHitInstancerPath=NULL, int *outHitInstanceIndex=NULL, HdInstancerContext *outInstancerContext=NULL)
Definition: value.h:146
static USDIMAGINGGL_API TfToken _GetDefaultRendererPluginId()
USDIMAGINGGL_API void SetRootVisibility(bool isVisible)
Sets the root visibility.
std::vector< class GlfSimpleLight > GlfSimpleLightVector
Definition: simpleLight.h:254
USDIMAGINGGL_API HdxTaskController * _GetTaskController() const
USDIMAGINGGL_API void SetEnablePresentation(bool enabled)
SdfPath _rootPath
Definition: engine.h:791
USDIMAGINGGL_API void SetPresentationOutput(TfToken const &api, VtValue const &framebuffer)
std::unique_ptr< class Hgi > HgiUniquePtr
Definition: hgi.h:37
static USDIMAGINGGL_API SdfPathVector GetAvailableRenderSettingsPrimPaths(UsdPrim const &root)
Utility method to query available render settings prims.
GLenum src
Definition: glcorearb.h:1793
USDIMAGINGGL_API std::string GetRendererHgiDisplayName() const