25 #ifndef OPENSUBDIV3_FAR_PATCH_PARAM_H
26 #define OPENSUBDIV3_FAR_PATCH_PARAM_H
28 #include "../version.h"
30 #include "../far/types.h"
33 namespace OPENSUBDIV_VERSION {
78 void Set(
Index faceid,
short u,
short v,
79 unsigned short depth,
bool nonquad ,
80 unsigned short boundary,
unsigned short transition );
90 unsigned short GetU()
const {
return (
unsigned short)((
field1 >> 22) & 0x3ff); }
94 unsigned short GetV()
const {
return (
unsigned short)((
field1 >> 12) & 0x3ff); }
117 void Normalize(
float & u,
float & v )
const;
130 unsigned short depth,
bool nonquad,
131 unsigned short boundary,
unsigned short transition ) {
132 field0 = (((
unsigned int)faceid) & 0xfffffff) |
133 ((transition & 0xf) << 28);
134 field1 = ((u & 0x3ff) << 22) |
135 ((v & 0x3ff) << 12) |
136 ((boundary & 0xf) << 8) |
137 ((nonquad ? 1:0) << 4) |
138 (nonquad ? depth+1 : depth);
144 return 1.0f / float( 1 << (
GetDepth()-1) );
146 return 1.0f / float( 1 <<
GetDepth() );
156 float pu = (float)
GetU()*frac;
157 float pv = (float)
GetV()*frac;
167 using namespace OPENSUBDIV_VERSION;
Local patch parameterization descriptor.
unsigned short GetTransition() const
Returns the transition edge encoding for the patch.
void Normalize(float &u, float &v) const
Vtr::Array< PatchParam > PatchParamArray
Index GetFaceId() const
Retuns the faceid.
void Set(Index faceid, short u, short v, unsigned short depth, bool nonquad, unsigned short boundary, unsigned short transition)
Sets the values of the bit fields.
void Clear()
Resets everything to 0.
std::vector< PatchParam > PatchParamTable
unsigned short GetDepth() const
Returns the level of subdivision of the patch.
bool NonQuadRoot() const
True if the parent coarse face is a non-quad.
unsigned short GetBoundary() const
Returns the boundary edge encoding for the patch.
Vtr::ConstArray< PatchParam > ConstPatchParamArray
float GetParamFraction() const
Returns the fraction of normalized parametric space covered by the sub-patch.
unsigned short GetU() const
Returns the log2 value of the u parameter at the top left corner of the patch.
unsigned short GetV() const
Returns the log2 value of the v parameter at the top left corner of the patch.