7#ifndef PXR_IMAGING_GEOM_UTIL_SPHERE_MESH_GENERATOR_H
8#define PXR_IMAGING_GEOM_UTIL_SPHERE_MESH_GENERATOR_H
10#include "pxr/imaging/geomUtil/api.h"
11#include "pxr/imaging/geomUtil/meshGeneratorBase.h"
16PXR_NAMESPACE_OPEN_SCOPE
62 static constexpr size_t minNumRadial = 3;
63 static constexpr size_t minNumAxial = 2;
66 static size_t ComputeNumPoints(
67 const size_t numRadial,
68 const size_t numAxial,
69 const bool closedSweep =
true);
71 static size_t ComputeNumNormals(
72 const size_t numRadial,
73 const size_t numAxial,
74 const bool closedSweep =
true)
77 return ComputeNumPoints(numRadial, numAxial, closedSweep);
80 static TfToken GetNormalsInterpolation()
83 return GeomUtilInterpolationTokens->vertex;
88 const size_t numRadial,
89 const size_t numAxial,
90 const bool closedSweep =
true);
92 template<
typename PointIterType,
95 typename _EnableIfGfVec3Iterator<PointIterType>::type>
96 static void GeneratePoints(
98 const size_t numRadial,
99 const size_t numAxial,
100 const ScalarType radius,
103 constexpr ScalarType sweep = 360;
104 GeneratePoints(iter, numRadial, numAxial, radius, sweep, framePtr);
107 template<
typename PointIterType,
110 typename _EnableIfGfVec3Iterator<PointIterType>::type>
111 static void GeneratePoints(
113 const size_t numRadial,
114 const size_t numAxial,
115 const ScalarType radius,
116 const ScalarType sweepDegrees,
120 typename std::iterator_traits<PointIterType>::value_type;
122 _GeneratePointsImpl(numRadial, numAxial, radius, sweepDegrees,
123 framePtr ? _PointWriter<PointType>(iter, framePtr)
124 : _PointWriter<PointType>(iter));
127 using GeomUtilMeshGeneratorBase::GeneratePoints;
129 template<
typename PointIterType,
131 typename _EnableIfGfVec3Iterator<PointIterType>::type>
132 static void GenerateNormals(
134 const size_t numRadial,
135 const size_t numAxial,
139 typename std::iterator_traits<PointIterType>::value_type;
141 constexpr typename PointType::ScalarType sweep = 360;
142 GenerateNormals(iter, numRadial, numAxial, sweep, framePtr);
145 template<
typename PointIterType,
148 typename _EnableIfGfVec3Iterator<PointIterType>::type>
149 static void GenerateNormals(
151 const size_t numRadial,
152 const size_t numAxial,
153 const ScalarType sweepDegrees,
157 typename std::iterator_traits<PointIterType>::value_type;
159 _GenerateNormalsImpl(numRadial, numAxial, sweepDegrees,
160 framePtr ? _PointWriter<PointType>(iter, framePtr)
161 : _PointWriter<PointType>(iter));
164 using GeomUtilMeshGeneratorBase::GenerateNormals;
168 template<
typename Po
intType>
169 static void _GeneratePointsImpl(
170 const size_t numRadial,
171 const size_t numAxial,
172 const typename PointType::ScalarType radius,
173 const typename PointType::ScalarType sweepDegrees,
174 const _PointWriter<PointType>& ptWriter);
176 template<
typename Po
intType>
177 static void _GenerateNormalsImpl(
178 const size_t numRadial,
179 const size_t numAxial,
180 const typename PointType::ScalarType sweepDegrees,
181 const _PointWriter<PointType>& ptWriter);
184PXR_NAMESPACE_CLOSE_SCOPE
This class provides common implementation for the different mesh generator classes in GeomUtil.
This class provides an implementation for generating topology, point positions and surface normals on...
Stores a 4x4 matrix of double elements.
Topology data for meshes.
Token for efficient comparison, assignment, and hashing of known strings.