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_Tuple.h>
32 #include <GT/GT_DANumeric.h>
33 #include <GT/GT_Types.h>
34 #include <GT/GT_TransformArray.h>
35 #include <GT/GT_Transform.h>
37 
38 #include <pxr/pxr.h>
41 
43 
44 class HdSceneDelegate;
45 class SdfPath;
46 class TfToken;
47 class PxOsdSubdivTags;
48 
49 namespace XUSD_HydraUtils
50 {
52  HdSceneDelegate *scene_del,
53  SdfPath const &path,
55  const UT_Map<GT_Owner,GT_Owner>*remap=nullptr);
56 
58  const SdfPath &prim_path);
59 
60  template<typename T>
61  HUSD_API bool eval(VtValue &val, T &ret_val);
62 
63 
64  template<typename T>
65  HUSD_API bool evalAttrib(T &val,
66  HdSceneDelegate *scene_del,
67  const SdfPath &prim_path,
68  const TfToken &attrib_name);
69 
70  template<typename T>
71  HUSD_API bool evalCameraAttrib(T &val,
72  HdSceneDelegate *scene_del,
73  const SdfPath &prim_path,
74  const TfToken &attrib_name);
75 
76  template<typename T>
77  HUSD_API bool evalLightAttrib(T &val,
78  HdSceneDelegate *scene_del,
79  const SdfPath &prim_path,
80  const TfToken &attrib_name);
81 
83  const VtMatrix4dArray &insts);
84 
85  template <typename A_TYPE>
86  GT_DataArrayHandle createGTArray(const A_TYPE &usd,
87  GT_Type tinfo=GT_TYPE_NONE,
88  int64 data_id = -1);
90  GT_Type tinfo=GT_TYPE_NONE,
91  int64 data_id=-1);
92  HUSD_API bool addToOptions(UT_Options &options,
93  const VtValue &value,
94  const UT_StringRef &name);
95 
97 
98  HUSD_API void processSubdivTags(const PxOsdSubdivTags &subdivTags,
100 
101  HUSD_API void processSubdivTags(const PxOsdSubdivTags &subdivTags,
102  const VtIntArray &hole_indices,
104 
107 
108  const VtIntArray &crease_indices,
109  const VtIntArray &crease_lengths,
110  const VtFloatArray &crease_weights,
111 
112  const VtIntArray &corner_indices,
113  const VtFloatArray &corner_weights,
114 
115  const VtIntArray &hole_indices,
116 
117  const TfToken &vtx_InterpolationRule,
118  const TfToken &fvar_InterpolationRule
119  );
120 
121 };
122 
124 
125 #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:34
std::tuple< Types...> UT_Tuple
Definition: UT_Tuple.h:53
GLuint const GLchar * name
Definition: glcorearb.h:786
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)
Definition: token.h:87
HUSD_API void processSubdivTags(const PxOsdSubdivTags &subdivTags, UT_Array< GT_PrimSubdivisionMesh::Tag > &subd_tags)
HUSD_API bool addToOptions(UT_Options &options, const VtValue &value, const UT_StringRef &name)
long long int64
Definition: SYS_Types.h:116
HUSD_API bool eval(VtValue &val, T &ret_val)
Definition: path.h:290
GLuint GLfloat * val
Definition: glcorearb.h:1608
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:1394
HUSD_API UT_Matrix4D fullTransform(HdSceneDelegate *scene_del, const SdfPath &prim_path)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
HUSD_API void buildAttribMap(HdSceneDelegate *scene_del, SdfPath const &path, UT_StringMap< UT_Tuple< GT_Owner, int, bool, void * > > &map, const UT_Map< GT_Owner, GT_Owner > *remap=nullptr)
Definition: core.h:1131
Definition: value.h:166