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  /// \p allowAsynchronousSceneProcessing indicates to constructed hydra
120  /// scene indices that asynchronous processing is allowow. Applications
121  /// should perodically call PollForAsynchronousUpdates on the engine.
123  };
124 
125  // ---------------------------------------------------------------------
126  /// \name Construction
127  /// @{
128  // ---------------------------------------------------------------------
129 
132 
133  /// An HdDriver, containing the Hgi of your choice, can be optionally passed
134  /// in during construction. This can be helpful if you application creates
135  /// multiple UsdImagingGLEngine that wish to use the same HdDriver / Hgi.
136  /// The \p rendererPluginId argument indicates the renderer plugin that
137  /// Hyrda should use. If the empty token is passed in, a default renderer
138  /// plugin will be chosen depending on the value of \p gpuEnabled.
139  /// The \p gpuEnabled argument determines if this instance will allow Hydra
140  /// to use the GPU to produce images.
142  UsdImagingGLEngine(const HdDriver& driver = HdDriver(),
143  const TfToken& rendererPluginId = TfToken(),
144  bool gpuEnabled = true);
145 
147  UsdImagingGLEngine(const SdfPath& rootPath,
148  const SdfPathVector& excludedPaths,
149  const SdfPathVector& invisedPaths = SdfPathVector(),
150  const SdfPath& sceneDelegateID =
152  const HdDriver& driver = HdDriver(),
153  const TfToken& rendererPluginId = TfToken(),
154  bool gpuEnabled = true,
155  bool displayUnloadedPrimsWithBounds = false,
156  bool allowAsynchronousSceneProcessing = false);
157 
158  // Disallow copies
159  UsdImagingGLEngine(const UsdImagingGLEngine&) = delete;
161 
164 
165  /// @}
166 
167  // ---------------------------------------------------------------------
168  /// \name Rendering
169  /// @{
170  // ---------------------------------------------------------------------
171 
172  /// Support for batched drawing
174  void PrepareBatch(const UsdPrim& root,
177  void RenderBatch(const SdfPathVector& paths,
179 
180  /// Entry point for kicking off a render
182  void Render(const UsdPrim& root,
184 
185  /// Returns true if the resulting image is fully converged.
186  /// (otherwise, caller may need to call Render() again to refine the result)
188  bool IsConverged() const;
189 
190  /// @}
191 
192  // ---------------------------------------------------------------------
193  /// \name Root Transform and Visibility
194  /// @{
195  // ---------------------------------------------------------------------
196 
197  /// Sets the root transform.
199  void SetRootTransform(GfMatrix4d const& xf);
200 
201  /// Sets the root visibility.
203  void SetRootVisibility(bool isVisible);
204 
205  /// @}
206 
207  // ---------------------------------------------------------------------
208  /// \name Camera State
209  /// @{
210  // ---------------------------------------------------------------------
211 
212  /// Scene camera API
213  /// Set the scene camera path to use for rendering.
215  void SetCameraPath(SdfPath const& id);
216 
217  /// Determines how the filmback of the camera is mapped into
218  /// the pixels of the render buffer and what pixels of the render
219  /// buffer will be rendered into.
221  void SetFraming(CameraUtilFraming const& framing);
222 
223  /// Specifies whether to force a window policy when conforming
224  /// the frustum of the camera to match the display window of
225  /// the camera framing.
226  ///
227  /// If set to {false, ...}, the window policy of the specified camera
228  /// will be used.
229  ///
230  /// Note: std::pair<bool, ...> is used instead of std::optional<...>
231  /// because the latter is only available in C++17 or later.
234  const std::optional<CameraUtilConformWindowPolicy> &policy);
235 
236  /// Set the size of the render buffers baking the AOVs.
237  /// GUI applications should set this to the size of the window.
238  ///
240  void SetRenderBufferSize(GfVec2i const& size);
241 
242  /// Set the viewport to use for rendering as (x,y,w,h), where (x,y)
243  /// represents the lower left corner of the viewport rectangle, and (w,h)
244  /// is the width and height of the viewport in pixels.
245  ///
246  /// \deprecated Use SetFraming and SetRenderBufferSize instead.
248  void SetRenderViewport(GfVec4d const& viewport);
249 
250  /// Set the window policy to use.
251  /// XXX: This is currently used for scene cameras set via SetCameraPath.
252  /// See comment in SetCameraState for the free cam.
255 
256  /// Free camera API
257  /// Set camera framing state directly (without pointing to a camera on the
258  /// USD stage). The projection matrix is expected to be pre-adjusted for the
259  /// window policy.
261  void SetCameraState(const GfMatrix4d& viewMatrix,
262  const GfMatrix4d& projectionMatrix);
263 
264  /// @}
265 
266  // ---------------------------------------------------------------------
267  /// \name Light State
268  /// @{
269  // ---------------------------------------------------------------------
270 
271  /// Copy lighting state from another lighting context.
273  void SetLightingState(GlfSimpleLightingContextPtr const &src);
274 
275  /// Set lighting state
276  /// Derived classes should ensure that passing an empty lights
277  /// vector disables lighting.
278  /// \param lights is the set of lights to use, or empty to disable lighting.
280  void SetLightingState(GlfSimpleLightVector const &lights,
281  GlfSimpleMaterial const &material,
282  GfVec4f const &sceneAmbient);
283 
284  /// @}
285 
286  // ---------------------------------------------------------------------
287  /// \name Selection Highlighting
288  /// @{
289  // ---------------------------------------------------------------------
290 
291  /// Sets (replaces) the list of prim paths that should be included in
292  /// selection highlighting. These paths may include root paths which will
293  /// be expanded internally.
295  void SetSelected(SdfPathVector const& paths);
296 
297  /// Clear the list of prim paths that should be included in selection
298  /// highlighting.
300  void ClearSelected();
301 
302  /// Add a path with instanceIndex to the list of prim paths that should be
303  /// included in selection highlighting. UsdImagingDelegate::ALL_INSTANCES
304  /// can be used for highlighting all instances if path is an instancer.
306  void AddSelected(SdfPath const &path, int instanceIndex);
307 
308  /// Sets the selection highlighting color.
310  void SetSelectionColor(GfVec4f const& color);
311 
312  /// @}
313 
314  // ---------------------------------------------------------------------
315  /// \name Picking
316  /// @{
317  // ---------------------------------------------------------------------
318 
319  /// Finds closest point of intersection with a frustum by rendering.
320  ///
321  /// This method uses a PickRender and a customized depth buffer to find an
322  /// approximate point of intersection by rendering. This is less accurate
323  /// than implicit methods or rendering with GL_SELECT, but leverages any
324  /// data already cached in the renderer.
325  ///
326  /// Returns whether a hit occurred and if so, \p outHitPoint will contain
327  /// the intersection point in world space (i.e. \p projectionMatrix and
328  /// \p viewMatrix factored back out of the result), and \p outHitNormal
329  /// will contain the world space normal at that point.
330  ///
331  /// \p outHitPrimPath will point to the gprim selected by the pick.
332  /// \p outHitInstancerPath will point to the point instancer (if applicable)
333  /// of that gprim. For nested instancing, outHitInstancerPath points to
334  /// the closest instancer.
335  ///
337  bool TestIntersection(
338  const GfMatrix4d &viewMatrix,
339  const GfMatrix4d &projectionMatrix,
340  const UsdPrim& root,
342  GfVec3d *outHitPoint,
343  GfVec3d *outHitNormal,
344  SdfPath *outHitPrimPath = NULL,
345  SdfPath *outHitInstancerPath = NULL,
346  int *outHitInstanceIndex = NULL,
347  HdInstancerContext *outInstancerContext = NULL);
348 
349  /// Decodes a pick result given hydra prim ID/instance ID (like you'd get
350  /// from an ID render).
352  bool DecodeIntersection(
353  unsigned char const primIdColor[4],
354  unsigned char const instanceIdColor[4],
355  SdfPath *outHitPrimPath = NULL,
356  SdfPath *outHitInstancerPath = NULL,
357  int *outHitInstanceIndex = NULL,
358  HdInstancerContext *outInstancerContext = NULL);
359 
360  /// @}
361 
362  // ---------------------------------------------------------------------
363  /// \name Renderer Plugin Management
364  /// @{
365  // ---------------------------------------------------------------------
366 
367  /// Return the vector of available render-graph delegate plugins.
370 
371  /// Return the user-friendly description of a renderer plugin.
373  static std::string GetRendererDisplayName(TfToken const &id);
374 
375  /// Return if the GPU is enabled and can be used for any rendering tasks.
377  bool GetGPUEnabled() const;
378 
379  /// Return the id of the currently used renderer plugin.
382 
383  /// Set the current render-graph delegate to \p id.
384  /// the plugin will be loaded if it's not yet.
386  bool SetRendererPlugin(TfToken const &id);
387 
388  /// @}
389 
390  // ---------------------------------------------------------------------
391  /// \name AOVs
392  /// @{
393  // ---------------------------------------------------------------------
394 
395  /// Return the vector of available renderer AOV settings.
398 
399  /// Set the current renderer AOV to \p id.
401  bool SetRendererAov(TfToken const& id);
402 
403  /// Returns an AOV texture handle for the given token.
406 
407  /// Returns the AOV render buffer for the given token.
410 
411  // ---------------------------------------------------------------------
412  /// \name Render Settings (Legacy)
413  /// @{
414  // ---------------------------------------------------------------------
415 
416  /// Returns the list of renderer settings.
419 
420  /// Gets a renderer setting's current value.
422  VtValue GetRendererSetting(TfToken const& id) const;
423 
424  /// Sets a renderer setting's value.
426  void SetRendererSetting(TfToken const& id,
427  VtValue const& value);
428 
429  /// @}
430 
431  // ---------------------------------------------------------------------
432  /// \name Render Settings (Scene description driven)
433  /// \note Support is WIP.
434  /// @{
435  // ---------------------------------------------------------------------
436 
437  /// Set active render settings prim to use to drive rendering.
440 
441  /// Utility method to query available render settings prims.
443  static SdfPathVector
445 
446  /// @}
447 
448  // ---------------------------------------------------------------------
449  /// \name Presentation
450  /// @{
451  // ---------------------------------------------------------------------
452 
453  /// Enable / disable presenting the render to bound framebuffer.
454  /// An application may choose to manage the AOVs that are rendered into
455  /// itself and skip the engine's presentation.
457  void SetEnablePresentation(bool enabled);
458 
459  /// The destination API (e.g., OpenGL, see hgiInterop for details) and
460  /// framebuffer that the AOVs are presented into. The framebuffer
461  /// is a VtValue that encoding a framebuffer in a destination API
462  /// specific way.
463  /// E.g., a uint32_t (aka GLuint) for framebuffer object for OpenGL.
465  void SetPresentationOutput(TfToken const &api, VtValue const &framebuffer);
466 
467  /// @}
468 
469  // ---------------------------------------------------------------------
470  /// \name Renderer Command API
471  /// @{
472  // ---------------------------------------------------------------------
473 
474  /// Return command deescriptors for commands supported by the active
475  /// render delegate.
476  ///
479 
480  /// Invokes command on the active render delegate. If successful, returns
481  /// \c true, returns \c false otherwise. Note that the command will not
482  /// succeeed if it is not among those returned by
483  /// GetRendererCommandDescriptors() for the same active render delegate.
484  ///
487  const TfToken &command,
488  const HdCommandArgs &args = HdCommandArgs()) const;
489 
490  // ---------------------------------------------------------------------
491  /// \name Control of background rendering threads.
492  /// @{
493  // ---------------------------------------------------------------------
494 
495  /// Query the renderer as to whether it supports pausing and resuming.
497  bool IsPauseRendererSupported() const;
498 
499  /// Pause the renderer.
500  ///
501  /// Returns \c true if successful.
503  bool PauseRenderer();
504 
505  /// Resume the renderer.
506  ///
507  /// Returns \c true if successful.
509  bool ResumeRenderer();
510 
511  /// Query the renderer as to whether it supports stopping and restarting.
513  bool IsStopRendererSupported() const;
514 
515  /// Stop the renderer.
516  ///
517  /// Returns \c true if successful.
519  bool StopRenderer();
520 
521  /// Restart the renderer.
522  ///
523  /// Returns \c true if successful.
525  bool RestartRenderer();
526 
527  /// @}
528 
529  // ---------------------------------------------------------------------
530  /// \name Color Correction
531  /// @{
532  // ---------------------------------------------------------------------
533 
534  /// Set \p ccType to one of the HdxColorCorrectionTokens:
535  /// {disabled, sRGB, openColorIO}
536  ///
537  /// If 'openColorIO' is used, \p ocioDisplay, \p ocioView, \p ocioColorSpace
538  /// and \p ocioLook are options the client may supply to configure OCIO.
539  /// \p ocioColorSpace refers to the input (source) color space.
540  /// The default value is substituted if an option isn't specified.
541  /// You can find the values for these strings inside the
542  /// profile/config .ocio file. For example:
543  ///
544  /// displays:
545  /// rec709g22:
546  /// !<View> {name: studio, colorspace: linear, looks: studio_65_lg2}
547  ///
550  TfToken const& ccType,
551  TfToken const& ocioDisplay = {},
552  TfToken const& ocioView = {},
553  TfToken const& ocioColorSpace = {},
554  TfToken const& ocioLook = {});
555 
556  /// @}
557 
558  /// Returns true if the platform is color correction capable.
560  static bool IsColorCorrectionCapable();
561 
562  // ---------------------------------------------------------------------
563  /// \name Render Statistics
564  /// @{
565  // ---------------------------------------------------------------------
566 
567  /// Returns render statistics.
568  ///
569  /// The contents of the dictionary will depend on the current render
570  /// delegate.
571  ///
574 
575  /// @}
576 
577  // ---------------------------------------------------------------------
578  /// \name HGI
579  /// @{
580  // ---------------------------------------------------------------------
581 
582  /// Returns the HGI interface.
583  ///
585  Hgi* GetHgi();
586 
587  /// @}
588 
589  // ---------------------------------------------------------------------
590  /// \name Asynchronous
591  /// @{
592  // ---------------------------------------------------------------------
593 
594  /// If \p allowAsynchronousSceneProcessing is true within the Parameters
595  /// provided to the UsdImagingGLEngine constructor, an application can
596  /// periodically call this from the main thread.
597  ///
598  /// A return value of true indicates that the scene has changed and the
599  /// render should be updated.
601  bool PollForAsynchronousUpdates() const;
602 
603  /// @}
604 
605 protected:
606 
607  /// Open some protected methods for whitebox testing.
609 
610  /// Returns the render index of the engine, if any. This is only used for
611  /// whitebox testing.
614 
617  HdTaskSharedPtrVector tasks);
618 
620  bool _CanPrepare(const UsdPrim& root);
625 
628 
631 
634 
635  using BBoxVector = std::vector<GfBBox3d>;
636 
638  void _SetBBoxParams(
639  const BBoxVector& bboxes,
640  const GfVec4f& bboxLineColor,
641  float bboxLineDashSize);
642 
643  // Create a hydra collection given root paths and render params.
644  // Returns true if the collection was updated.
646  static bool _UpdateHydraCollection(HdRprimCollection *collection,
647  SdfPathVector const& roots,
654  TfTokenVector *renderTags);
655 
658 
662 
665 
668 
671 
672  /// Get a direct pointer to the scene delegate.
673  /// \deprecated Existing instances of this call will be replaced with new
674  /// APIs on this class, to support multiplexing between the
675  /// scene delegate and scene index. This API is scheduled for
676  /// deletion.
679 
682 
685 
688 
689 protected:
690 
691  // Note that any of the fields below might become private
692  // in the future and subclasses should use the above getters
693  // to access them instead.
694 
696  // Similar for HdDriver.
698 
700 
701 protected:
705  std::unique_ptr<HdRenderIndex> _renderIndex;
706 
708 
709  std::unique_ptr<HdxTaskController> _taskController;
710 
714 
715  GlfSimpleLightingContextRefPtr _lightingContextForOpenGLState;
716 
717  // Data we want to live across render plugin switches:
720 
725 
726 private:
727  // Registers app-managed scene indices with the scene index plugin registry.
728  // This needs to be called once *before* the render index is constructed.
729  static void _RegisterApplicationSceneIndices();
730 
731  // Creates and returns the scene globals scene index. This callback is
732  // registered prior to render index construction and is invoked during
733  // render index construction via
734  // HdSceneIndexPluginRegistry::AppendSceneIndicesForRenderer(..).
735  static HdSceneIndexBaseRefPtr
736  _AppendSceneGlobalsSceneIndexCallback(
737  const std::string &renderInstanceId,
738  const HdSceneIndexBaseRefPtr &inputScene,
739  const HdContainerDataSourceHandle &inputArgs);
740 
741  HdSceneIndexBaseRefPtr
742  _AppendOverridesSceneIndices(
743  const HdSceneIndexBaseRefPtr &inputScene);
744 
746 
747  void _DestroyHydraObjects();
748 
749  // Note that we'll only ever use one of _sceneIndex/_sceneDelegate
750  // at a time.
751  UsdImagingStageSceneIndexRefPtr _stageSceneIndex;
752  UsdImagingSelectionSceneIndexRefPtr _selectionSceneIndex;
753  UsdImagingRootOverridesSceneIndexRefPtr _rootOverridesSceneIndex;
754  HdsiLegacyDisplayStyleOverrideSceneIndexRefPtr _displayStyleSceneIndex;
755  HdsiPrimTypePruningSceneIndexRefPtr _materialPruningSceneIndex;
756  HdsiPrimTypePruningSceneIndexRefPtr _lightPruningSceneIndex;
757  HdSceneIndexBaseRefPtr _sceneIndex;
758 
759  std::unique_ptr<UsdImagingDelegate> _sceneDelegate;
760 
761  std::unique_ptr<HdEngine> _engine;
762 
763  bool _allowAsynchronousSceneProcessing = false;
764 };
765 
766 
768 
769 #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:715
USDIMAGINGGL_API void _Execute(const UsdImagingGLRenderParams &params, HdTaskSharedPtrVector tasks)
HdRprimCollection _intersectCollection
Definition: engine.h:713
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
USDIMAGINGGL_API void SetOverrideWindowPolicy(const std::optional< CameraUtilConformWindowPolicy > &policy)
TF_DECLARE_WEAK_AND_REF_PTRS(GlfSimpleLightingContext)
USDIMAGINGGL_API bool _CanPrepare(const UsdPrim &root)
SdfPath const _sceneDelegateId
Definition: engine.h:707
HdPluginRenderDelegateUniqueHandle _renderDelegate
Definition: engine.h:704
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 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:719
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:702
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 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: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:608
Definition: token.h:87
VtValue _userFramebuffer
Definition: engine.h:699
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:718
HdRprimCollection _renderCollection
Definition: engine.h:712
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:133
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:457
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:290
std::vector< class SdfPath > SdfPathVector
A vector of SdfPaths.
Definition: path.h:211
HdxSelectionTrackerSharedPtr _selTracker
Definition: engine.h:711
USDIMAGINGGL_API UsdImagingGLRendererSettingsList GetRendererSettingsList() const
Returns the list of renderer settings.
std::unique_ptr< HdRenderIndex > _renderIndex
Definition: engine.h:705
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:723
Definition: hgi.h:110
GLsizeiptr size
Definition: glcorearb.h:664
USDIMAGINGGL_API void _SetActiveRenderSettingsPrimFromStageMetadata(UsdStageWeakPtr stage)
std::unique_ptr< HdxTaskController > _taskController
Definition: engine.h:709
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:1432
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:695
std::vector< GfBBox3d > BBoxVector
Definition: engine.h:635
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:697
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:722
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:164
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:721
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