Loading...
Searching...
No Matches
dataSourceLegacyPrim.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_DATA_SOURCE_LEGACY_PRIM_H
8#define PXR_IMAGING_HD_DATA_SOURCE_LEGACY_PRIM_H
9
10#include "pxr/imaging/hd/api.h"
11#include "pxr/imaging/hd/dataSource.h"
12#include "pxr/imaging/hd/dataSourceLocator.h"
13
14#include "pxr/usd/sdf/path.h"
15
17#include "pxr/base/tf/token.h"
18
19#include "pxr/pxr.h"
20
21#include <atomic>
22
23PXR_NAMESPACE_OPEN_SCOPE
24
25class HdSceneDelegate;
26
27#define HD_LEGACY_PRIMTYPE_TOKENS \
28 /* Bprims */ \
29 (openvdbAsset) \
30 (field3dAsset)
31
32TF_DECLARE_PUBLIC_TOKENS(HdLegacyPrimTypeTokens, HD_API,
33 HD_LEGACY_PRIMTYPE_TOKENS);
34
38#define HD_LEGACY_FLAG_TOKENS \
39 (isLegacyInstancer)
40
41TF_DECLARE_PUBLIC_TOKENS(HdLegacyFlagTokens, HD_API,
42 HD_LEGACY_FLAG_TOKENS);
43
51{
52public:
53 HD_DECLARE_DATASOURCE(HdDataSourceLegacyPrim);
54
56 HdDataSourceBaseHandle Get(const TfToken &name) override;
57
60 void PrimDirtied(const HdDataSourceLocatorSet &locators);
61
64
65protected:
67 const SdfPath& id,
68 const TfToken& type,
69 HdSceneDelegate *sceneDelegate);
70
71private:
72 HdDataSourceBaseHandle _GetPrimvarsDataSource();
73 HdDataSourceBaseHandle _GetExtComputationPrimvarsDataSource();
74 HdDataSourceBaseHandle _GetMaterialBindingsDataSource();
75 HdDataSourceBaseHandle _GetXformDataSource();
76 HdDataSourceBaseHandle _GetMaterialDataSource();
77 HdDataSourceBaseHandle _GetIntegratorDataSource();
78 HdDataSourceBaseHandle _GetSampleFilterDataSource();
79 HdDataSourceBaseHandle _GetDisplayFilterDataSource();
80 HdDataSourceBaseHandle _GetDisplayStyleDataSource();
81 HdDataSourceBaseHandle _GetInstancedByDataSource();
82 HdDataSourceBaseHandle _GetInstancerTopologyDataSource();
83 HdDataSourceBaseHandle _GetVolumeFieldBindingDataSource();
84 HdDataSourceBaseHandle _GetCoordSysBindingDataSource();
85 HdDataSourceBaseHandle _GetVisibilityDataSource();
86 HdDataSourceBaseHandle _GetPurposeDataSource();
87 HdDataSourceBaseHandle _GetExtentDataSource();
88 HdDataSourceBaseHandle _GetCategoriesDataSource();
89 HdDataSourceBaseHandle _GetInstanceCategoriesDataSource();
90
91 bool _IsLight();
92 bool _IsInstanceable();
93
94protected:
95 SdfPath _id;
96 TfToken _type;
97 HdSceneDelegate *_sceneDelegate;
98
99private:
100 std::atomic_bool _primvarsBuilt;
101 bool _extComputationPrimvarsBuilt : 1;
102
103 HdContainerDataSourceAtomicHandle _primvars;
104 HdContainerDataSourceHandle _extComputationPrimvars;
105
106 // Note: _instancerTopology needs to be an atomic handle, since
107 // some downstream customers of it (render index sync, hdSt instancer sync)
108 // are not threadsafe.
109 HdContainerDataSourceAtomicHandle _instancerTopology;
110};
111
112HD_DECLARE_DATASOURCE_HANDLES(HdDataSourceLegacyPrim);
113
114bool HdLegacyPrimTypeIsVolumeField(TfToken const &primType);
115
116PXR_NAMESPACE_CLOSE_SCOPE
117
118#endif
A datasource representing structured (named, hierarchical) data, for example a geometric primitive or...
Definition: dataSource.h:99
This is an HdContainerDataSource which represents a prim-level data source for adapting HdSceneDelega...
void PrimDirtied(const HdDataSourceLocatorSet &locators)
This clears internal cached values and is currently called only by HdLegacyPrimSceneIndex in response...
TfTokenVector GetNames() override
Returns the list of names for which Get(...) is expected to return a non-null value.
static const HdDataSourceLocatorSet & GetCachedLocators()
Return which locators PrimDirtied will respond to...
HdDataSourceBaseHandle Get(const TfToken &name) override
Returns the child datasource of the given name.
Represents a set of data source locators closed under descendancy.
Adapter class providing data exchange with the client scene graph.
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
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:81
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