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 {
42  UT_StringMap<exint> myIndexByString; // map src/dest paths -> index
43  exint myNumPrototypes = 0; // needed for Random
44 };
45 
47 {
50 };
51 
53 {
54  Preserve,
55  Overwrite,
56  Append
57 };
58 
60 {
61  None,
62  Attribute,
63  PrimName,
64  PrimPath
65 };
66 
68 {
69  None,
70  Random,
73 };
74 
76 {
77  Invalid,
78  Overwrite,
79  Sparse,
80  Update
81  };
82 
84 {
85  None,
86  World
87 };
88 
90 {
95 
99 
104 
113 
118 
119 
121 
126 
131 
133 };
134 
135 class husd_UsdWriteQueue;
136 
138 {
139 public:
141  bool is_first_sample,
142  OP_Node *op);
144 
145  bool accumulate(const GU_Detail *gdp,
146  const GA_Range &range,
147  HUSD_AutoReadLock &input_readlock,
148  const UT_StringSet &created_primpaths,
149  const HUSD_PointInstancerSopToUsdConfig &config,
150  UT_StringMap<HUSD_ProtoResolution> &proto_resolution,
151  bool firstsample=true);
152 
153  void apply(HUSD_AutoWriteLock &writelock);
154 
156  {return myTimeCode;}
157 
158 private:
160  HUSD_TimeCode myTimeCode;
161  bool myIsFirstSample;
162  OP_Node *myNode;
163 };
164 
166 {
167 public:
168  static bool copyUsdAttrsToGeoAttrs(GU_Detail *gdp,
169  HUSD_AutoReadLock &readlock,
171  const UT_StringMap<UT_Array<exint>> &instancermap,
172  const HUSD_TimeCode &timecode,
173  UT_ErrorManager *error_manager,
174  bool &istimevarying);
175 
176  static bool createBoundingBoxGeoAttr(
177  GU_Detail *gdp,
178  HUSD_AutoReadLock &readlock,
179  const UT_StringRef &primPath,
180  const HUSD_TimeCode &timeCode,
181  const GA_Range &range,
182  const HUSDPointInstancerParms &parms,
183  const UT_Array<exint> &indices);
184 };
185 
187 {
193 
202 
209 };
210 
211 // Returns true if any attribute on the prototype prim or any descendant that
212 // can affect its world-space bounds is time-varying.
213 HUSD_API bool
215  const UT_StringRef &prototype_path);
216 
217 // Returns true if any attribute on the prim is time-varying.
218 HUSD_API bool
220  const UT_StringRef &primpath);
221 
222 // Returns true if the local xform on this prim or any of its ancestors
223 // might be time varying.
224 HUSD_API bool
226  const UT_StringRef &primpath);
227 
228 #endif // __HUSD_PointInstancer_h__
GLsizei GLenum const void * indices
Definition: glcorearb.h:406
GLenum GLint * range
Definition: glcorearb.h:1925
HUSD_PointInstancerSopProtoIndexSource
int64 exint
Definition: SYS_Types.h:125
#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_API bool HUSDprimHasTimeVaryingAttributes(const HUSD_AutoAnyLock &lock, const UT_StringRef &primpath)
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
UT_StringMap< exint > myIndexByString
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
HUSD_API bool HUSDprimHasTimeVaryingWorldXform(const HUSD_AutoAnyLock &lock, const UT_StringRef &primpath)
UT_StringHolder myPrimvarsFilter
HUSD_PointInstancerXformImportType
HUSD_PointInstancerProtoIndexSource
HUSD_PointInstancerCopyStyle
HUSD_PointInstancerSopProtoIndexSource myProtoSource