8#ifndef OPENSUBDIV3_BFR_PARAMETERIZATION_H
9#define OPENSUBDIV3_BFR_PARAMETERIZATION_H
11#include "../version.h"
16namespace OPENSUBDIV_VERSION {
64 bool IsValid()
const {
return (_faceSize > 0); }
101 template <
typename REAL>
105 template <
typename REAL>
109 template <
typename REAL>
135 template <
typename REAL>
140 template <
typename REAL>
142 REAL
const uvCoord[2], REAL subFaceCoord[2])
const;
145 template <
typename REAL>
147 REAL
const subFaceCoord[2], REAL uvCoord[2])
const;
151 template <
typename REAL>
153 REAL
const uvCoord[2], REAL subFaceCoord[2])
const;
156 template <
typename REAL>
158 REAL
const subFaceCoord[2], REAL uvCoord[2])
const;
162 template <
typename REAL>
163 int convertCoordToSubFace(
bool normalized,
164 REAL
const uvCoord[2], REAL subFaceCoord[2])
const;
165 template <
typename REAL>
166 void convertSubFaceToCoord(
bool normalized,
int subFace,
167 REAL
const subFaceCoord[2], REAL uvCoord[2])
const;
172 unsigned short _faceSize;
183template <
typename REAL>
189 int uTile = (int) uvCoord[0];
190 int vTile = (int) uvCoord[1];
191 return (vTile + ((uvCoord[1] - (REAL) vTile) > 0.75f)) * _uDim +
192 (uTile + ((uvCoord[0] - (REAL) uTile) > 0.75f));
196template <
typename REAL>
199 REAL
const uvCoord[2], REAL subCoord[2])
const {
200 return convertCoordToSubFace<REAL>(
false, uvCoord, subCoord);
202template <
typename REAL>
205 int subFace, REAL
const subCoord[2], REAL uvCoord[2])
const {
206 convertSubFaceToCoord<REAL>(
false, subFace, subCoord, uvCoord);
210template <
typename REAL>
213 REAL
const uvCoord[2], REAL subCoord[2])
const {
214 return convertCoordToSubFace<REAL>(
true, uvCoord, subCoord);
216template <
typename REAL>
219 int subFace, REAL
const subCoord[2], REAL uvCoord[2])
const {
220 convertSubFaceToCoord<REAL>(
true, subFace, subCoord, uvCoord);
226using namespace OPENSUBDIV_VERSION;
SchemeType
Enumerated type for all subdivision schemes supported by OpenSubdiv.
Simple class defining the 2D parameterization of a face.
int GetSubFace(REAL const uvCoord[2]) const
Returns the integer sub-face containing the given (u,v)
int GetFaceSize() const
Returns the size (number of vertices) of the corresponding face.
Type
Enumerated type for the different kinds of Parameterizations.
@ QUAD_SUBFACES
Partitioned into quadrilateral sub-faces.
Parameterization(Sdc::SchemeType scheme, int faceSize)
Primary constructor with subdivision scheme and face size.
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.
void GetCenterCoord(REAL uvCoord[2]) const
Returns the (u,v) coordinate for the center of the face.
Type GetType() const
Returns the type of parameterization assigned.
~Parameterization()=default
Parameterization(Parameterization const &)=default
void GetEdgeCoord(int edgeIndex, REAL t, REAL uvCoord[2]) const
Returns the (u,v) coordinate at any point on a given edge.
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)
void GetVertexCoord(int vertexIndex, REAL uvCoord[2]) const
Returns the (u,v) coordinate of a given vertex.
Parameterization()
Default construction produces an invalid instance.
bool IsValid() const
Returns true if correctly initialized.
bool HasSubFaces() const
Returns if Parameterization has been partitioned into sub-faces.
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 ConvertSubFaceToCoord(int subFace, REAL const subFaceCoord[2], REAL uvCoord[2]) const
Convert a sub-face and its local (u,v) coordinate to (u,v)
Parameterization & operator=(Parameterization const &)=default