Loading...
Searching...
No Matches
prefixingSceneIndex.h
1//
2// Copyright 2021 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_HD_PREFIXING_SCENE_INDEX_H
8#define PXR_IMAGING_HD_PREFIXING_SCENE_INDEX_H
9
10#include "pxr/imaging/hd/api.h"
11#include "pxr/imaging/hd/filteringSceneIndex.h"
12
13PXR_NAMESPACE_OPEN_SCOPE
14
17
25{
26public:
27
30 static HdPrefixingSceneIndexRefPtr New(
31 const HdSceneIndexBaseRefPtr &inputScene, const SdfPath &prefix)
32 {
33 return TfCreateRefPtr(new HdPrefixingSceneIndex(inputScene, prefix));
34 }
35
36 // satisfying HdSceneIndexBase
37 HD_API
38 HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
39
40 HD_API
41 SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
42
43 HD_API
44 SdfPath AddPrefix(const SdfPath &primPath) const;
45 HD_API
46 SdfPath RemovePrefix(const SdfPath &primPath) const;
47
48protected:
49
50 HD_API
51 HdPrefixingSceneIndex(const HdSceneIndexBaseRefPtr &inputScene,
52 const SdfPath &prefix);
53
54 // satisfying HdSingleInputFilteringSceneIndexBase
55 void _PrimsAdded(
56 const HdSceneIndexBase &sender,
57 const HdSceneIndexObserver::AddedPrimEntries &entries) override;
58
59 void _PrimsRemoved(
60 const HdSceneIndexBase &sender,
61 const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
62
63 void _PrimsDirtied(
64 const HdSceneIndexBase &sender,
65 const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
66
67private:
68
69 const SdfPath _prefix;
70 typedef std::unordered_map<SdfPath, SdfPath, SdfPath::Hash> SdfPathMap;
71 SdfPathMap _addPrefixMap;
72 SdfPathMap _removePrefixMap;
73};
74
75PXR_NAMESPACE_CLOSE_SCOPE
76
77#endif
78
A prefixing scene index is one in which the input scene contains data sources whose paths are all pre...
HD_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
Returns a pair of (prim type, datasource).
static HdPrefixingSceneIndexRefPtr New(const HdSceneIndexBaseRefPtr &inputScene, const SdfPath &prefix)
Creates a new prefixing scene index.
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.
Definition: sceneIndex.h:54
An abstract base class for a filtering scene index that observes a single input scene index.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:58
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:35