25 #ifndef OPENSUBDIV3_BFR_PARAMETERIZATION_H 26 #define OPENSUBDIV3_BFR_PARAMETERIZATION_H 28 #include "../version.h" 30 #include "../sdc/types.h" 33 namespace OPENSUBDIV_VERSION {
81 bool IsValid()
const {
return (_faceSize > 0); }
118 template <
typename REAL>
122 template <
typename REAL>
123 void GetEdgeCoord(
int edgeIndex, REAL t, REAL uvCoord[2])
const;
126 template <
typename REAL>
152 template <
typename REAL>
157 template <
typename REAL>
159 REAL
const uvCoord[2], REAL subFaceCoord[2])
const;
162 template <
typename REAL>
164 REAL
const subFaceCoord[2], REAL uvCoord[2])
const;
168 template <
typename REAL>
170 REAL
const uvCoord[2], REAL subFaceCoord[2])
const;
173 template <
typename REAL>
175 REAL
const subFaceCoord[2], REAL uvCoord[2])
const;
179 template <
typename REAL>
180 int convertCoordToSubFace(
bool normalized,
181 REAL
const uvCoord[2], REAL subFaceCoord[2])
const;
182 template <
typename REAL>
183 void convertSubFaceToCoord(
bool normalized,
int subFace,
184 REAL
const subFaceCoord[2], REAL uvCoord[2])
const;
189 unsigned short _faceSize;
200 template <
typename REAL>
206 int uTile = (int) uvCoord[0];
207 int vTile = (int) uvCoord[1];
208 return (vTile + ((uvCoord[1] - (REAL) vTile) > 0.75f)) * _uDim +
209 (uTile + ((uvCoord[0] - (REAL) uTile) > 0.75f));
213 template <
typename REAL>
216 REAL
const uvCoord[2], REAL subCoord[2])
const {
217 return convertCoordToSubFace<REAL>(
false, uvCoord, subCoord);
219 template <
typename REAL>
222 int subFace, REAL
const subCoord[2], REAL uvCoord[2])
const {
223 convertSubFaceToCoord<REAL>(
false, subFace, subCoord, uvCoord);
227 template <
typename REAL>
230 REAL
const uvCoord[2], REAL subCoord[2])
const {
231 return convertCoordToSubFace<REAL>(
true, uvCoord, subCoord);
233 template <
typename REAL>
236 int subFace, REAL
const subCoord[2], REAL uvCoord[2])
const {
237 convertSubFaceToCoord<REAL>(
true, subFace, subCoord, uvCoord);
243 using namespace OPENSUBDIV_VERSION;
Parameterization & operator=(Parameterization const &)=default
~Parameterization()=default
Parameterization()
Default construction produces an invalid instance.
void ConvertSubFaceToCoord(int subFace, REAL const subFaceCoord[2], REAL uvCoord[2]) const
Convert a sub-face and its local (u,v) coordinate to (u,v)
Simple class defining the 2D parameterization of a face.
bool IsValid() const
Returns true if correctly initialized.
bool HasSubFaces() const
Returns if Parameterization has been partitioned into sub-faces.
Partitioned into quadrilateral sub-faces.
int GetFaceSize() const
Returns the size (number of vertices) of the corresponding face.
int GetSubFace(REAL const uvCoord[2]) const
Returns the integer sub-face containing the given (u,v)
void GetCenterCoord(REAL uvCoord[2]) const
Returns the (u,v) coordinate for the center of the face.
SchemeType
Enumerated type for all subdivision schemes supported by OpenSubdiv.
Type GetType() const
Returns the type of parameterization assigned.
void GetVertexCoord(int vertexIndex, REAL uvCoord[2]) const
Returns the (u,v) coordinate of a given vertex.
int ConvertCoordToNormalizedSubFace(REAL const uvCoord[2], REAL subFaceCoord[2]) const
Convert (u,v) to a sub-face (return value) and its normalized (u,v) coordinate.
void GetEdgeCoord(int edgeIndex, REAL t, REAL uvCoord[2]) const
Returns the (u,v) coordinate at any point on a given edge.
Type
Enumerated type for the different kinds of Parameterizations.
void ConvertNormalizedSubFaceToCoord(int subFace, REAL const subFaceCoord[2], REAL uvCoord[2]) const
Convert a sub-face and its normalized (u,v) coordinate to (u,v)
int ConvertCoordToSubFace(REAL const uvCoord[2], REAL subFaceCoord[2]) const
Convert (u,v) to a sub-face (return value) and its local (u,v) coordinate.