25#ifndef OPENSUBDIV3_BFR_PARAMETERIZATION_H
26#define OPENSUBDIV3_BFR_PARAMETERIZATION_H
28#include "../version.h"
30#include "../sdc/types.h"
33namespace OPENSUBDIV_VERSION {
81 bool IsValid()
const {
return (_faceSize > 0); }
118 template <
typename REAL>
122 template <
typename REAL>
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;
200template <
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));
213template <
typename REAL>
216 REAL
const uvCoord[2], REAL subCoord[2])
const {
217 return convertCoordToSubFace<REAL>(
false, uvCoord, subCoord);
219template <
typename REAL>
222 int subFace, REAL
const subCoord[2], REAL uvCoord[2])
const {
223 convertSubFaceToCoord<REAL>(
false, subFace, subCoord, uvCoord);
227template <
typename REAL>
230 REAL
const uvCoord[2], REAL subCoord[2])
const {
231 return convertCoordToSubFace<REAL>(
true, uvCoord, subCoord);
233template <
typename REAL>
236 int subFace, REAL
const subCoord[2], REAL uvCoord[2])
const {
237 convertSubFaceToCoord<REAL>(
true, subFace, subCoord, uvCoord);
243using 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