dataSourcePointInstancer.h
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 
27 #include "pxr/imaging/hd/dataSourceTypeDefs.h"
28 
30 
31 #include "pxr/usdImaging/usdImaging/dataSourcePrim.h"
32 #include "pxr/usdImaging/usdImaging/dataSourcePrimvars.h"
33 
34 PXR_NAMESPACE_OPEN_SCOPE
35 
36 // ----------------------------------------------------------------------------
37 
45 {
46 public:
47  HD_DECLARE_DATASOURCE(UsdImagingDataSourcePointInstancerMask);
48 
49  VtValue GetValue(HdSampledDataSource::Time shutterOffset) override;
50 
51  VtBoolArray GetTypedValue(
52  HdSampledDataSource::Time shutterOffset) override;
53 
55  HdSampledDataSource::Time startTime,
56  HdSampledDataSource::Time endTime,
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 
70 HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourcePointInstancerMask);
71 
72 // ----------------------------------------------------------------------------
73 
82 {
83 public:
84  HD_DECLARE_DATASOURCE(UsdImagingDataSourcePointInstancerTopology);
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 
102 HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourcePointInstancerTopology);
103 
104 // ----------------------------------------------------------------------------
105 
110 class UsdImagingDataSourcePointInstancerPrim
111  : public UsdImagingDataSourcePrim
112 {
113 public:
114  HD_DECLARE_DATASOURCE(UsdImagingDataSourcePointInstancerPrim);
115 
116  TfTokenVector GetNames() override;
117  HdDataSourceBaseHandle Get(const TfToken &name) override;
118 
121  USDIMAGING_API
123  UsdPrim const &prim,
124  const TfToken &subprim,
125  const TfTokenVector &properties);
126 
127 private:
128  // Private constructor, use static New() instead.
129  USDIMAGING_API
130  UsdImagingDataSourcePointInstancerPrim(
131  const SdfPath &sceneIndexPath,
132  UsdPrim usdPrim,
133  const UsdImagingDataSourceStageGlobals &stageGlobals);
134 
135 };
136 
137 HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourcePointInstancerPrim);
138 
139 PXR_NAMESPACE_CLOSE_SCOPE
140 
141 #endif // PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_POINT_INSTANCER_H
TfTokenVector GetNames() override
Returns the list of names for which Get(...) is expected to return a non-null value.
bool GetContributingSampleTimesForInterval(HdSampledDataSource::Time startTime, HdSampledDataSource::Time endTime, std::vector< HdSampledDataSource::Time > *outSampleTimes) override
Given a shutter window of interest (startTime and endTime relative to the current frame),...
VtBoolArray GetTypedValue(HdSampledDataSource::Time shutterOffset) override
Returns the value of this data source at frame-relative time shutterOffset, as type T.
A datasource representing structured (named, hierarchical) data, for example a geometric primitive or...
Definition: dataSource.h:110
HdDataSourceBaseHandle Get(const TfToken &name) override
Returns the child datasource of the given name.
A data source representing a point instancer's instance mask.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
Data source representing a basic USD prim.
This class is used as a context object with global stage information, that gets passed down to dataso...
A datasource representing a concretely-typed sampled value.
Definition: dataSource.h:204
Represents a set of data source locators closed under descendancy.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:134
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
USDIMAGING_API TfTokenVector GetNames() override
Returns the names for which this data source can return meaningful results.
static USDIMAGING_API HdDataSourceLocatorSet Invalidate(UsdPrim const &prim, const TfToken &subprim, const TfTokenVector &properties)
Returns the hydra attribute set we should invalidate if the value of the USD properties in properties...
USDIMAGING_API HdDataSourceBaseHandle Get(const TfToken &name) override
Returns the data source representing name, if valid.
A data source representing a point instancer's instance topology.
Encodes vectorized instancing of multiple, potentially animated, prototypes (object/instance masters)...
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:166
VtValue GetValue(HdSampledDataSource::Time shutterOffset) override
Returns the value of this data source at frame-relative time shutterOffset.