HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dataSourcePointInstancer.h
Go to the documentation of this file.
1 //
2 // Copyright 2020 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_USD_IMAGING_USD_IMAGING_DATA_SOURCE_POINT_INSTANCER_H
25 #define PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_POINT_INSTANCER_H
26 
28 
30 
33 
35 
36 // ----------------------------------------------------------------------------
37 
38 /// \class UsdImagingDataSourcePointInstancerMask
39 ///
40 /// A data source representing a point instancer's instance mask. It stores,
41 /// per instance, whether an instance is deactivated. If it has zero length,
42 /// all instances are active.
43 ///
45 {
46 public:
48 
49  VtValue GetValue(HdSampledDataSource::Time shutterOffset) override;
50 
51  VtBoolArray GetTypedValue(
52  HdSampledDataSource::Time shutterOffset) override;
53 
55  HdSampledDataSource::Time startTime,
57  std::vector<HdSampledDataSource::Time> * outSampleTimes) override;
58 
59 private:
61  const SdfPath &sceneIndexPath,
62  const UsdGeomPointInstancer &usdPI,
63  const UsdImagingDataSourceStageGlobals &stageGlobals);
64 
65 private:
66  UsdGeomPointInstancer _usdPI;
67  const UsdImagingDataSourceStageGlobals &_stageGlobals;
68 };
69 
71 
72 // ----------------------------------------------------------------------------
73 
74 /// \class UsdImagingDataSourcePointInstancerTopology
75 ///
76 /// A data source representing a point instancer's instance topology. This
77 /// is made up of "prototypes", "protoIndices", and "mask", which is enough
78 /// to define the right number of instances with the right assigned prototype
79 /// and primvar index.
80 ///
82 {
83 public:
85 
86  TfTokenVector GetNames() override;
87  HdDataSourceBaseHandle Get(const TfToken &name) override;
88 
89 private:
90  // Private constructor, use static New() instead.
92  const SdfPath &sceneIndexPath,
94  const UsdImagingDataSourceStageGlobals &stageGlobals);
95 
96 private:
97  const SdfPath _sceneIndexPath;
98  UsdGeomPointInstancer _usdPI;
99  const UsdImagingDataSourceStageGlobals &_stageGlobals;
100 };
101 
103 
104 // ----------------------------------------------------------------------------
105 
106 /// \class UsdImagingDataSourcePointInstancer
107 ///
108 /// A data source representing the UsdGeom PointInstancer prim.
109 ///
111  : public UsdImagingDataSourcePrim
112 {
113 public:
115 
116  TfTokenVector GetNames() override;
117  HdDataSourceBaseHandle Get(const TfToken &name) override;
118 
119  /// Returns the hydra attribute set we should invalidate if the value of
120  /// the USD properties in \p properties change.
123  UsdPrim const &prim,
124  const TfToken &subprim,
125  const TfTokenVector &properties,
126  UsdImagingPropertyInvalidationType invalidationType);
127 
128 private:
129  // Private constructor, use static New() instead.
132  const SdfPath &sceneIndexPath,
133  UsdPrim usdPrim,
134  const UsdImagingDataSourceStageGlobals &stageGlobals);
135 
136 };
137 
139 
141 
142 #endif // PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_POINT_INSTANCER_H
#define USDIMAGING_API
Definition: api.h:40
VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
HD_DECLARE_DATASOURCE(UsdImagingDataSourcePointInstancerMask)
bool GetContributingSampleTimesForInterval(HdSampledDataSource::Time startTime, HdSampledDataSource::Time endTime, std::vector< HdSampledDataSource::Time > *outSampleTimes) override
TfTokenVector GetNames() override
Definition: token.h:87
HdDataSourceBaseHandle Get(const TfToken &name) override
Definition: prim.h:135
HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourcePointInstancerMask)
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
HD_DECLARE_DATASOURCE(UsdImagingDataSourcePointInstancerTopology)
GLuint const GLchar * name
Definition: glcorearb.h:786
Definition: path.h:291
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
VtBoolArray GetTypedValue(HdSampledDataSource::Time shutterOffset) override
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
static USDIMAGING_API HdDataSourceLocatorSet Invalidate(UsdPrim const &prim, const TfToken &subprim, const TfTokenVector &properties, UsdImagingPropertyInvalidationType invalidationType)
HdDataSourceBaseHandle Get(const TfToken &name) override
HD_DECLARE_DATASOURCE(UsdImagingDataSourcePointInstancerPrim)
Definition: value.h:167
UsdImagingPropertyInvalidationType
Definition: types.h:34