mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2025-01-12 01:20:07 +00:00
Add constructor to FarPatchTables. Add enums to FarPatchTables::Type.
This commit is contained in:
parent
8605c23ee1
commit
aa76d9c645
@ -184,9 +184,10 @@ MyEffect::BindDrawConfig(MyDrawConfig *config, OpenSubdiv::OsdDrawContext::Patch
|
||||
GLint diffuseColor = config->diffuseColorUniform;
|
||||
|
||||
if (displayPatchColor) {
|
||||
GLfloat patchColor[10][4] = {
|
||||
GLfloat patchColor[11][4] = {
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // NON_PATCH
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // POLYGON
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // POINTS
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // LINES
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // QUADS
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // TRIANGLES
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f }, // LOOP
|
||||
|
@ -1226,7 +1226,7 @@ display() {
|
||||
*/
|
||||
|
||||
// patch drawing
|
||||
int patchCount[10][6][4]; // [Type][Pattern][Rotation] (see far/patchTables.h)
|
||||
int patchCount[11][6][4]; // [Type][Pattern][Rotation] (see far/patchTables.h)
|
||||
memset(patchCount, 0, sizeof(patchCount));
|
||||
|
||||
// primitive counting
|
||||
|
@ -178,7 +178,7 @@ FarMultiMeshFactory<T, U>::Create(std::vector<FarMesh<U> const *> const &meshes)
|
||||
result->_vertexEditTables = spliceVertexEditTables(result, meshes);
|
||||
|
||||
// count total num vertices, numptex faces
|
||||
int numVertices = 0, numPtexFaces;
|
||||
int numVertices = 0, numPtexFaces = 0;
|
||||
for (size_t i = 0; i < meshes.size(); ++i) {
|
||||
numVertices += meshes[i]->GetNumVertices();
|
||||
numPtexFaces += meshes[i]->GetNumPtexFaces();
|
||||
@ -640,7 +640,7 @@ FarMultiMeshFactory<T, U>::splicePatchTables(FarMeshVector const &meshes) {
|
||||
if (not parray) continue;
|
||||
|
||||
copyWithPtexFaceOffset(std::back_inserter(result->_paramTable),
|
||||
result->_paramTable,
|
||||
ptables->_paramTable,
|
||||
parray->GetPatchIndex(),
|
||||
parray->GetNumPatches(), ptexFaceOffset);
|
||||
|
||||
|
@ -86,7 +86,8 @@ public:
|
||||
enum Type {
|
||||
NON_PATCH = 0, // undefined
|
||||
|
||||
POLYGONS, // general polygon mesh
|
||||
POINTS, // points (useful for cage drawing)
|
||||
LINES, // lines (useful for cage drawing)
|
||||
|
||||
QUADS, // bilinear quads-only patches
|
||||
TRIANGLES, // bilinear triangles-only mesh
|
||||
@ -341,6 +342,31 @@ public:
|
||||
serialIndex; // Serialized Index of the patch
|
||||
};
|
||||
|
||||
|
||||
/// Constructor
|
||||
///
|
||||
/// @param patchArrays Vector of descriptors and ranges for arrays of patches
|
||||
///
|
||||
/// @param indices Indices of the control vertices of the patches
|
||||
///
|
||||
/// @param vertexValences Vertex valance table
|
||||
///
|
||||
/// @param quadOffsets Quad offset table
|
||||
///
|
||||
/// @param ptexCoords Ptex coordinate table
|
||||
///
|
||||
/// @param fvarData Face varying data table
|
||||
///
|
||||
/// @param maxValence Highest vertex valence allowed in the mesh
|
||||
///
|
||||
FarPatchTables(PatchArrayVector const & patchArrays,
|
||||
PTable const & patches,
|
||||
VertexValenceTable const * vertexValences,
|
||||
QuadOffsetTable const * quadOffsets,
|
||||
PatchParamTable const * patchParams,
|
||||
FVarDataTable const * fvarData,
|
||||
int maxValence);
|
||||
|
||||
/// Get the table of patch control vertices
|
||||
PTable const & GetPatchTable() const { return _patches; }
|
||||
|
||||
@ -442,6 +468,30 @@ private:
|
||||
int _maxValence;
|
||||
};
|
||||
|
||||
// Constructor
|
||||
inline
|
||||
FarPatchTables::FarPatchTables(PatchArrayVector const & patchArrays,
|
||||
PTable const & patches,
|
||||
VertexValenceTable const * vertexValences,
|
||||
QuadOffsetTable const * quadOffsets,
|
||||
PatchParamTable const * patchParams,
|
||||
FVarDataTable const * fvarData,
|
||||
int maxValence) :
|
||||
_patchArrays(patchArrays),
|
||||
_patches(patches),
|
||||
_maxValence(maxValence) {
|
||||
|
||||
// copy other tables if exist
|
||||
if (vertexValences)
|
||||
_vertexValenceTable = *vertexValences;
|
||||
if (quadOffsets)
|
||||
_quadOffsetTable = *quadOffsets;
|
||||
if (patchParams)
|
||||
_paramTable = *patchParams;
|
||||
if (fvarData)
|
||||
_fvarTable = *fvarData;
|
||||
}
|
||||
|
||||
inline bool
|
||||
FarPatchTables::IsFeatureAdaptive() const {
|
||||
return ((not _vertexValenceTable.empty()) and (not _quadOffsetTable.empty()));
|
||||
@ -458,6 +508,8 @@ FarPatchTables::Descriptor::GetNumControlVertices( FarPatchTables::Type type ) {
|
||||
case BOUNDARY : return FarPatchTables::GetBoundaryPatchRingsize();
|
||||
case CORNER : return FarPatchTables::GetCornerPatchRingsize();
|
||||
case TRIANGLES : return 3;
|
||||
case LINES : return 2;
|
||||
case POINTS : return 1;
|
||||
default : return -1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user