Loading...
Searching...
No Matches
dataSourceLegacyPrim.h
1//
2// Copyright 2021 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_IMAGING_HD_DATA_SOURCE_LEGACY_PRIM_H
25#define PXR_IMAGING_HD_DATA_SOURCE_LEGACY_PRIM_H
26
27#include "pxr/imaging/hd/sceneIndex.h"
28#include "pxr/imaging/hd/api.h"
30
31PXR_NAMESPACE_OPEN_SCOPE
32
33class HdSceneDelegate;
35
36#define HD_LEGACY_PRIMTYPE_TOKENS \
37 /* Bprims */ \
38 (openvdbAsset) \
39 (field3dAsset)
40
41TF_DECLARE_PUBLIC_TOKENS(HdLegacyPrimTypeTokens, HD_API,
42 HD_LEGACY_PRIMTYPE_TOKENS);
43
52{
53public:
54 HD_DECLARE_DATASOURCE(HdExtComputationCallbackDataSource);
55
57 const SdfPath &id, HdSceneDelegate *sceneDelegate)
58 : _id(id), _sceneDelegate(sceneDelegate) {}
59
60 HD_API
61 void Invoke(HdExtComputationContext *context);
62
63private:
64 SdfPath _id;
65 HdSceneDelegate *_sceneDelegate;
66};
67
68HD_DECLARE_DATASOURCE_HANDLES(HdExtComputationCallbackDataSource);
69
77{
78public:
79 HD_DECLARE_DATASOURCE(HdDataSourceLegacyPrim);
80
82 HdDataSourceBaseHandle Get(const TfToken &name) override;
83
86 void PrimDirtied(const HdDataSourceLocatorSet &locators);
87
90
91private:
93 SdfPath id,
94 TfToken type,
95 HdSceneDelegate *sceneDelegate);
96
97 HdDataSourceBaseHandle _GetPrimvarsDataSource();
98 HdDataSourceBaseHandle _GetExtComputationPrimvarsDataSource();
99 HdDataSourceBaseHandle _GetMaterialBindingsDataSource();
100 HdDataSourceBaseHandle _GetXformDataSource();
101 HdDataSourceBaseHandle _GetMaterialDataSource();
102 HdDataSourceBaseHandle _GetIntegratorDataSource();
103 HdDataSourceBaseHandle _GetSampleFilterDataSource();
104 HdDataSourceBaseHandle _GetDisplayFilterDataSource();
105 HdDataSourceBaseHandle _GetDisplayStyleDataSource();
106 HdDataSourceBaseHandle _GetInstancedByDataSource();
107 HdDataSourceBaseHandle _GetInstancerTopologyDataSource();
108 HdDataSourceBaseHandle _GetVolumeFieldBindingDataSource();
109 HdDataSourceBaseHandle _GetCoordSysBindingDataSource();
110 HdDataSourceBaseHandle _GetVisibilityDataSource();
111 HdDataSourceBaseHandle _GetPurposeDataSource();
112 HdDataSourceBaseHandle _GetExtentDataSource();
113 HdDataSourceBaseHandle _GetCategoriesDataSource();
114 HdDataSourceBaseHandle _GetInstanceCategoriesDataSource();
115
116 bool _IsLight();
117 bool _IsInstanceable();
118
119private:
120 SdfPath _id;
121 TfToken _type;
122 HdSceneDelegate *_sceneDelegate;
123
124 std::atomic_bool _primvarsBuilt;
125 bool _extComputationPrimvarsBuilt : 1;
126
127 HdContainerDataSourceAtomicHandle _primvars;
128 HdContainerDataSourceHandle _extComputationPrimvars;
129
130 // Note: _instancerTopology needs to be an atomic handle, since
131 // some downstream customers of it (render index sync, hdSt instancer sync)
132 // are not threadsafe.
133 HdContainerDataSourceAtomicHandle _instancerTopology;
134};
135
136HD_DECLARE_DATASOURCE_HANDLES(HdDataSourceLegacyPrim);
137
138bool HdLegacyPrimTypeIsVolumeField(TfToken const &primType);
139
140PXR_NAMESPACE_CLOSE_SCOPE
141
142#endif
A datasource representing structured (named, hierarchical) data, for example a geometric primitive or...
Definition: dataSource.h:116
Represents an object which can produce scene data.
Definition: dataSource.h:98
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:291
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
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:108
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:457