25 #ifndef OSD_DRAW_CONTEXT_H
26 #define OSD_DRAW_CONTEXT_H
28 #include "../version.h"
30 #include "../far/patchTables.h"
35 namespace OpenSubdiv {
36 namespace OPENSUBDIV_VERSION {
75 unsigned char subPatch,
unsigned char numElements) :
76 _farDesc(farDesc), _maxValence(maxValence), _subPatch(subPatch), _numElements(numElements) { }
117 _numElements = (
unsigned char)numElements;
128 unsigned char _maxValence;
129 unsigned char _subPatch;
130 unsigned char _numElements;
143 _desc(desc), _range(range) { }
219 int maxValence,
int numElements);
239 return _farDesc < other._farDesc or (_farDesc == other._farDesc and
240 (_subPatch < other._subPatch or ((_subPatch == other._subPatch) and
241 (_maxValence < other._maxValence or ((_maxValence == other._maxValence) and
242 (_numElements < other._numElements))))));
249 return _farDesc == other._farDesc and
250 _subPatch == other._subPatch and
251 _maxValence == other._maxValence and
252 _numElements == other._numElements;
260 using namespace OPENSUBDIV_VERSION;
bool operator<(PatchDescriptor const other) const
Allows ordering of patches by type.
unsigned char GetRotation() const
Returns the rotation of the patch (4 rotations)
TransitionPattern GetPattern() const
Returns the transition pattern of the patch if any (5 types)
virtual ~DrawContext()
Descrtuctor.
Container for patch vertex indices tables.
Describes the range of patches in a PatchArray.
int GetNumElements() const
Returns the number of vertex elements.
PatchArrayVector _patchArrays
PatchArrayVector const & GetPatchArrays() const
static void ConvertPatchArrays(Far::PatchTables::PatchArrayVector const &farPatchArrays, DrawContext::PatchArrayVector &osdPatchArrays, int maxValence, int numElements)
Far::PatchTables::Type GetType() const
Returns the type of the patch.
Describes the type of a patch.
void SetDescriptor(PatchDescriptor desc)
Update a patch descriptor.
Far::PatchTables::TransitionPattern GetPattern() const
Returns the transition pattern of the patch if any (5 types)
std::vector< float > FVarData
static short GetNumControlVertices(Type t)
Returns the number of control vertices expected for a patch of the type described.
unsigned int GetPatchIndex() const
unsigned int quadOffsetIndex
std::vector< PatchArray > PatchArrayVector
int GetNumControlVertices() const
unsigned int GetVertIndex() const
int GetSubPatch() const
Returns the subpatch id.
unsigned int GetQuadOffsetIndex() const
Returns the offset of quad offset table.
PatchDescriptor(Far::PatchTables::Descriptor farDesc, unsigned char maxValence, unsigned char subPatch, unsigned char numElements)
void SetNumPatches(int npatches)
Set num patches (used at batch glomming)
PatchArray(PatchDescriptor desc, Far::PatchTables::PatchArray::ArrayRange const &range)
Far::PatchTables::PatchArray::ArrayRange const & GetArrayRange() const
Returns a array range struct.
std::vector< PatchArray > PatchArrayVector
void SetNumElements(int numElements)
Set the number of vertex elements.
unsigned char GetRotation() const
Returns the rotation of the patch (4 rotations)
DrawContext()
Constructor.
unsigned int GetNumPatches() const
Returns the number of patches in the array.
static void packFVarData(Far::PatchTables const &patchTables, int fvarWidth, FVarData const &src, FVarData &dst)
bool operator==(PatchDescriptor const other) const
True if the descriptors are identical.
PatchDescriptor GetDescriptor() const
Returns a patch descriptor defining the type of patches in the array.
Type GetType() const
Returns the type of the patch.
unsigned int GetNumIndices() const
Returns the number of patch indices in the array.
int GetMaxValence() const
Returns the max valence.