HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XUSD_HydraUtils.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 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  * NAME: XUSD_HydraUtils.h (HUSD Library, C++)
17  *
18  * COMMENTS: Utility functions for Hydra delegates, as Hydra classes derive
19  * from Pixar Hd* classes so adding common methods between
20  * different hydra prim types is tricky.
21  */
22 #ifndef XUSD_HydraUtils_h
23 #define XUSD_HydraUtils_h
24 
25 #include "HUSD_API.h"
26 
27 #include <UT/UT_Array.h>
28 #include <UT/UT_Matrix4.h>
29 #include <UT/UT_Options.h>
30 #include <UT/UT_StringMap.h>
31 #include <UT/UT_UniquePtr.h>
32 #include <GT/GT_Types.h>
33 #include <GT/GT_TransformArray.h>
34 #include <GT/GT_Transform.h>
36 
37 #include <pxr/pxr.h>
40 
42 
44 class HdSceneDelegate;
45 class SdfPath;
46 class TfToken;
47 class PxOsdSubdivTags;
48 
49 namespace XUSD_HydraUtils
50 {
52  {
55  };
56 
58  HdSceneDelegate *scene_del,
59  SdfPath const &path,
61  GT_Owner varying_class = GT_OWNER_POINT,
62  const UT_Map<GT_Owner,GT_Owner>*remap=nullptr);
63 
65  const SdfPath &prim_path);
66 
67  template<typename T>
68  HUSD_API bool eval(VtValue &val, T &ret_val);
69 
70 
71  template<typename T>
72  HUSD_API bool evalAttrib(T &val,
73  HdSceneDelegate *scene_del,
74  const SdfPath &prim_path,
75  const TfToken &attrib_name);
76 
77  template<typename T>
79  HdSceneDelegate *scene_del,
80  const SdfPath &prim_path,
81  const TfToken &attrib_name);
82 
83  template<typename T>
85  HdSceneDelegate *scene_del,
86  const SdfPath &prim_path,
87  const TfToken &attrib_name);
88 
90  const VtMatrix4dArray &insts);
91 
92  template <typename A_TYPE>
93  GT_DataArrayHandle createGTArray(const A_TYPE &usd,
94  GT_Type tinfo=GT_TYPE_NONE,
95  int64 data_id = -1);
97  GT_Type tinfo=GT_TYPE_NONE,
98  int64 data_id=-1);
99  HUSD_API bool addToOptions(UT_Options &options,
100  const VtValue &value,
101  const UT_StringRef &name);
102 
104 
105  HUSD_API void processSubdivTags(const PxOsdSubdivTags &subdivTags,
107 
108  HUSD_API void processSubdivTags(const PxOsdSubdivTags &subdivTags,
109  const VtIntArray &hole_indices,
111 
114 
115  const VtIntArray &crease_indices,
116  const VtIntArray &crease_lengths,
117  const VtFloatArray &crease_weights,
118 
119  const VtIntArray &corner_indices,
120  const VtFloatArray &corner_weights,
121 
122  const VtIntArray &hole_indices,
123 
124  const TfToken &vtx_InterpolationRule,
125  const TfToken &fvar_InterpolationRule
126  );
127 
128 };
129 
131 
132 #endif
HUSD_API bool evalCameraAttrib(T &val, HdSceneDelegate *scene_del, const SdfPath &prim_path, const TfToken &attrib_name)
Unsorted map container.
Definition: UT_Map.h:107
HUSD_API bool evalLightAttrib(T &val, HdSceneDelegate *scene_del, const SdfPath &prim_path, const TfToken &attrib_name)
HUSD_API bool evalAttrib(T &val, HdSceneDelegate *scene_del, const SdfPath &prim_path, const TfToken &attrib_name)
HUSD_API int64 newDataId()
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
HUSD_API GT_DataArrayHandle attribGT(const VtValue &value, GT_Type tinfo=GT_TYPE_NONE, int64 data_id=-1)
#define HUSD_API
Definition: HUSD_API.h:32
GT_Type
Definition: GT_Types.h:36
GT_DataArrayHandle createGTArray(const A_TYPE &usd, GT_Type tinfo=GT_TYPE_NONE, int64 data_id=-1)
HUSD_API GT_TransformArrayHandle createTransformArray(const VtMatrix4dArray &insts)
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
Definition: token.h:87
HUSD_API void processSubdivTags(const PxOsdSubdivTags &subdivTags, UT_Array< GT_PrimSubdivisionMesh::Tag > &subd_tags)
HUSD_API void buildAttribMap(HdSceneDelegate *scene_del, SdfPath const &path, UT_StringMap< AttribInfo > &map, GT_Owner varying_class=GT_OWNER_POINT, const UT_Map< GT_Owner, GT_Owner > *remap=nullptr)
HUSD_API bool addToOptions(UT_Options &options, const VtValue &value, const UT_StringRef &name)
UT_UniquePtr< HdExtComputationPrimvarDescriptor > myComputationInfo
long long int64
Definition: SYS_Types.h:116
HUSD_API bool eval(VtValue &val, T &ret_val)
GLuint const GLchar * name
Definition: glcorearb.h:786
Definition: path.h:291
GT_Owner
Definition: GT_Types.h:90
A map of string to various well defined value types.
Definition: UT_Options.h:84
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
HUSD_API UT_Matrix4D fullTransform(HdSceneDelegate *scene_del, const SdfPath &prim_path)
GLuint GLfloat * val
Definition: glcorearb.h:1608
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
Definition: core.h:1131
Definition: value.h:167