sceneGlobalsSceneIndex.h
1 //
2 // Copyright 2023 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_HDSI_SCENE_GLOBALS_SCENE_INDEX_H
8 #define PXR_IMAGING_HDSI_SCENE_GLOBALS_SCENE_INDEX_H
9 
10 #include "pxr/imaging/hdsi/api.h"
11 
12 #include "pxr/imaging/hd/filteringSceneIndex.h"
13 #include "pxr/usd/sdf/path.h"
14 
15 PXR_NAMESPACE_OPEN_SCOPE
16 
18 
19 // undefined -> 2 : Make SGSI a filtering scene index.
20 #define HDSI_SGSI_API_VERSION 2
21 
29 {
30 public:
31  HDSI_API
32  static HdsiSceneGlobalsSceneIndexRefPtr
33  New(const HdSceneIndexBaseRefPtr &inputSceneIndex);
34 
35  // ------------------------------------------------------------------------
36  // Public (non-virtual) API
37  // ------------------------------------------------------------------------
38 
42  HDSI_API
44 
48  HDSI_API
50 
53  HDSI_API
54  void SetPrimaryCameraPrimPath(const SdfPath &);
55 
58  HDSI_API
59  void SetCurrentFrame(double);
60 
63  HDSI_API
64  void SetTimeCodesPerSecond(double);
65 
71  HDSI_API
72  void SetSceneStateId(int);
73 
74  // ------------------------------------------------------------------------
75  // Satisfying HdSceneIndexBase
76  // ------------------------------------------------------------------------
77  HDSI_API
79  GetPrim(const SdfPath &primPath) const override final;
80 
81  HDSI_API
82  SdfPathVector
83  GetChildPrimPaths(const SdfPath &primPath) const override final;
84 
85 protected:
86  HDSI_API
87  HdsiSceneGlobalsSceneIndex(const HdSceneIndexBaseRefPtr &inputSceneIndex);
88 
89  // ------------------------------------------------------------------------
90  // Satisfying HdSingleInputFilteringSceneIndexBase
91  // ------------------------------------------------------------------------
92  HDSI_API
93  void _PrimsAdded(
94  const HdSceneIndexBase &sender,
95  const HdSceneIndexObserver::AddedPrimEntries &entries) override;
96 
97  HDSI_API
98  void _PrimsRemoved(
99  const HdSceneIndexBase &sender,
100  const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
101 
102  HDSI_API
103  void _PrimsDirtied(
104  const HdSceneIndexBase &sender,
105  const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
106 
107 private:
108  class _SceneGlobalsSchemaDataSource;
109  using _SceneGlobalsSchemaDataSourceHandle =
110  std::shared_ptr<_SceneGlobalsSchemaDataSource>;
111 
112  const _SceneGlobalsSchemaDataSourceHandle _sceneGlobalsSchemaDataSource;
113 };
114 
115 PXR_NAMESPACE_CLOSE_SCOPE
116 
117 #endif //PXR_IMAGING_HDSI_SCENE_GLOBALS_SCENE_INDEX_H
An abstract base class for a filtering scene index that observes a single input scene index.
HDSI_API void SetActiveRenderSettingsPrimPath(const SdfPath &)
Caches the provided path and notifies any observers when the active render settings prim path is modi...
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:72
HDSI_API void SetCurrentFrame(double)
Set the frame number to use the as the currentFrame in the scene globals schema.
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:35
HDSI_API void SetTimeCodesPerSecond(double)
Set the timeCodesPerSecond to use the as the currentFrame in the scene globals schema.
HDSI_API void SetActiveRenderPassPrimPath(const SdfPath &)
Caches the provided path and notifies any observers when the active render pass prim path is modified...
Abstract interface to scene data.
Definition: sceneIndex.h:54
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:280
HDSI_API void SetPrimaryCameraPrimPath(const SdfPath &)
Set the path to use as the primaryCameraPrim in the scene globals schema.
HDSI_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override final
Returns the paths of all scene index prims located immediately below primPath.
Scene index that populates the "sceneGlobals" data source as modeled by HdSceneGlobalsSchema and prov...
HDSI_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override final
Returns a pair of (prim type, datasource).
HDSI_API void SetSceneStateId(int)
Injects an arbitrary value that identifies the state of the input scene at that point in time.