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;
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
44{
45public:
46 HD_DECLARE_DATASOURCE(HdExtComputationCallbackDataSource);
47
49 const SdfPath &id, HdSceneDelegate *sceneDelegate)
50 : _id(id), _sceneDelegate(sceneDelegate) {}
51
52 HD_API
53 void Invoke(HdExtComputationContext *context);
54
55private:
56 SdfPath _id;
57 HdSceneDelegate *_sceneDelegate;
58};
59
60HD_DECLARE_DATASOURCE_HANDLES(HdExtComputationCallbackDataSource);
61
69{
70public:
71 HD_DECLARE_DATASOURCE(HdDataSourceLegacyPrim);
72
74 HdDataSourceBaseHandle Get(const TfToken &name) override;
75
78 void PrimDirtied(const HdDataSourceLocatorSet &locators);
79
82
83protected:
85 const SdfPath& id,
86 const TfToken& type,
87 HdSceneDelegate *sceneDelegate);
88
89private:
90 HdDataSourceBaseHandle _GetPrimvarsDataSource();
91 HdDataSourceBaseHandle _GetExtComputationPrimvarsDataSource();
92 HdDataSourceBaseHandle _GetMaterialBindingsDataSource();
93 HdDataSourceBaseHandle _GetXformDataSource();
94 HdDataSourceBaseHandle _GetMaterialDataSource();
95 HdDataSourceBaseHandle _GetIntegratorDataSource();
96 HdDataSourceBaseHandle _GetSampleFilterDataSource();
97 HdDataSourceBaseHandle _GetDisplayFilterDataSource();
98 HdDataSourceBaseHandle _GetDisplayStyleDataSource();
99 HdDataSourceBaseHandle _GetInstancedByDataSource();
100 HdDataSourceBaseHandle _GetInstancerTopologyDataSource();
101 HdDataSourceBaseHandle _GetVolumeFieldBindingDataSource();
102 HdDataSourceBaseHandle _GetCoordSysBindingDataSource();
103 HdDataSourceBaseHandle _GetVisibilityDataSource();
104 HdDataSourceBaseHandle _GetPurposeDataSource();
105 HdDataSourceBaseHandle _GetExtentDataSource();
106 HdDataSourceBaseHandle _GetCategoriesDataSource();
107 HdDataSourceBaseHandle _GetInstanceCategoriesDataSource();
108
109 bool _IsLight();
110 bool _IsInstanceable();
111
112protected:
113 SdfPath _id;
114 TfToken _type;
115 HdSceneDelegate *_sceneDelegate;
116
117private:
118 std::atomic_bool _primvarsBuilt;
119 bool _extComputationPrimvarsBuilt : 1;
120
121 HdContainerDataSourceAtomicHandle _primvars;
122 HdContainerDataSourceHandle _extComputationPrimvars;
123
124 // Note: _instancerTopology needs to be an atomic handle, since
125 // some downstream customers of it (render index sync, hdSt instancer sync)
126 // are not threadsafe.
127 HdContainerDataSourceAtomicHandle _instancerTopology;
128};
129
130HD_DECLARE_DATASOURCE_HANDLES(HdDataSourceLegacyPrim);
131
132bool HdLegacyPrimTypeIsVolumeField(TfToken const &primType);
133
134PXR_NAMESPACE_CLOSE_SCOPE
135
136#endif
A datasource representing structured (named, hierarchical) data, for example a geometric primitive or...
Definition: dataSource.h:99
Represents an object which can produce scene data.
Definition: dataSource.h:81
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.
This is a data source which holds a legacy ext computation.
Interface class that defines the execution environment for the client to run a computation.
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