Loading...
Searching...
No Matches
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#include <optional>
15
16PXR_NAMESPACE_OPEN_SCOPE
17
19
20// undefined -> 2 : Make SGSI a filtering scene index.
21#define HDSI_SGSI_API_VERSION 2
22
30{
31public:
32 HDSI_API
33 static HdsiSceneGlobalsSceneIndexRefPtr
34 New(const HdSceneIndexBaseRefPtr &inputSceneIndex);
35
36 // ------------------------------------------------------------------------
37 // Public (non-virtual) API
38 // ------------------------------------------------------------------------
39
43 HDSI_API
45
49 HDSI_API
51
54 HDSI_API
56
59 HDSI_API
60 void SetCurrentFrame(double);
61
64 HDSI_API
66
72 HDSI_API
73 void SetSceneStateId(int);
74
75 // ------------------------------------------------------------------------
76 // Satisfying HdSceneIndexBase
77 // ------------------------------------------------------------------------
78 HDSI_API
80 GetPrim(const SdfPath &primPath) const override final;
81
82 HDSI_API
83 SdfPathVector
84 GetChildPrimPaths(const SdfPath &primPath) const override final;
85
86protected:
87 HDSI_API
88 HdsiSceneGlobalsSceneIndex(const HdSceneIndexBaseRefPtr &inputSceneIndex);
89
90 // ------------------------------------------------------------------------
91 // Satisfying HdSingleInputFilteringSceneIndexBase
92 // ------------------------------------------------------------------------
93 HDSI_API
94 void _PrimsAdded(
95 const HdSceneIndexBase &sender,
96 const HdSceneIndexObserver::AddedPrimEntries &entries) override;
97
98 HDSI_API
99 void _PrimsRemoved(
100 const HdSceneIndexBase &sender,
101 const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
102
103 HDSI_API
104 void _PrimsDirtied(
105 const HdSceneIndexBase &sender,
106 const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
107
108private:
109 friend class _SceneGlobalsDataSource;
110
111 SdfPath _activeRenderPassPrimPath;
112 std::optional<SdfPath> _activeRenderSettingsPrimPath;
113 std::optional<SdfPath> _primaryCameraPrimPath;
114 double _time = std::numeric_limits<double>::quiet_NaN();
115 double _timeCodesPerSecond = 24.0;
116 int _sceneStateId = 0;
117};
118
119PXR_NAMESPACE_CLOSE_SCOPE
120
121#endif //PXR_IMAGING_HDSI_SCENE_GLOBALS_SCENE_INDEX_H
Abstract interface to scene data.
Definition: sceneIndex.h:54
An abstract base class for a filtering scene index that observes a single input scene index.
Scene index that populates the "sceneGlobals" data source as modeled by HdSceneGlobalsSchema and prov...
HDSI_API void SetTimeCodesPerSecond(double)
Set the timeCodesPerSecond to use the as the currentFrame in the scene globals schema.
HDSI_API void SetPrimaryCameraPrimPath(const SdfPath &)
Set the path to use as the primaryCameraPrim in the scene globals schema.
HDSI_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override final
Returns a pair of (prim type, datasource).
HDSI_API void SetActiveRenderSettingsPrimPath(const SdfPath &)
Caches the provided path and notifies any observers when the active render settings prim path is modi...
HDSI_API void SetActiveRenderPassPrimPath(const SdfPath &)
Caches the provided path and notifies any observers when the active render pass prim path is modified...
HDSI_API void SetSceneStateId(int)
Injects an arbitrary value that identifies the state of the input scene at that point in time.
HDSI_API void SetCurrentFrame(double)
Set the frame number to use the as the currentFrame 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.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:72
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:35