HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dataSourceLegacyPrim.h
Go to the documentation of this file.
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"
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 
24 
25 class HdSceneDelegate;
26 
27 #define HD_LEGACY_PRIMTYPE_TOKENS \
28  /* Bprims */ \
29  (openvdbAsset) \
30  (field3dAsset) \
31  (houdiniFieldAsset)
32 
33 TF_DECLARE_PUBLIC_TOKENS(HdLegacyPrimTypeTokens, HD_API,
35 
36 /// Instancers from scene delegates ignore visibility.
37 /// This fixes that usdImaging does not update the visibility of an instancer
38 /// properly.
39 #define HD_LEGACY_FLAG_TOKENS \
40  (isLegacyInstancer)
41 
42 TF_DECLARE_PUBLIC_TOKENS(HdLegacyFlagTokens, HD_API,
44 
45 /// \class HdDataSourceLegacyPrim
46 ///
47 /// This is an HdContainerDataSource which represents a prim-level data source
48 /// for adapting HdSceneDelegate calls into the forms defined by HdSchemas
49 /// during emulation of legacy scene delegates.
50 ///
52 {
53 public:
55 
56  TfTokenVector GetNames() override;
57  HdDataSourceBaseHandle Get(const TfToken &name) override;
58 
59  /// This clears internal cached values and is currently called only by
60  /// HdLegacyPrimSceneIndex in response to its own DirtyPrims method
61  void PrimDirtied(const HdDataSourceLocatorSet &locators);
62 
63  /// Return which locators PrimDirtied will respond to...
65 
66 protected:
68  const SdfPath& id,
69  const TfToken& type,
70  HdSceneDelegate *sceneDelegate);
71 
72 private:
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 _GetDataSharingDataSource();
84  HdDataSourceBaseHandle _GetInstancerTopologyDataSource();
85  HdDataSourceBaseHandle _GetVolumeFieldBindingDataSource();
86  HdDataSourceBaseHandle _GetCoordSysBindingDataSource();
87  HdDataSourceBaseHandle _GetVisibilityDataSource();
88  HdDataSourceBaseHandle _GetPurposeDataSource();
89  HdDataSourceBaseHandle _GetExtentDataSource();
90  HdDataSourceBaseHandle _GetCategoriesDataSource();
91  HdDataSourceBaseHandle _GetInstanceCategoriesDataSource();
92 
93  bool _IsLight();
94  bool _IsInstanceable();
95 
96 protected:
100 
101 private:
102  std::atomic_bool _primvarsBuilt;
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 
115 
116 bool HdLegacyPrimTypeIsVolumeField(TfToken const &primType);
117 
119 
120 #endif
TfTokenVector GetNames() override
void PrimDirtied(const HdDataSourceLocatorSet &locators)
#define HD_API
Definition: api.h:23
HdDataSourceLegacyPrim(const SdfPath &id, const TfToken &type, HdSceneDelegate *sceneDelegate)
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
Definition: token.h:70
HdDataSourceBaseHandle Get(const TfToken &name) override
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
GLuint const GLchar * name
Definition: glcorearb.h:786
Definition: path.h:273
HdSceneDelegate * _sceneDelegate
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define HD_LEGACY_FLAG_TOKENS
#define HD_LEGACY_PRIMTYPE_TOKENS
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
TF_DECLARE_PUBLIC_TOKENS(HdLegacyPrimTypeTokens, HD_API, HD_LEGACY_PRIMTYPE_TOKENS)
bool HdLegacyPrimTypeIsVolumeField(TfToken const &primType)
HD_DECLARE_DATASOURCE(HdDataSourceLegacyPrim)
static const HdDataSourceLocatorSet & GetCachedLocators()
Return which locators PrimDirtied will respond to...
HD_DECLARE_DATASOURCE_HANDLES(HdDataSourceLegacyPrim)