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 terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_USD_IMAGING_USD_IMAGING_IMPLICIT_SURFACE_MESH_UTILS_H
8 #define PXR_USD_IMAGING_USD_IMAGING_IMPLICIT_SURFACE_MESH_UTILS_H
9 
10 #include "pxr/pxr.h"
12 #include "pxr/base/vt/types.h"
13 
15 
16 class PxOsdMeshTopology;
17 class TfToken;
18 
19 // Sphere
20 
21 /// Return a topology object for the canonical "unit sphere" mesh. This is
22 /// constructed once and is identical for all spheres. The indices refer to the
23 /// points array returned by UsdImagingGetUnitSphereMeshPoints().
25 const PxOsdMeshTopology&
27 
28 /// Return an array of points for the canonical "unit sphere" mesh. This is a
29 /// mesh describing a sphere that fits in a unit-sized bounding box, centered on
30 /// the origin. Note that this means the diameter, not radius, is one unit!
31 ///
32 /// These points are constructed once and are identical for all spheres, with
33 /// topology provided by UsdImagingGetUnitSphereMeshTopology(). To represent
34 /// spheres of a different size, use with the transform produced by the
35 /// companion function UsdImagingGenerateSphereOrCubeTransform().
37 const VtVec3fArray&
39 
40 // Cube
41 
42 /// Return a topology object for the canonical "unit cube" mesh. This is
43 /// constructed once and is identical for all cubes. The indices refer to the
44 /// points array returned by UsdImagingGetUnitCubeMeshPoints().
46 const PxOsdMeshTopology&
48 
49 /// Return an array of points for the canonical "unit cube" mesh. This is a
50 /// mesh describing a cube with unit-length edges, centered on the origin.
51 ///
52 /// These points are constructed once and are identical for all cubes, with
53 /// topology provided by UsdImagingGetUnitCubeMeshTopology(). To represent
54 /// cubes of a different size, use with the transform produced by the
55 /// companion function UsdImagingGenerateSphereOrCubeTransform().
57 const VtVec3fArray&
59 
60 // Cone
61 
62 /// Return a topology object for the canonical "unit cone" mesh. This is
63 /// constructed once and is identical for all cones. The indices refer to the
64 /// points array returned by UsdImagingGetUnitConeMeshPoints().
66 const PxOsdMeshTopology&
68 
69 /// Return an array of points for the canonical "unit cone" mesh. This is a
70 /// mesh describing a cone that fits in a unit-sized bounding box, centered on
71 /// the origin. Note that this means the diameter, not radius, is one unit!
72 /// The circular-disk face of the cone lies in the XY plane, with the large end
73 /// on the negative-Z side and the cone point on the positive-Z side.
74 ///
75 /// These points are constructed once and are identical for all cones, with
76 /// topology provided by UsdImagingGetUnitConeMeshTopology(). To represent
77 /// cones of a different radius, height, or axis orientation, use with the
78 /// transform produced by the companion function
79 /// UsdImagingGenerateConeOrCylinderTransform().
81 const VtVec3fArray&
83 
84 // Cylinder
85 
86 /// Return a topology object for the canonical "unit cylinder" mesh. This is
87 /// constructed once and is identical for all cylinders. The indices refer to
88 /// the points array returned by UsdImagingGetUnitCylinderMeshPoints().
90 const PxOsdMeshTopology&
92 
93 /// Return an array of points for the canonical "unit cylinder" mesh. This is a
94 /// mesh describing a cylinder that fits in a unit-sized bounding box, centered
95 /// on the origin. Note that this means the diameter, not radius, is one unit!
96 /// The circular-disk face of the cone lies in the XY plane, with the height of
97 /// the cylinder aligned along the Z axis.
98 ///
99 /// These points are constructed once and are identical for all cylinders, with
100 /// topology provided by UsdImagingGetUnitCylinderMeshTopology(). To represent
101 /// cylinders of a different radius, height, or axis orientation, use with the
102 /// transform produced by the companion function
103 /// UsdImagingGenerateConeOrCylinderTransform().
105 const VtVec3fArray&
107 
108 // Capsule
109 
110 /// Return a topology object for use with all generated "capsule" meshes. This
111 /// is constructed once and is identical for all capsules. The indices refer to
112 /// the points array returned by UsdImagingGenerateCapsuleMeshPoints().
114 const PxOsdMeshTopology&
116 
117 /// Generate an array of points describing a "capsule": a cylinder with
118 /// hemispherical caps on each end. The given height is the length of the
119 /// cylinder portion exclusively, and the given radius applies to both cylinder
120 /// and hemisphere components. The cylinder will be oriented along the given
121 /// axis.
122 ///
123 /// Unlike the other primitives in this library, it's not possible to use a
124 /// constant set of points and effect radius and height adjustments by varying
125 /// the transform matrix. This function will generate the points with the
126 /// requested parameters, and no additional transform is required. The returned
127 /// points are for use with the topology provided by
128 /// UsdImagingGetCapsuleMeshTopology().
130 VtVec3fArray
132  const double height,
133  const double radius,
134  const TfToken& axis);
135 
136 // Plane
137 
138 /// Return a topology object for use with all generated "Plane" meshes. This
139 /// is constructed once and is identical for all planes. The indices refer to
140 /// the points array returned by UsdImagingGeneratePlaneMeshPoints().
142 const PxOsdMeshTopology&
144 
145 /// Generate an array of points describing a "plane". This is a mesh describing
146 /// a double-sided plane aligned to an axis, with a width and length along the
147 /// other cardinal axes.
148 ///
149 /// Unlike most other primitives in this library, it's not possible to use a
150 /// constant set of points and effect width and length adjustments by varying
151 /// the transform matrix. This function will generate the points with the
152 /// requested parameters, and no additional transform is required. The returned
153 /// points are for use with the topology provided by
154 /// UsdImagingGetPlaneTopology().
156 VtVec3fArray
158  const double width,
159  const double length,
160  const TfToken& axis);
161 
162 
163 // Transforms
164 
165 /// Generate a transform to inflate the "unit sphere" or "unit cube" mesh to the
166 /// specified size. This is a uniform scale matrix. Note that the parameter is
167 /// the net scale, so when using with the "unit sphere" mesh be sure to pass the
168 /// desired diameter (not radius)!
172  const double size);
173 
174 /// Generate a transform for use with the "unit cone" or "unit cylinder" meshes,
175 /// which transforms the mesh to have the specified height and radius, while
176 /// aligned along the specified axis. This is a combination of rotation and
177 /// nonuniform scales. This function is for use only with the cone and cylinder
178 /// primitives, hence its parameterization by radius; the net scale for the
179 /// radial axes will be twice the given value.
183  const double height,
184  const double radius,
185  const TfToken& axis);
186 
188 
189 #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:23
USDIMAGING_API const PxOsdMeshTopology & UsdImagingGetCapsuleMeshTopology()
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
GLint GLsizei GLsizei height
Definition: glcorearb.h:103
Definition: token.h:70
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:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
GLint GLsizei width
Definition: glcorearb.h:103
USDIMAGING_API const PxOsdMeshTopology & UsdImagingGetUnitSphereMeshTopology()
USDIMAGING_API const VtVec3fArray & UsdImagingGetUnitCylinderMeshPoints()
USDIMAGING_API GfMatrix4d UsdImagingGenerateSphereOrCubeTransform(const double size)