Loading...
Searching...
No Matches
drawModeSceneIndex.h
1//
2// Copyright 2022 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6#ifndef PXR_USD_IMAGING_USD_IMAGING_DRAW_MODE_SCENE_INDEX_H
7#define PXR_USD_IMAGING_USD_IMAGING_DRAW_MODE_SCENE_INDEX_H
8
9#include "pxr/pxr.h"
10#include "pxr/usdImaging/usdImaging/api.h"
11#include "pxr/imaging/hd/filteringSceneIndex.h"
12
13PXR_NAMESPACE_OPEN_SCOPE
14
15using UsdImaging_DrawModeStandinSharedPtr =
16 std::shared_ptr<class UsdImaging_DrawModeStandin>;
17
19
35{
36public:
41 USDIMAGING_API
42 static UsdImagingDrawModeSceneIndexRefPtr
43 New(const HdSceneIndexBaseRefPtr &inputSceneIndex,
44 const HdContainerDataSourceHandle &inputArgs);
45
46 USDIMAGING_API
48
49 USDIMAGING_API
50 HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
51 USDIMAGING_API
52 SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
53
54protected:
56 const HdSceneIndexBaseRefPtr &inputSceneIndex,
57 const HdContainerDataSourceHandle &inputArgs);
58
59 void _PrimsAdded(
60 const HdSceneIndexBase &sender,
61 const HdSceneIndexObserver::AddedPrimEntries &entries) override;
62
63 void _PrimsRemoved(
64 const HdSceneIndexBase &sender,
65 const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
66
67 void _PrimsDirtied(
68 const HdSceneIndexBase &sender,
69 const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
70
71private:
72 // Delete path and all descendents from _prims.
73 void _DeleteSubtree(const SdfPath &path);
74 // Pull prim at path and recursively its descendants from input
75 // scene index - stopping the recursion when a prim with
76 // non-default drawmode is hit. When a prim has non-trivial drawmode,
77 // the DrawModeStandin object is instantiated instead.
78 void _RecursePrims(
79 const TfToken &drawMode,
80 const SdfPath &path,
81 const HdSceneIndexPrim &prim,
83
84 // Finds prim or ancestor of prim with non-trivial drawmode in _prims map.
85 // isPathDescendant is set to true if the given path is a descendant of such
86 // a prim (but not the prim itself).
87 UsdImaging_DrawModeStandinSharedPtr
88 _FindStandinForPrimOrAncestor(
89 const SdfPath &path, bool * isPathDescendant = nullptr) const;
90
91 // For prims with applyDrawMode, store a DrawModeStandin object
92 // that can be queried for the stand-in geometry.
93 // No path in the map is a prefix of any other path in the map.
94 std::map<SdfPath, UsdImaging_DrawModeStandinSharedPtr> _prims;
95};
96
97PXR_NAMESPACE_CLOSE_SCOPE
98
99#endif // PXR_USD_IMAGING_USD_IMAGING_GL_DRAW_MODE_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.
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
A scene index replacing geometry based on the draw mode.
static USDIMAGING_API UsdImagingDrawModeSceneIndexRefPtr New(const HdSceneIndexBaseRefPtr &inputSceneIndex, const HdContainerDataSourceHandle &inputArgs)
inputArgs unused for now.
USDIMAGING_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
Returns the paths of all scene index prims located immediately below primPath.
USDIMAGING_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
Returns a pair of (prim type, datasource).
#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