Skip to content

Commit 3ea5e6a

Browse files
Hacking
1 parent 92bee1a commit 3ea5e6a

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

src/IECoreScene/MeshAlgoSplit.cpp

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ void initializeFaceToSegments(
335335

336336
IECoreScene::MeshAlgo::MeshSplitter::MeshSplitter( ConstMeshPrimitivePtr mesh, const PrimitiveVariable &segmentPrimitiveVariable, const IECore::Canceller *canceller ) : m_mesh( mesh ), m_segmentPrimitiveVariable( segmentPrimitiveVariable )
337337
{
338+
throw IECore::Exception( "Hello world" );
338339
if( segmentPrimitiveVariable.interpolation != IECoreScene::PrimitiveVariable::Interpolation::Uniform )
339340
{
340341
throw IECore::Exception( "Primitive variable passed to MeshSplitter must be uniform." );
@@ -596,6 +597,13 @@ class Reindexer
596597
}
597598
}
598599
}
600+
601+
std::string message;
602+
for( int i = 0; i < (int)dataRemap.size(); i++ )
603+
{
604+
message += std::to_string( dataRemap[ i ] ) + " ";
605+
}
606+
throw IECore::Exception( "DEBUG: " + message );
599607
}
600608

601609
private:
@@ -611,6 +619,11 @@ class Reindexer
611619

612620
m_indicesComputed = true;
613621

622+
std::cout << "COMPUTE INDICES\n";
623+
624+
625+
m_numIdsUsed = 0;
626+
614627
for( unsigned int blockId = 0; blockId < m_fromOldIds.size(); blockId++ )
615628
{
616629
auto &block = m_fromOldIds[ blockId ];
@@ -629,13 +642,55 @@ class Reindexer
629642
}
630643
}
631644

645+
632646
for( int &id : m_newIndices )
633647
{
634648
int blockId = id / m_blockSize;
635649
int subIndex = id % m_blockSize;
636650

651+
std::cout << id << " : " << (*m_fromOldIds[ blockId ])[subIndex] << "\n";
637652
id = (*m_fromOldIds[ blockId ])[subIndex];
653+
654+
}
655+
656+
std::cout << "DONE COMPUTE INDICES\n";
657+
658+
659+
std::vector<int> debugIds;
660+
661+
for( unsigned int blockId = 0; blockId < m_fromOldIds.size(); blockId++ )
662+
{
663+
auto &block = m_fromOldIds[ blockId ];
664+
if( !block )
665+
{
666+
continue;
667+
}
668+
669+
for( int i = 0; i < m_blockSize; i++ )
670+
{
671+
if( (*block)[i] != -1 )
672+
{
673+
debugIds.push_back( (*block)[i] );
674+
}
675+
}
676+
}
677+
678+
bool failed = false;
679+
for( int i = 0; i < (int)debugIds.size(); i++ )
680+
{
681+
failed |= debugIds[i] != i;
638682
}
683+
684+
if( failed )
685+
{
686+
std::string message;
687+
for( int i = 0; i < (int)debugIds.size(); i++ )
688+
{
689+
message += std::to_string( debugIds[ i ] ) + " ";
690+
}
691+
throw IECore::Exception( "BAD IDS " + message );
692+
}
693+
639694
}
640695

641696
// IntVectorData to hold the new indices
@@ -868,6 +923,24 @@ MeshPrimitivePtr IECoreScene::MeshAlgo::MeshSplitter::mesh( int segmentId, const
868923
std::vector<int> vertRemapBackwards;
869924
vertReindexer.getDataRemapping( vertRemapBackwards );
870925

926+
bool failure = false;
927+
for( int i = startIndex; i < endIndex; i++ )
928+
{
929+
int originalFaceIndex = m_faceRemap[i];
930+
int faceVerts = sourceVerticesPerFace[ originalFaceIndex ];
931+
int faceStart = m_faceIndices[ originalFaceIndex ];
932+
for( int j = 0; j < faceVerts; j++ )
933+
{
934+
int q = sourceVertexIds[ faceStart + j ];
935+
failure |= vertRemapBackwards[ vertReindexer.testIndex( q ) ] != q;
936+
}
937+
}
938+
939+
if( failure )
940+
{
941+
throw IECore::Exception( "detected" );
942+
}
943+
871944
MeshPrimitivePtr ret = new MeshPrimitive( verticesPerFaceData, vertReindexer.getNewIndices(), m_mesh->interpolation() );
872945

873946
// In order to remap the corners, we test every vertex in the original corner list, and see if it is

0 commit comments

Comments
 (0)