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 Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 
25 /// \file usdImagingGL/engine.h
26 
27 #ifndef PXR_USD_IMAGING_USD_IMAGING_GL_ENGINE_H
28 #define PXR_USD_IMAGING_USD_IMAGING_GL_ENGINE_H
29 
30 #include "pxr/pxr.h"
34 
37 
39 
40 #include "pxr/imaging/hd/driver.h"
41 #include "pxr/imaging/hd/engine.h"
44 
47 
48 #include "pxr/imaging/hgi/hgi.h"
49 
52 
53 #include "pxr/imaging/hgi/hgi.h"
54 
55 #include "pxr/usd/sdf/path.h"
56 #include "pxr/usd/usd/timeCode.h"
57 
58 #include "pxr/base/gf/frustum.h"
59 #include "pxr/base/gf/matrix4d.h"
60 #include "pxr/base/gf/vec4d.h"
61 #include "pxr/base/gf/vec4f.h"
62 #include "pxr/base/gf/vec4i.h"
63 
64 #include "pxr/base/vt/dictionary.h"
65 
67 
69 
70 class UsdPrim;
71 class HdRenderIndex;
72 class HdxTaskController;
73 class UsdImagingDelegate;
74 
83 
85 
86 namespace UsdImagingGLEngine_Impl
87 {
88  using _AppSceneIndicesSharedPtr = std::shared_ptr<struct _AppSceneIndices>;
89 }
90 
91 /// \class UsdImagingGLEngine
92 ///
93 /// The UsdImagingGLEngine is the main entry point API for rendering USD scenes.
94 ///
96 {
97 public:
98  /// Parameters to construct UsdImagingGLEngine.
99  struct Parameters
100  {
105  /// An HdDriver, containing the Hgi of your choice, can be optionally passed
106  /// in during construction. This can be helpful if your application creates
107  /// multiple UsdImagingGLEngine's that wish to use the same HdDriver / Hgi.
109  /// The \p rendererPluginId argument indicates the renderer plugin that
110  /// Hydra should use. If the empty token is passed in, a default renderer
111  /// plugin will be chosen depending on the value of \p gpuEnabled.
113  /// The \p gpuEnabled argument determines if this instance will allow Hydra
114  /// to use the GPU to produce images.
115  bool gpuEnabled = true;
116  /// \p displayUnloadedPrimsWithBounds draws bounding boxes for unloaded
117  /// prims if they have extents/extentsHint authored.
119  };
120 
121  // ---------------------------------------------------------------------
122  /// \name Construction
123  /// @{
124  // ---------------------------------------------------------------------
125 
128 
129  /// An HdDriver, containing the Hgi of your choice, can be optionally passed
130  /// in during construction. This can be helpful if you application creates
131  /// multiple UsdImagingGLEngine that wish to use the same HdDriver / Hgi.
132  /// The \p rendererPluginId argument indicates the renderer plugin that
133  /// Hyrda should use. If the empty token is passed in, a default renderer
134  /// plugin will be chosen depending on the value of \p gpuEnabled.
135  /// The \p gpuEnabled argument determines if this instance will allow Hydra
136  /// to use the GPU to produce images.
138  UsdImagingGLEngine(const HdDriver& driver = HdDriver(),
139  const TfToken& rendererPluginId = TfToken(),
140  bool gpuEnabled = true);
141 
143  UsdImagingGLEngine(const SdfPath& rootPath,
144  const SdfPathVector& excludedPaths,
145  const SdfPathVector& invisedPaths = SdfPathVector(),
146  const SdfPath& sceneDelegateID =
148  const HdDriver& driver = HdDriver(),
149  const TfToken& rendererPluginId = TfToken(),
150  bool gpuEnabled = true,
151  bool displayUnloadedPrimsWithBounds = false);
152 
153  // Disallow copies
154  UsdImagingGLEngine(const UsdImagingGLEngine&) = delete;
156 
159 
160  /// @}
161 
162  // ---------------------------------------------------------------------
163  /// \name Rendering
164  /// @{
165  // ---------------------------------------------------------------------
166 
167  /// Support for batched drawing
169  void PrepareBatch(const UsdPrim& root,
172  void RenderBatch(const SdfPathVector& paths,
174 
175  /// Entry point for kicking off a render
177  void Render(const UsdPrim& root,
179 
180  /// Returns true if the resulting image is fully converged.
181  /// (otherwise, caller may need to call Render() again to refine the result)
183  bool IsConverged() const;
184 
185  /// @}
186 
187  // ---------------------------------------------------------------------
188  /// \name Root Transform and Visibility
189  /// @{
190  // ---------------------------------------------------------------------
191 
192  /// Sets the root transform.
194  void SetRootTransform(GfMatrix4d const& xf);
195 
196  /// Sets the root visibility.
198  void SetRootVisibility(bool isVisible);
199 
200  /// @}
201 
202  // ---------------------------------------------------------------------
203  /// \name Camera State
204  /// @{
205  // ---------------------------------------------------------------------
206 
207  /// Scene camera API
208  /// Set the scene camera path to use for rendering.
210  void SetCameraPath(SdfPath const& id);
211 
212  /// Determines how the filmback of the camera is mapped into
213  /// the pixels of the render buffer and what pixels of the render
214  /// buffer will be rendered into.
216  void SetFraming(CameraUtilFraming const& framing);
217 
218  /// Specifies whether to force a window policy when conforming
219  /// the frustum of the camera to match the display window of
220  /// the camera framing.
221  ///
222  /// If set to {false, ...}, the window policy of the specified camera
223  /// will be used.
224  ///
225  /// Note: std::pair<bool, ...> is used instead of std::optional<...>
226  /// because the latter is only available in C++17 or later.
229  const std::pair<bool, CameraUtilConformWindowPolicy> &policy);
230 
231  /// Set the size of the render buffers baking the AOVs.
232  /// GUI applications should set this to the size of the window.
233  ///
235  void SetRenderBufferSize(GfVec2i const& size);
236 
237  /// Set the viewport to use for rendering as (x,y,w,h), where (x,y)
238  /// represents the lower left corner of the viewport rectangle, and (w,h)
239  /// is the width and height of the viewport in pixels.
240  ///
241  /// \deprecated Use SetFraming and SetRenderBufferSize instead.
243  void SetRenderViewport(GfVec4d const& viewport);
244 
245  /// Set the window policy to use.
246  /// XXX: This is currently used for scene cameras set via SetCameraPath.
247  /// See comment in SetCameraState for the free cam.
250 
251  /// Free camera API
252  /// Set camera framing state directly (without pointing to a camera on the
253  /// USD stage). The projection matrix is expected to be pre-adjusted for the
254  /// window policy.
256  void SetCameraState(const GfMatrix4d& viewMatrix,
257  const GfMatrix4d& projectionMatrix);
258 
259  /// @}
260 
261  // ---------------------------------------------------------------------
262  /// \name Light State
263  /// @{
264  // ---------------------------------------------------------------------
265 
266  /// Copy lighting state from another lighting context.
268  void SetLightingState(GlfSimpleLightingContextPtr const &src);
269 
270  /// Set lighting state
271  /// Derived classes should ensure that passing an empty lights
272  /// vector disables lighting.
273  /// \param lights is the set of lights to use, or empty to disable lighting.
275  void SetLightingState(GlfSimpleLightVector const &lights,
276  GlfSimpleMaterial const &material,
277  GfVec4f const &sceneAmbient);
278 
279  /// @}
280 
281  // ---------------------------------------------------------------------
282  /// \name Selection Highlighting
283  /// @{
284  // ---------------------------------------------------------------------
285 
286  /// Sets (replaces) the list of prim paths that should be included in
287  /// selection highlighting. These paths may include root paths which will
288  /// be expanded internally.
290  void SetSelected(SdfPathVector const& paths);
291 
292  /// Clear the list of prim paths that should be included in selection
293  /// highlighting.
295  void ClearSelected();
296 
297  /// Add a path with instanceIndex to the list of prim paths that should be
298  /// included in selection highlighting. UsdImagingDelegate::ALL_INSTANCES
299  /// can be used for highlighting all instances if path is an instancer.
301  void AddSelected(SdfPath const &path, int instanceIndex);
302 
303  /// Sets the selection highlighting color.
305  void SetSelectionColor(GfVec4f const& color);
306 
307  /// @}
308 
309  // ---------------------------------------------------------------------
310  /// \name Picking
311  /// @{
312  // ---------------------------------------------------------------------
313 
314  /// Finds closest point of intersection with a frustum by rendering.
315  ///
316  /// This method uses a PickRender and a customized depth buffer to find an
317  /// approximate point of intersection by rendering. This is less accurate
318  /// than implicit methods or rendering with GL_SELECT, but leverages any
319  /// data already cached in the renderer.
320  ///
321  /// Returns whether a hit occurred and if so, \p outHitPoint will contain
322  /// the intersection point in world space (i.e. \p projectionMatrix and
323  /// \p viewMatrix factored back out of the result), and \p outHitNormal
324  /// will contain the world space normal at that point.
325  ///
326  /// \p outHitPrimPath will point to the gprim selected by the pick.
327  /// \p outHitInstancerPath will point to the point instancer (if applicable)
328  /// of that gprim. For nested instancing, outHitInstancerPath points to
329  /// the closest instancer.
330  ///
332  bool TestIntersection(
333  const GfMatrix4d &viewMatrix,
334  const GfMatrix4d &projectionMatrix,
335  const UsdPrim& root,
337  GfVec3d *outHitPoint,
338  GfVec3d *outHitNormal,
339  SdfPath *outHitPrimPath = NULL,
340  SdfPath *outHitInstancerPath = NULL,
341  int *outHitInstanceIndex = NULL,
342  HdInstancerContext *outInstancerContext = NULL);
343 
344  /// Decodes a pick result given hydra prim ID/instance ID (like you'd get
345  /// from an ID render).
347  bool DecodeIntersection(
348  unsigned char const primIdColor[4],
349  unsigned char const instanceIdColor[4],
350  SdfPath *outHitPrimPath = NULL,
351  SdfPath *outHitInstancerPath = NULL,
352  int *outHitInstanceIndex = NULL,
353  HdInstancerContext *outInstancerContext = NULL);
354 
355  /// @}
356 
357  // ---------------------------------------------------------------------
358  /// \name Renderer Plugin Management
359  /// @{
360  // ---------------------------------------------------------------------
361 
362  /// Return the vector of available render-graph delegate plugins.
365 
366  /// Return the user-friendly description of a renderer plugin.
368  static std::string GetRendererDisplayName(TfToken const &id);
369 
370  /// Return if the GPU is enabled and can be used for any rendering tasks.
372  bool GetGPUEnabled() const;
373 
374  /// Return the id of the currently used renderer plugin.
377 
378  /// Set the current render-graph delegate to \p id.
379  /// the plugin will be loaded if it's not yet.
381  bool SetRendererPlugin(TfToken const &id);
382 
383  /// @}
384 
385  // ---------------------------------------------------------------------
386  /// \name AOVs
387  /// @{
388  // ---------------------------------------------------------------------
389 
390  /// Return the vector of available renderer AOV settings.
393 
394  /// Set the current renderer AOV to \p id.
396  bool SetRendererAov(TfToken const& id);
397 
398  /// Returns an AOV texture handle for the given token.
401 
402  /// Returns the AOV render buffer for the given token.
405 
406  // ---------------------------------------------------------------------
407  /// \name Render Settings (Legacy)
408  /// @{
409  // ---------------------------------------------------------------------
410 
411  /// Returns the list of renderer settings.
414 
415  /// Gets a renderer setting's current value.
417  VtValue GetRendererSetting(TfToken const& id) const;
418 
419  /// Sets a renderer setting's value.
421  void SetRendererSetting(TfToken const& id,
422  VtValue const& value);
423 
424  /// @}
425 
426  // ---------------------------------------------------------------------
427  /// \name Render Settings (Scene description driven)
428  /// \note Support is WIP.
429  /// @{
430  // ---------------------------------------------------------------------
431 
432  /// Set active render settings prim to use to drive rendering.
435 
436  /// Utility method to query available render settings prims.
438  static SdfPathVector
440 
441  /// @}
442 
443  // ---------------------------------------------------------------------
444  /// \name Presentation
445  /// @{
446  // ---------------------------------------------------------------------
447 
448  /// Enable / disable presenting the render to bound framebuffer.
449  /// An application may choose to manage the AOVs that are rendered into
450  /// itself and skip the engine's presentation.
452  void SetEnablePresentation(bool enabled);
453 
454  /// The destination API (e.g., OpenGL, see hgiInterop for details) and
455  /// framebuffer that the AOVs are presented into. The framebuffer
456  /// is a VtValue that encoding a framebuffer in a destination API
457  /// specific way.
458  /// E.g., a uint32_t (aka GLuint) for framebuffer object for OpenGL.
460  void SetPresentationOutput(TfToken const &api, VtValue const &framebuffer);
461 
462  /// @}
463 
464  // ---------------------------------------------------------------------
465  /// \name Renderer Command API
466  /// @{
467  // ---------------------------------------------------------------------
468 
469  /// Return command deescriptors for commands supported by the active
470  /// render delegate.
471  ///
474 
475  /// Invokes command on the active render delegate. If successful, returns
476  /// \c true, returns \c false otherwise. Note that the command will not
477  /// succeeed if it is not among those returned by
478  /// GetRendererCommandDescriptors() for the same active render delegate.
479  ///
482  const TfToken &command,
483  const HdCommandArgs &args = HdCommandArgs()) const;
484 
485  // ---------------------------------------------------------------------
486  /// \name Control of background rendering threads.
487  /// @{
488  // ---------------------------------------------------------------------
489 
490  /// Query the renderer as to whether it supports pausing and resuming.
492  bool IsPauseRendererSupported() const;
493 
494  /// Pause the renderer.
495  ///
496  /// Returns \c true if successful.
498  bool PauseRenderer();
499 
500  /// Resume the renderer.
501  ///
502  /// Returns \c true if successful.
504  bool ResumeRenderer();
505 
506  /// Query the renderer as to whether it supports stopping and restarting.
508  bool IsStopRendererSupported() const;
509 
510  /// Stop the renderer.
511  ///
512  /// Returns \c true if successful.
514  bool StopRenderer();
515 
516  /// Restart the renderer.
517  ///
518  /// Returns \c true if successful.
520  bool RestartRenderer();
521 
522  /// @}
523 
524  // ---------------------------------------------------------------------
525  /// \name Color Correction
526  /// @{
527  // ---------------------------------------------------------------------
528 
529  /// Set \p ccType to one of the HdxColorCorrectionTokens:
530  /// {disabled, sRGB, openColorIO}
531  ///
532  /// If 'openColorIO' is used, \p ocioDisplay, \p ocioView, \p ocioColorSpace
533  /// and \p ocioLook are options the client may supply to configure OCIO.
534  /// \p ocioColorSpace refers to the input (source) color space.
535  /// The default value is substituted if an option isn't specified.
536  /// You can find the values for these strings inside the
537  /// profile/config .ocio file. For example:
538  ///
539  /// displays:
540  /// rec709g22:
541  /// !<View> {name: studio, colorspace: linear, looks: studio_65_lg2}
542  ///
545  TfToken const& ccType,
546  TfToken const& ocioDisplay = {},
547  TfToken const& ocioView = {},
548  TfToken const& ocioColorSpace = {},
549  TfToken const& ocioLook = {});
550 
551  /// @}
552 
553  /// Returns true if the platform is color correction capable.
555  static bool IsColorCorrectionCapable();
556 
557  // ---------------------------------------------------------------------
558  /// \name Render Statistics
559  /// @{
560  // ---------------------------------------------------------------------
561 
562  /// Returns render statistics.
563  ///
564  /// The contents of the dictionary will depend on the current render
565  /// delegate.
566  ///
569 
570  /// @}
571 
572  // ---------------------------------------------------------------------
573  /// \name HGI
574  /// @{
575  // ---------------------------------------------------------------------
576 
577  /// Returns the HGI interface.
578  ///
580  Hgi* GetHgi();
581 
582  /// @}
583 
584 protected:
585 
586  /// Open some protected methods for whitebox testing.
588 
589  /// Returns the render index of the engine, if any. This is only used for
590  /// whitebox testing.
593 
596  HdTaskSharedPtrVector tasks);
597 
599  bool _CanPrepare(const UsdPrim& root);
604 
607 
610 
613 
614  using BBoxVector = std::vector<GfBBox3d>;
615 
617  void _SetBBoxParams(
618  const BBoxVector& bboxes,
619  const GfVec4f& bboxLineColor,
620  float bboxLineDashSize);
621 
622  // Create a hydra collection given root paths and render params.
623  // Returns true if the collection was updated.
625  static bool _UpdateHydraCollection(HdRprimCollection *collection,
626  SdfPathVector const& roots,
633  TfTokenVector *renderTags);
634 
637 
641 
644 
647 
650 
651  /// Get a direct pointer to the scene delegate.
652  /// \deprecated Existing instances of this call will be replaced with new
653  /// APIs on this class, to support multiplexing between the
654  /// scene delegate and scene index. This API is scheduled for
655  /// deletion.
658 
661 
664 
667 
668 protected:
669 
670  // Note that any of the fields below might become private
671  // in the future and subclasses should use the above getters
672  // to access them instead.
673 
675  // Similar for HdDriver.
677 
679 
680 protected:
684  std::unique_ptr<HdRenderIndex> _renderIndex;
685 
687 
688  std::unique_ptr<HdxTaskController> _taskController;
689 
693 
694  GlfSimpleLightingContextRefPtr _lightingContextForOpenGLState;
695 
696  // Data we want to live across render plugin switches:
699 
704 
705 private:
706  // Registers app-managed scene indices with the scene index plugin registry.
707  // This needs to be called once *before* the render index is constructed.
708  static void _RegisterApplicationSceneIndices();
709 
710  // Creates and returns the scene globals scene index. This callback is
711  // registered prior to render index construction and is invoked during
712  // render index construction via
713  // HdSceneIndexPluginRegistry::AppendSceneIndicesForRenderer(..).
714  static HdSceneIndexBaseRefPtr
715  _AppendSceneGlobalsSceneIndexCallback(
716  const std::string &renderInstanceId,
717  const HdSceneIndexBaseRefPtr &inputScene,
718  const HdContainerDataSourceHandle &inputArgs);
719 
721 
722  void _DestroyHydraObjects();
723 
724  // Note that we'll only ever use one of _sceneIndex/_sceneDelegate
725  // at a time.
726  UsdImagingStageSceneIndexRefPtr _stageSceneIndex;
727  UsdImagingSelectionSceneIndexRefPtr _selectionSceneIndex;
728  UsdImagingRootOverridesSceneIndexRefPtr _rootOverridesSceneIndex;
729  HdsiLegacyDisplayStyleOverrideSceneIndexRefPtr _displayStyleSceneIndex;
730  HdsiPrimTypePruningSceneIndexRefPtr _materialPruningSceneIndex;
731  HdsiPrimTypePruningSceneIndexRefPtr _lightPruningSceneIndex;
732  HdSceneIndexBaseRefPtr _sceneIndex;
733 
734  std::unique_ptr<UsdImagingDelegate> _sceneDelegate;
735 
736  std::unique_ptr<HdEngine> _engine;
737 };
738 
739 
741 
742 #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:694
USDIMAGINGGL_API void _Execute(const UsdImagingGLRenderParams &params, HdTaskSharedPtrVector tasks)
HdRprimCollection _intersectCollection
Definition: engine.h:692
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:60
USDIMAGINGGL_API HdSelectionSharedPtr _GetSelection() const
TF_DECLARE_WEAK_AND_REF_PTRS(GlfSimpleLightingContext)
USDIMAGINGGL_API bool _CanPrepare(const UsdPrim &root)
SdfPath const _sceneDelegateId
Definition: engine.h:686
HdPluginRenderDelegateUniqueHandle _renderDelegate
Definition: engine.h:683
static USDIMAGINGGL_API HdxRenderTaskParams _MakeHydraUsdImagingGLRenderParams(UsdImagingGLRenderParams const &params)
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
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:103
USDIMAGINGGL_API Hgi * GetHgi()
SdfPathVector excludedPaths
Definition: engine.h:102
USDIMAGINGGL_API void _InitializeHgiIfNecessary()
USDIMAGINGGL_API bool PauseRenderer()
USDIMAGINGGL_API void SetOverrideWindowPolicy(const std::pair< bool, CameraUtilConformWindowPolicy > &policy)
USDIMAGINGGL_API void SetActiveRenderSettingsPrimPath(SdfPath const &)
Set active render settings prim to use to drive rendering.
UsdImagingGLEngine & operator=(const UsdImagingGLEngine &)=delete
Definition: vec4d.h:62
int HgiHandle< class HgiTexture > HgiTextureHandle
bool _domeLightCameraVisibility
Definition: engine.h:698
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:74
bool _displayUnloadedPrimsWithBounds
Definition: engine.h:681
GLenum const GLfloat * params
Definition: glcorearb.h:105
UsdStagePtr UsdStageWeakPtr
Definition: common.h:55
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 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:61
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:99
USDIMAGINGGL_API void SetRenderBufferSize(GfVec2i const &size)
friend class UsdImagingGL_UnitTestGLDrawing
Open some protected methods for whitebox testing.
Definition: engine.h:587
Definition: token.h:87
VtValue _userFramebuffer
Definition: engine.h:678
GLuint framebuffer
Definition: glcorearb.h:1287
#define USDIMAGINGGL_API
Definition: api.h:40
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)
TF_DECLARE_REF_PTRS(UsdImagingStageSceneIndex)
GfVec4f _selectionColor
Definition: engine.h:697
HdRprimCollection _renderCollection
Definition: engine.h:691
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< HdCommandDescriptor > HdCommandDescriptors
Definition: command.h:108
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:135
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
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:291
std::vector< class SdfPath > SdfPathVector
A vector of SdfPaths.
Definition: path.h:212
HdxSelectionTrackerSharedPtr _selTracker
Definition: engine.h:690
USDIMAGINGGL_API UsdImagingGLRendererSettingsList GetRendererSettingsList() const
Returns the list of renderer settings.
std::unique_ptr< HdRenderIndex > _renderIndex
Definition: engine.h:684
USDIMAGINGGL_API bool IsConverged() const
USDIMAGINGGL_API void SetRendererSetting(TfToken const &id, VtValue const &value)
Sets a renderer setting's value.
Definition: vec4f.h:62
CameraUtilConformWindowPolicy
Definition: conformWindow.h:44
USDIMAGINGGL_API void Render(const UsdPrim &root, const UsdImagingGLRenderParams &params)
Entry point for kicking off a render.
SdfPathVector _invisedPrimPaths
Definition: engine.h:702
Definition: hgi.h:110
GLsizeiptr size
Definition: glcorearb.h:664
USDIMAGINGGL_API void _SetActiveRenderSettingsPrimFromStageMetadata(UsdStageWeakPtr stage)
std::unique_ptr< HdxTaskController > _taskController
Definition: engine.h:688
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:1441
USDIMAGINGGL_API void _PrepareRender(const UsdImagingGLRenderParams &params)
GLuint color
Definition: glcorearb.h:1261
VtDictionary HdCommandArgs
Definition: command.h:71
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:674
std::vector< GfBBox3d > BBoxVector
Definition: engine.h:614
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:676
Definition: vec3d.h:62
USDIMAGINGGL_API void RenderBatch(const SdfPathVector &paths, const UsdImagingGLRenderParams &params)
Support for batched drawing.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
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:609
USDIMAGINGGL_API VtValue GetRendererSetting(TfToken const &id) const
Gets a renderer setting's current value.
USDIMAGINGGL_API bool ResumeRenderer()
SdfPathVector _excludedPrimPaths
Definition: engine.h:701
Definition: core.h:1131
static USDIMAGINGGL_API std::string GetRendererDisplayName(TfToken const &id)
Return the user-friendly description of a renderer plugin.
std::shared_ptr< struct _AppSceneIndices > _AppSceneIndicesSharedPtr
Definition: engine.h:88
USDIMAGINGGL_API HdEngine * _GetHdEngine()
USDIMAGINGGL_API void _UpdateDomeLightCameraVisibility()
USDIMAGINGGL_API VtDictionary GetRenderStats() const
USDIMAGINGGL_API void _SetRenderDelegate(HdPluginRenderDelegateUniqueHandle &&)
USDIMAGINGGL_API HdCommandDescriptors GetRendererCommandDescriptors() const
std::shared_ptr< class HdSelection > HdSelectionSharedPtr
Definition: selection.h:40
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:167
static USDIMAGINGGL_API TfToken _GetDefaultRendererPluginId()
USDIMAGINGGL_API void SetRootVisibility(bool isVisible)
Sets the root visibility.
std::vector< class GlfSimpleLight > GlfSimpleLightVector
Definition: simpleLight.h:268
USDIMAGINGGL_API HdxTaskController * _GetTaskController() const
USDIMAGINGGL_API void SetEnablePresentation(bool enabled)
SdfPath _rootPath
Definition: engine.h:700
USDIMAGINGGL_API void SetPresentationOutput(TfToken const &api, VtValue const &framebuffer)
std::unique_ptr< class Hgi > HgiUniquePtr
Definition: hgi.h:54
static USDIMAGINGGL_API SdfPathVector GetAvailableRenderSettingsPrimPaths(UsdPrim const &root)
Utility method to query available render settings prims.
GLenum src
Definition: glcorearb.h:1793