Loading...
Searching...
No Matches
lightLinkingSceneIndex.h
1//
2// Copyright 2024 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_LIGHT_LINKING_SCENE_INDEX_H
8#define PXR_IMAGING_HDSI_LIGHT_LINKING_SCENE_INDEX_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdsi/api.h"
12
13#include "pxr/imaging/hd/filteringSceneIndex.h"
14#include "pxr/usd/sdf/path.h"
16#include "pxr/base/tf/token.h"
17#include "pxr/base/vt/array.h"
18
19#include <memory>
20
21PXR_NAMESPACE_OPEN_SCOPE
22
25#define HDSI_LIGHT_LINKING_SCENE_INDEX_TOKENS \
26 (lightPrimTypes) \
27 (lightFilterPrimTypes) \
28 (geometryPrimTypes)
29
30TF_DECLARE_PUBLIC_TOKENS(HdsiLightLinkingSceneIndexTokens, HDSI_API,
31 HDSI_LIGHT_LINKING_SCENE_INDEX_TOKENS);
32
33namespace HdsiLightLinkingSceneIndex_Impl
34{
35 struct _Cache;
36 using _CacheSharedPtr = std::shared_ptr<_Cache>;
37}
38
40
69// Linking to instance proxy prims, nested instances and
78{
79public:
80 HDSI_API
81 static HdSceneIndexBaseRefPtr
82 New(const HdSceneIndexBaseRefPtr &inputSceneIndex,
83 const HdContainerDataSourceHandle &inputArgs);
84
85 HDSI_API
86 HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
87
88 HDSI_API
89 SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
90
91protected:
92
93 HDSI_API
95 const HdSceneIndexBaseRefPtr &inputSceneIndex,
96 const HdContainerDataSourceHandle &inputArgs);
97
98 HDSI_API
99 void _PrimsAdded(
100 const HdSceneIndexBase &sender,
101 const HdSceneIndexObserver::AddedPrimEntries &entries) override;
102
103 HDSI_API
104 void _PrimsRemoved(
105 const HdSceneIndexBase &sender,
106 const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
107
108 HDSI_API
109 void _PrimsDirtied(
110 const HdSceneIndexBase &sender,
111 const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
112
113private:
114 void _ProcessAddedLightOrFilter(
116 const TfTokenVector &collectionNames,
118
119 bool _IsLight(const TfToken &primType) const;
120 bool _IsLightFilter(const TfToken &primType) const;
121 bool _IsGeometry(const TfToken &primType) const;
122
123private:
124 HdsiLightLinkingSceneIndex_Impl::_CacheSharedPtr const _cache;
125
126 // Track prims with light linking collections.
127 SdfPathSet _lightAndFilterPrimPaths;
128
129 const VtArray<TfToken> _lightPrimTypes;
130 const VtArray<TfToken> _lightFilterPrimTypes;
131 const VtArray<TfToken> _geometryPrimTypes;
132
133 // Flag tracking first population.
134 bool _wasPopulated;
135};
136
137PXR_NAMESPACE_CLOSE_SCOPE
138
139#endif
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.
nested point instancers is not yet supported.
HDSI_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
Returns a pair of (prim type, datasource).
HDSI_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
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
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Represents an arbitrary dimensional rectangular container class.
Definition: array.h:213
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:58
This file defines some macros that are useful for declaring and using static TfTokens.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:92
A notice indicating a prim of a given type was added to the scene.
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:35
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440