HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
implicitSurfaceMeshUtils.h
Go to the documentation of this file.
1 //
2 // Copyright 2019 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_USD_IMAGING_USD_IMAGING_IMPLICIT_SURFACE_MESH_UTILS_H
25 #define PXR_USD_IMAGING_USD_IMAGING_IMPLICIT_SURFACE_MESH_UTILS_H
26 
27 #include "pxr/pxr.h"
29 #include "pxr/base/vt/types.h"
30 
32 
33 class PxOsdMeshTopology;
34 class TfToken;
35 
36 // Sphere
37 
38 /// Return a topology object for the canonical "unit sphere" mesh. This is
39 /// constructed once and is identical for all spheres. The indices refer to the
40 /// points array returned by UsdImagingGetUnitSphereMeshPoints().
42 const PxOsdMeshTopology&
44 
45 /// Return an array of points for the canonical "unit sphere" mesh. This is a
46 /// mesh describing a sphere that fits in a unit-sized bounding box, centered on
47 /// the origin. Note that this means the diameter, not radius, is one unit!
48 ///
49 /// These points are constructed once and are identical for all spheres, with
50 /// topology provided by UsdImagingGetUnitSphereMeshTopology(). To represent
51 /// spheres of a different size, use with the transform produced by the
52 /// companion function UsdImagingGenerateSphereOrCubeTransform().
54 const VtVec3fArray&
56 
57 // Cube
58 
59 /// Return a topology object for the canonical "unit cube" mesh. This is
60 /// constructed once and is identical for all cubes. The indices refer to the
61 /// points array returned by UsdImagingGetUnitCubeMeshPoints().
63 const PxOsdMeshTopology&
65 
66 /// Return an array of points for the canonical "unit cube" mesh. This is a
67 /// mesh describing a cube with unit-length edges, centered on the origin.
68 ///
69 /// These points are constructed once and are identical for all cubes, with
70 /// topology provided by UsdImagingGetUnitCubeMeshTopology(). To represent
71 /// cubes of a different size, use with the transform produced by the
72 /// companion function UsdImagingGenerateSphereOrCubeTransform().
74 const VtVec3fArray&
76 
77 // Cone
78 
79 /// Return a topology object for the canonical "unit cone" mesh. This is
80 /// constructed once and is identical for all cones. The indices refer to the
81 /// points array returned by UsdImagingGetUnitConeMeshPoints().
83 const PxOsdMeshTopology&
85 
86 /// Return an array of points for the canonical "unit cone" mesh. This is a
87 /// mesh describing a cone that fits in a unit-sized bounding box, centered on
88 /// the origin. Note that this means the diameter, not radius, is one unit!
89 /// The circular-disk face of the cone lies in the XY plane, with the large end
90 /// on the negative-Z side and the cone point on the positive-Z side.
91 ///
92 /// These points are constructed once and are identical for all cones, with
93 /// topology provided by UsdImagingGetUnitConeMeshTopology(). To represent
94 /// cones of a different radius, height, or axis orientation, use with the
95 /// transform produced by the companion function
96 /// UsdImagingGenerateConeOrCylinderTransform().
98 const VtVec3fArray&
100 
101 // Cylinder
102 
103 /// Return a topology object for the canonical "unit cylinder" mesh. This is
104 /// constructed once and is identical for all cylinders. The indices refer to
105 /// the points array returned by UsdImagingGetUnitCylinderMeshPoints().
107 const PxOsdMeshTopology&
109 
110 /// Return an array of points for the canonical "unit cylinder" mesh. This is a
111 /// mesh describing a cylinder that fits in a unit-sized bounding box, centered
112 /// on the origin. Note that this means the diameter, not radius, is one unit!
113 /// The circular-disk face of the cone lies in the XY plane, with the height of
114 /// the cylinder aligned along the Z axis.
115 ///
116 /// These points are constructed once and are identical for all cylinders, with
117 /// topology provided by UsdImagingGetUnitCylinderMeshTopology(). To represent
118 /// cylinders of a different radius, height, or axis orientation, use with the
119 /// transform produced by the companion function
120 /// UsdImagingGenerateConeOrCylinderTransform().
122 const VtVec3fArray&
124 
125 // Capsule
126 
127 /// Return a topology object for use with all generated "capsule" meshes. This
128 /// is constructed once and is identical for all capsules. The indices refer to
129 /// the points array returned by UsdImagingGenerateCapsuleMeshPoints().
131 const PxOsdMeshTopology&
133 
134 /// Generate an array of points describing a "capsule": a cylinder with
135 /// hemispherical caps on each end. The given height is the length of the
136 /// cylinder portion exclusively, and the given radius applies to both cylinder
137 /// and hemisphere components. The cylinder will be oriented along the given
138 /// axis.
139 ///
140 /// Unlike the other primitives in this library, it's not possible to use a
141 /// constant set of points and effect radius and height adjustments by varying
142 /// the transform matrix. This function will generate the points with the
143 /// requested parameters, and no additional transform is required. The returned
144 /// points are for use with the topology provided by
145 /// UsdImagingGetCapsuleMeshTopology().
147 VtVec3fArray
149  const double height,
150  const double radius,
151  const TfToken& axis);
152 
153 // Plane
154 
155 /// Return a topology object for use with all generated "Plane" meshes. This
156 /// is constructed once and is identical for all planes. The indices refer to
157 /// the points array returned by UsdImagingGeneratePlaneMeshPoints().
159 const PxOsdMeshTopology&
161 
162 /// Generate an array of points describing a "plane". This is a mesh describing
163 /// a double-sided plane aligned to an axis, with a width and length along the
164 /// other cardinal axes.
165 ///
166 /// Unlike most other primitives in this library, it's not possible to use a
167 /// constant set of points and effect width and length adjustments by varying
168 /// the transform matrix. This function will generate the points with the
169 /// requested parameters, and no additional transform is required. The returned
170 /// points are for use with the topology provided by
171 /// UsdImagingGetPlaneTopology().
173 VtVec3fArray
175  const double width,
176  const double length,
177  const TfToken& axis);
178 
179 
180 // Transforms
181 
182 /// Generate a transform to inflate the "unit sphere" or "unit cube" mesh to the
183 /// specified size. This is a uniform scale matrix. Note that the parameter is
184 /// the net scale, so when using with the "unit sphere" mesh be sure to pass the
185 /// desired diameter (not radius)!
189  const double size);
190 
191 /// Generate a transform for use with the "unit cone" or "unit cylinder" meshes,
192 /// which transforms the mesh to have the specified height and radius, while
193 /// aligned along the specified axis. This is a combination of rotation and
194 /// nonuniform scales. This function is for use only with the cone and cylinder
195 /// primitives, hence its parameterization by radius; the net scale for the
196 /// radial axes will be twice the given value.
200  const double height,
201  const double radius,
202  const TfToken& axis);
203 
205 
206 #endif // PXR_USD_IMAGING_USD_IMAGING_IMPLICIT_SURFACE_MESH_UTILS_H
USDIMAGING_API GfMatrix4d UsdImagingGenerateConeOrCylinderTransform(const double height, const double radius, const TfToken &axis)
USDIMAGING_API VtVec3fArray UsdImagingGeneratePlaneMeshPoints(const double width, const double length, const TfToken &axis)
USDIMAGING_API const PxOsdMeshTopology & UsdImagingGetUnitCubeMeshTopology()
#define USDIMAGING_API
Definition: api.h:40
USDIMAGING_API const PxOsdMeshTopology & UsdImagingGetCapsuleMeshTopology()
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
GLint GLsizei GLsizei height
Definition: glcorearb.h:103
Definition: token.h:87
USDIMAGING_API const PxOsdMeshTopology & UsdImagingGetPlaneTopology()
USDIMAGING_API const VtVec3fArray & UsdImagingGetUnitCubeMeshPoints()
USDIMAGING_API const PxOsdMeshTopology & UsdImagingGetUnitConeMeshTopology()
USDIMAGING_API VtVec3fArray UsdImagingGenerateCapsuleMeshPoints(const double height, const double radius, const TfToken &axis)
USDIMAGING_API const VtVec3fArray & UsdImagingGetUnitConeMeshPoints()
USDIMAGING_API const PxOsdMeshTopology & UsdImagingGetUnitCylinderMeshTopology()
GLsizeiptr size
Definition: glcorearb.h:664
USDIMAGING_API const VtVec3fArray & UsdImagingGetUnitSphereMeshPoints()
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
GLint GLsizei width
Definition: glcorearb.h:103
USDIMAGING_API const PxOsdMeshTopology & UsdImagingGetUnitSphereMeshTopology()
USDIMAGING_API const VtVec3fArray & UsdImagingGetUnitCylinderMeshPoints()
USDIMAGING_API GfMatrix4d UsdImagingGenerateSphereOrCubeTransform(const double size)