25 #ifndef FAR_PATCH_PARAM_H
26 #define FAR_PATCH_PARAM_H
28 #include "../version.h"
32 namespace OpenSubdiv {
33 namespace OPENSUBDIV_VERSION {
74 void Set(
short u,
short v,
unsigned char rots,
unsigned char depth,
bool nonquad ) {
78 ((nonquad ? 1:0) << 4) |
79 (nonquad ? depth+1 : depth);
84 unsigned short GetU()
const {
return (
unsigned short)((
field >> 17) & 0x3ff); }
88 unsigned short GetV()
const {
return (
unsigned short)((
field >> 7) & 0x3ff); }
109 void Normalize(
float & u,
float & v )
const;
118 void Rotate(
float & u,
float & v )
const;
136 void Set(
unsigned int faceid,
short u,
short v,
unsigned char rots,
unsigned char depth,
bool nonquad ) {
151 return 1.0f / float( 1 << (
GetDepth()-1) );
153 return 1.0f / float( 1 <<
GetDepth() );
160 float frac = GetParamFraction();
163 float pu = (float)GetU()*frac;
164 float pv = (float)GetV()*frac;
173 switch( GetRotation() ) {
175 case 1 : {
float tmp=v; v=1.0f-u; u=tmp; }
break;
176 case 2 : { u=1.0f-u; v=1.0f-v; }
break;
177 case 3 : {
float tmp=u; u=1.0f-v; v=tmp; }
break;
186 using namespace OPENSUBDIV_VERSION;
unsigned char GetDepth() const
Returns the level of subdivision of the patch.
unsigned char GetRotation() const
Returns the rotation of the patch (the number of CCW parameter winding)
void Clear()
Resets everything to 0.
void Rotate(float &u, float &v) const
Rotate (u,v) pair to compensate for transition pattern and boundary orientations. ...
void Set(short u, short v, unsigned char rots, unsigned char depth, bool nonquad)
Sets the values of the bit fields.
unsigned short GetV() const
Returns the log2 value of the v parameter at the top left corner of the patch.
bool NonQuadRoot() const
True if the parent coarse face is a non-quad.
void Normalize(float &u, float &v) const
void Clear()
Resets the values to 0.
Local patch parameterization descriptor.
unsigned short GetU() const
Returns the log2 value of the u parameter at the top left corner of the patch.
struct OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchParam::BitField bitField
float GetParamFraction() const
Returns the fratcion of normalized parametric space covered by the sub-patch.
void Set(unsigned int faceid, short u, short v, unsigned char rots, unsigned char depth, bool nonquad)
Sets the values of the bit fields.