HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_PointInstancer.h
Go to the documentation of this file.
1 /*
2 * Copyright 2024 Side Effects Software Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17 
18 #ifndef __HUSD_PointInstancer_h__
19 #define __HUSD_PointInstancer_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_DataHandle.h"
23 #include "HUSD_Info.h"
24 #include "HUSD_TimeCode.h"
25 
26 #include <GA/GA_Types.h>
27 #include <GU/GU_Detail.h>
28 #include <UT/UT_StringHolder.h>
29 #include <UT/UT_StringMMPattern.h>
30 
32 
34 {
35  None,
36  Remove,
37  Invis
38 };
39 
41 {
44 };
45 
47 {
48  Preserve,
49  Overwrite,
50  Append
51 };
52 
54 {
55  None,
56  Attribute,
57  PrimName,
58  PrimPath
59 };
60 
62 {
63  None,
64  Random,
67 };
68 
70 {
71  Invalid,
72  Overwrite,
73  Sparse,
74  Update
75  };
76 
78 {
79  None,
80  World
81 };
82 
84 {
89 
93 
98 
107 
112 
113 
115 
120 
125 
127 };
128 
129 class husd_UsdWriteQueue;
130 
132 {
133 public:
135  bool is_first_sample,
136  OP_Node *op);
138 
139  bool accumulate(const GU_Detail *gdp,
140  const GA_Range &range,
141  HUSD_AutoReadLock &input_readlock,
142  UT_StringSet &created_primpaths,
143  const HUSD_PointInstancerSopToUsdConfig &config,
144  const UT_StringMap<UT_StringArray> &prototype_path_map);
145 
146  void apply(HUSD_AutoWriteLock &writelock);
147 
149  {return myTimeCode;}
150 
151 private:
153  HUSD_TimeCode myTimeCode;
154  bool myIsFirstSample;
155  OP_Node *myNode;
156 };
157 
159 {
160 public:
161  static bool copyUsdAttrsToGeoAttrs(GU_Detail *gdp,
162  HUSD_AutoReadLock &readlock,
164  const UT_StringMap<UT_Array<exint>> &instancermap,
165  const HUSD_TimeCode &timecode,
166  UT_ErrorManager *error_manager);
167 
168  static bool createBoundingBoxGeoAttr(
169  GU_Detail *gdp,
170  HUSD_AutoReadLock &readlock,
171  const UT_StringRef &primPath,
172  const HUSD_TimeCode &timeCode,
173  const GA_Range &range,
174  const HUSDPointInstancerParms &parms,
175  const UT_Array<exint> &indices);
176 };
177 
179 {
185 
194 
201 };
202 
203 // Returns true if any attribute on the prototype prim or any descendant that
204 // can affect its world-space bounds is time-varying.
205 HUSD_API bool
207  const UT_StringRef &prototype_path);
208 
209 #endif // __HUSD_PointInstancer_h__
GLsizei GLenum const void * indices
Definition: glcorearb.h:406
GLenum GLint * range
Definition: glcorearb.h:1925
HUSD_PointInstancerSopProtoIndexSource
#define HUSD_API
Definition: HUSD_API.h:31
HUSD_PointInstancerMissingPrimvarsPolicy myMissingPrimvarsPolicy
HUSD_PointInstancerExistingProtoRelationshipMode
A range of elements in an index-map.
Definition: GA_Range.h:42
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
HUSD_PointInstancerProtoIndexSource myExistingProtoSource
HUSD_PointInstancerMissingPointsPolicy
HUSD_PointInstancerProtoIndexSource myNewProtoSource
GA_API const UT_StringHolder parms
const HUSD_TimeCode & timecode()
UT_StringArray myImportBoundingBoxesPurposes
HUSD_PointInstancerMissingPrimvarsPolicy
HUSD_PointInstancerMissingPointsPolicy myMissingPointsPolicy
A global error manager scope.
HUSD_PointInstancerExistingProtoRelationshipMode myExistingPrototypeRelMode
HUSD_PointInstancerCopyStyle myExistingCopyStyle
HUSD_API bool HUSDprototypeIsTimeVarying(const HUSD_AutoAnyLock &lock, const UT_StringRef &prototype_path)
bool accumulate(const PointDataTreeT &points, const std::string &attribute, typename PromoteType< ValueT >::Highest &total, const FilterT &filter, typename PointDataTreeT::template ValueConverter< ResultTreeT >::Type *totalTree)
Evaluates the total value of a point attribute and returns whether the value is valid. Optionally constructs localised total value trees.
UT_StringHolder myImportBoundingBoxesAttr
UT_StringHolder myPrimvarsFilter
HUSD_PointInstancerXformImportType
HUSD_PointInstancerProtoIndexSource
HUSD_PointInstancerCopyStyle
HUSD_PointInstancerSopProtoIndexSource myProtoSource