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
16#include "pxr/base/tf/spinMutex.h"
18#include "pxr/base/tf/token.h"
19
20#include "pxr/pxr.h"
21
22#include <atomic>
23
24PXR_NAMESPACE_OPEN_SCOPE
25
26class HdSceneDelegate;
27
28#define HD_LEGACY_PRIMTYPE_TOKENS \
29 /* Bprims */ \
30 (openvdbAsset) \
31 (field3dAsset)
32
33TF_DECLARE_PUBLIC_TOKENS(HdLegacyPrimTypeTokens, HD_API,
34 HD_LEGACY_PRIMTYPE_TOKENS);
35
39#define HD_LEGACY_FLAG_TOKENS \
40 (isLegacyInstancer)
41
42TF_DECLARE_PUBLIC_TOKENS(HdLegacyFlagTokens, HD_API,
43 HD_LEGACY_FLAG_TOKENS);
44
52{
53public:
54 HD_DECLARE_DATASOURCE(HdDataSourceLegacyPrim);
55
57 HdDataSourceBaseHandle Get(const TfToken &name) override;
58
61 void PrimDirtied(const HdDataSourceLocatorSet &locators);
62
65
66protected:
68 const SdfPath& id,
69 const TfToken& type,
70 HdSceneDelegate *sceneDelegate);
71
72private:
73 HdDataSourceBaseHandle _GetPrimvarsDataSource();
74 HdDataSourceBaseHandle _GetExtComputationPrimvarsDataSource();
75 HdDataSourceBaseHandle _GetMaterialBindingsDataSource();
76 HdDataSourceBaseHandle _GetXformDataSource();
77 HdDataSourceBaseHandle _GetMaterialDataSource();
78 HdDataSourceBaseHandle _GetIntegratorDataSource();
79 HdDataSourceBaseHandle _GetSampleFilterDataSource();
80 HdDataSourceBaseHandle _GetDisplayFilterDataSource();
81 HdDataSourceBaseHandle _GetDisplayStyleDataSource();
82 HdDataSourceBaseHandle _GetInstancedByDataSource();
83 HdDataSourceBaseHandle _GetInstancerTopologyDataSource();
84 HdDataSourceBaseHandle _GetVolumeFieldBindingDataSource();
85 HdDataSourceBaseHandle _GetCoordSysBindingDataSource();
86 HdDataSourceBaseHandle _GetVisibilityDataSource();
87 HdDataSourceBaseHandle _GetPurposeDataSource();
88 HdDataSourceBaseHandle _GetExtentDataSource();
89 HdDataSourceBaseHandle _GetCategoriesDataSource();
90 HdDataSourceBaseHandle _GetInstanceCategoriesDataSource();
91
92 bool _IsLight();
93 bool _IsInstanceable();
94
95protected:
96 SdfPath _id;
97 TfToken _type;
98 HdSceneDelegate *_sceneDelegate;
99
100private:
101 std::atomic_bool _primvarsBuilt;
102 TfSpinMutex _primvarsMutex;
103 bool _extComputationPrimvarsBuilt : 1;
104
105 HdContainerDataSourceAtomicHandle _primvars;
106 HdContainerDataSourceHandle _extComputationPrimvars;
107
108 // Note: _instancerTopology needs to be an atomic handle, since
109 // some downstream customers of it (render index sync, hdSt instancer sync)
110 // are not threadsafe.
111 HdContainerDataSourceAtomicHandle _instancerTopology;
112};
113
114HD_DECLARE_DATASOURCE_HANDLES(HdDataSourceLegacyPrim);
115
116bool HdLegacyPrimTypeIsVolumeField(TfToken const &primType);
117
118PXR_NAMESPACE_CLOSE_SCOPE
119
120#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
This class implements a simple spin lock that emphasizes throughput when there is little to no conten...
Definition: spinMutex.h:42
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:92
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