mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2025-01-11 17:10:08 +00:00
Fix another multi mesh splicing bug of face varying data.
Change FarPatchTables::Descriptor::begin() to take starting patch type so that we can use a desc iterator for uniform quads/tris as well.
This commit is contained in:
parent
3fe1d97342
commit
40dbbfd294
@ -531,14 +531,7 @@ FarMultiMeshFactory<T, U>::splicePatchTables(FarMeshVector const &meshes, bool h
|
||||
FarPatchTables::PTable::iterator dstIndexIt = result->_patches.begin();
|
||||
|
||||
// splice patches : iterate over all descriptors, including points, lines, quads, etc.
|
||||
// non-patches
|
||||
for (int type = FarPatchTables::POINTS; type <= FarPatchTables::LOOP; ++type) {
|
||||
dstIndexIt = splicePatch(FarPatchTables::Descriptor(type, 0, 0),
|
||||
meshes, result->_patchArrays, dstIndexIt, &voffset, &poffset, &qoffset, vertexOffsets);
|
||||
}
|
||||
|
||||
// patches
|
||||
for (Descriptor::iterator it=Descriptor::begin(); it!=Descriptor::end(); ++it) {
|
||||
for (Descriptor::iterator it=Descriptor::begin(Descriptor::ANY); it!=Descriptor::end(); ++it) {
|
||||
dstIndexIt = splicePatch(*it, meshes, result->_patchArrays, dstIndexIt, &voffset, &poffset, &qoffset, vertexOffsets);
|
||||
}
|
||||
|
||||
@ -577,8 +570,10 @@ FarMultiMeshFactory<T, U>::splicePatchTables(FarMeshVector const &meshes, bool h
|
||||
}
|
||||
|
||||
// merge ptexCoord table
|
||||
for (FarPatchTables::Descriptor::iterator it(FarPatchTables::Descriptor(FarPatchTables::POINTS, FarPatchTables::NON_TRANSITION, 0));
|
||||
for (FarPatchTables::Descriptor::iterator it =
|
||||
FarPatchTables::Descriptor::begin(FarPatchTables::Descriptor::ANY);
|
||||
it != FarPatchTables::Descriptor::end(); ++it) {
|
||||
|
||||
int ptexFaceOffset = 0;
|
||||
for (size_t i = 0; i < meshes.size(); ++i) {
|
||||
FarPatchTables const *ptables = meshes[i]->GetPatchTables();
|
||||
@ -595,9 +590,13 @@ FarMultiMeshFactory<T, U>::splicePatchTables(FarMeshVector const &meshes, bool h
|
||||
|
||||
// merge fvardata table
|
||||
if (hasFVarData) {
|
||||
|
||||
FarPatchTables::FVarDataTable::iterator FV_IT = result->_fvarTable.begin();
|
||||
for (FarPatchTables::Descriptor::iterator it(FarPatchTables::Descriptor(FarPatchTables::POINTS, FarPatchTables::NON_TRANSITION, 0));
|
||||
|
||||
for (FarPatchTables::Descriptor::iterator it =
|
||||
FarPatchTables::Descriptor::begin(FarPatchTables::Descriptor::ANY);
|
||||
it != FarPatchTables::Descriptor::end(); ++it) {
|
||||
|
||||
for (size_t i = 0; i < meshes.size(); ++i) {
|
||||
FarPatchTables const *ptables = meshes[i]->GetPatchTables();
|
||||
FarPatchTables::PatchArray const *parray = ptables->GetPatchArray(*it);
|
||||
|
@ -149,7 +149,14 @@ public:
|
||||
/// \brief Descriptor Iterator
|
||||
/// Iterates through the patches in the following preset order
|
||||
///
|
||||
/// Order:
|
||||
/// ANY order:
|
||||
/// POINTS
|
||||
/// LINES
|
||||
/// QUADS
|
||||
/// TRIANGLES
|
||||
/// LOOP
|
||||
///
|
||||
/// FEATURE_ADAPTIVE_CATMARK order:
|
||||
///
|
||||
/// NON_TRANSITION ( REGULAR
|
||||
/// BOUNDARY
|
||||
@ -170,8 +177,16 @@ public:
|
||||
///
|
||||
class iterator;
|
||||
|
||||
/// \brief Returns an iterator to the first type of patch (REGULAR NON_TRANSITION ROT0)
|
||||
static iterator begin();
|
||||
enum PrimType {
|
||||
ANY,
|
||||
FEATURE_ADAPTIVE_CATMARK,
|
||||
};
|
||||
|
||||
/// \brief Returns a patch type iterator
|
||||
/// @param type if type=ANY then the iterater points to type POINTS
|
||||
/// if type=FEATURE_ADAPTIVE_CATMARK then the iterator
|
||||
/// points to type NON_TRANSITION REGULAR
|
||||
static iterator begin(PrimType type);
|
||||
|
||||
/// \brief Returns an iterator to the end of the list of patch types (NON_PATCH)
|
||||
static iterator end();
|
||||
@ -504,7 +519,12 @@ FarPatchTables::Descriptor::GetAllValidDescriptors() {
|
||||
static std::vector<Descriptor> _descriptors;
|
||||
|
||||
if (_descriptors.empty()) {
|
||||
_descriptors.reserve(50);
|
||||
_descriptors.reserve(55);
|
||||
|
||||
// non-patch primitives
|
||||
for (int i=POINTS; i<=LOOP; ++i) {
|
||||
_descriptors.push_back( Descriptor(i, NON_TRANSITION, 0) );
|
||||
}
|
||||
|
||||
// non-transition patches
|
||||
for (int i=REGULAR; i<=GREGORY_BOUNDARY; ++i) {
|
||||
@ -532,8 +552,15 @@ FarPatchTables::Descriptor::GetAllValidDescriptors() {
|
||||
|
||||
// Returns an iterator to the first type of patch (REGULAR NON_TRANSITION ROT0)
|
||||
inline FarPatchTables::Descriptor::iterator
|
||||
FarPatchTables::Descriptor::begin() {
|
||||
FarPatchTables::Descriptor::begin(PrimType type) {
|
||||
switch (type) {
|
||||
case ANY:
|
||||
return iterator( Descriptor(POINTS, NON_TRANSITION, 0) );
|
||||
case FEATURE_ADAPTIVE_CATMARK:
|
||||
return iterator( Descriptor(REGULAR, NON_TRANSITION, 0) );
|
||||
default:
|
||||
return iterator( Descriptor() );
|
||||
}
|
||||
}
|
||||
|
||||
// Returns an iterator to the end of the list of patch types (NON_PATCH)
|
||||
|
@ -666,7 +666,9 @@ FarPatchTablesFactory<T>::Create( int maxlevel, int maxvalence, bool requireFVar
|
||||
int voffset=0, poffset=0, qoffset=0;
|
||||
|
||||
|
||||
for (Descriptor::iterator it=Descriptor::begin(); it!=Descriptor::end(); ++it) {
|
||||
for (Descriptor::iterator it=Descriptor::begin(Descriptor::FEATURE_ADAPTIVE_CATMARK);
|
||||
it!=Descriptor::end(); ++it) {
|
||||
|
||||
pushPatchArray( *it, parray, _patchCtr.getValue(*it), &voffset, &poffset, &qoffset );
|
||||
}
|
||||
|
||||
@ -685,7 +687,8 @@ FarPatchTablesFactory<T>::Create( int maxlevel, int maxvalence, bool requireFVar
|
||||
ParamPointers pptrs;
|
||||
FVarPointers fptrs;
|
||||
|
||||
for (Descriptor::iterator it=Descriptor::begin(); it!=Descriptor::end(); ++it) {
|
||||
for (Descriptor::iterator it=Descriptor::begin(Descriptor::FEATURE_ADAPTIVE_CATMARK);
|
||||
it!=Descriptor::end(); ++it) {
|
||||
|
||||
FarPatchTables::PatchArray * pa = result->findPatchArray(*it);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user