MCPcopy Create free account
hub / github.com/ImageEngine/cortex / addIndex

Method addIndex

src/IECoreScene/MeshAlgoSplit.cpp:500–522  ·  view source on GitHub ↗

Add an index - if the indexed id is not yet part of the output ids, it will be included

Source from the content-addressed store, hash-verified

498
499 // Add an index - if the indexed id is not yet part of the output ids, it will be included
500 void addIndex( int id )
501 {
502 // Determine which block to use, and the index within that block
503 int blockId = id / m_blockSize;
504 int subIndex = id % m_blockSize;
505
506 auto &block = m_fromOldIds[ blockId ];
507
508 if( !block )
509 {
510 // Need to allocate the block for this index
511 block = std::make_unique< std::vector<int> >( m_blockSize, -1 );
512 }
513
514 // We initially record that this index is used just by marking it with a 0, against the background of -1.
515 // Once computeIndices is called, the 0 will be replaced with a new index, only counting indices that are
516 // used.
517 (*block)[ subIndex ] = 0;
518
519 m_newIndices.push_back( id );
520
521 m_indicesComputed = false;
522 }
523
524 // Don't add the index, but just test if it is a part of the reindex. If it is an
525 // id which has already been added, return the new id, otherwise return -1

Callers 2

operator()Method · 0.80
meshMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected