24#ifndef PXR_IMAGING_HD_FLATTENING_SCENE_H
25#define PXR_IMAGING_HD_FLATTENING_SCENE_H
27#include "pxr/imaging/hd/api.h"
29#include "pxr/imaging/hd/filteringSceneIndex.h"
31#include "pxr/usd/sdf/pathTable.h"
32#include <tbb/concurrent_hash_map.h>
34PXR_NAMESPACE_OPEN_SCOPE
36using HdFlattenedDataSourceProviderSharedPtr =
37 std::shared_ptr<class HdFlattenedDataSourceProvider>;
38using HdFlattenedDataSourceProviderSharedPtrVector =
39 std::vector<HdFlattenedDataSourceProviderSharedPtr>;
41namespace HdFlatteningSceneIndex_Impl
43constexpr uint32_t _smallVectorSize = 8;
44using _DataSourceLocatorSetVector =
68 static HdFlatteningSceneIndexRefPtr
New(
69 HdSceneIndexBaseRefPtr
const &inputScene,
70 HdContainerDataSourceHandle
const &inputArgs) {
71 return TfCreateRefPtr(
88 return _dataSourceNames;
92 const HdFlattenedDataSourceProviderSharedPtrVector &
94 return _dataSourceProviders;
101 HdSceneIndexBaseRefPtr
const &inputScene,
102 HdContainerDataSourceHandle
const &inputArgs);
118 using _DataSourceLocatorSetVector =
122 void _ConsolidateRecentPrims();
124 void _DirtyHierarchy(
126 const _DataSourceLocatorSetVector &relativeDirtyLocators,
138 HdFlattenedDataSourceProviderSharedPtrVector _dataSourceProviders;
146 _DataSourceLocatorSetVector _relativeDataSourceLocators;
152 struct _PathHashCompare {
156 static size_t hash(
const SdfPath &path) {
160 using _RecentPrimTable =
161 tbb::concurrent_hash_map<SdfPath, HdSceneIndexPrim, _PathHashCompare>;
162 mutable _RecentPrimTable _recentPrims;
165PXR_NAMESPACE_CLOSE_SCOPE
Represents a set of data source locators closed under descendancy.
A scene index that observes an input scene index and produces a comparable scene in which inherited s...
HD_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
Returns a pair of (prim type, datasource) for the object at primPath.
const HdFlattenedDataSourceProviderSharedPtrVector & GetFlattenedDataSourceProviders() const
Providers in the same order as GetFlattenedDataSourceNames.
static HdFlatteningSceneIndexRefPtr New(HdSceneIndexBaseRefPtr const &inputScene, HdContainerDataSourceHandle const &inputArgs)
Creates a new flattening scene index.
const TfTokenVector & GetFlattenedDataSourceNames() const
Data sources under locator name in a prim source get flattened.
HD_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
Returns the paths of all scene index prims located immediately below primPath.
Abstract interface to scene data.
A path value used to locate objects in layers or scenegraphs.
A mapping from SdfPath to MappedType, somewhat similar to map<SdfPath, MappedType> and TfHashMap<SdfP...
This is a small-vector class with local storage optimization, the local storage can be specified via ...
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
A notice indicating a prim was invalidated.
Small struct representing a 'prim' in the Hydra scene index.
size_t hash_value(const TfToken &x)
Overload hash_value for TfToken.
std::vector< TfToken > TfTokenVector
Convenience types.