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 <GU/GU_Detail.h>
22 
23 #include <GA/GA_Types.h>
24 
25 #include <HUSD/HUSD_API.h>
26 #include <HUSD/HUSD_DataHandle.h>
27 #include <HUSD/HUSD_TimeCode.h>
28 
29 #include <UT/UT_StringHolder.h>
30 
31 
33 {
34 public:
35  enum IdSource
36  {
40  IDSOURCEATTRIBUTEORPOINTNUMBER
41  };
42 
44  {
47  PROTOSOURCEPRIMPATH
48  };
49 
50  enum CopyStyle
51  {
53  COPYSTYLEOVERWRITE, // Overwrite existing array value with new length based on only existing points in sops
54  COPYSTYLESPARSE // look up existing usd values and sparsely update with data from sops (ie missing points in sops keep same value)
55  };
56 
58  {
60  XFORMTYPEWORLD
61  };
62 
63  // USD -> SOP
64  static bool copyUsdPrimvarsToGeoAttrs(HUSD_AutoAnyLock &lock,
65  GU_Detail *gdp,
66  const GA_Offset &offsetStart,
67  const int &numPoints,
68  const UT_StringHolder &primvarFilter,
69  const HUSD_TimeCode &timeCode,
70  const UT_StringRef &PROTOSOURCEPRIMPATH);
71 
72  static bool copyUsdXformAttrsToGeoAttrs(HUSD_AutoAnyLock &lock,
73  GU_Detail *gdp,
74  const GA_Offset &offsetStart,
75  const int &numPoints,
76  const HUSD_TimeCode &timeCode,
77  const UT_StringRef &PROTOSOURCEPRIMPATH,
78  bool applyPrimXform=false,
79  bool copyPositions=true,
80  bool copyOrientations=true,
81  bool copyScales=true,
82  bool copyAccelerations=true,
83  bool copyVelocities=true,
84  bool copyAngularVelocities=true,
85  bool createUsdXformAttrib=true);
86 
87  static bool copyUsdIdAttrsToGeoAttrs(HUSD_AutoAnyLock &lock,
88  GU_Detail *gdp,
89  const GA_Offset &offsetStart,
90  const int &numPoints,
91  const HUSD_TimeCode &timeCode,
92  const UT_StringRef &PROTOSOURCEPRIMPATH,
93  bool useInvisIds=true,
94  IdSource idSource=IDSOURCENONE,
95  ProtoSource protoSource=PROTOSOURCENONE);
96 
97  static bool createBoundingBoxGeoAttr(HUSD_AutoAnyLock &lock,
98  GU_Detail *gdp,
99  const GA_Offset &offsetStart,
100  const int &numPoints,
101  const HUSD_TimeCode &timeCode,
102  const UT_StringRef &PROTOSOURCEPRIMPATH,
103  const UT_StringArray &purposes,
104  bool applyPrimXform=false);
105 
106 };
107 
108 #endif // __HUSD_PointInstancer_h__
#define HUSD_API
Definition: HUSD_API.h:31
GA_Size GA_Offset
Definition: GA_Types.h:646