MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / loadValidIndicesBuffer_

Method loadValidIndicesBuffer_

source/MRViewer/MRRenderPointsObject.cpp:364–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364RenderBufferRef<VertId> RenderPointsObject::loadValidIndicesBuffer_()
365{
366 auto& glBuffer = GLStaticHolder::getStaticGLBuffer();
367 if ( !( dirty_ & DIRTY_POSITION ) || !objPoints_->hasVisualRepresentation() )
368 return glBuffer.prepareBuffer<VertId>( validIndicesSize_, !validIndicesBuffer_.valid() );
369
370 const auto& points = objPoints_->pointCloud();
371 const auto step = objPoints_->getRenderDiscretization();
372 const auto num = objPoints_->pointCloud()->validPoints.find_last() + 1;
373
374 const auto& validPoints = points->validPoints;
375 auto firstValid = validPoints.find_first();
376 assert( firstValid );
377
378 validIndicesSize_ = ( num / step );
379 if ( step != 1 )
380 {
381 firstValid = {};
382 for ( VertId v = VertId( (firstValid / step)*step ); v < step * validIndicesSize_; v += step )
383 {
384 if ( validPoints.test( v ) )
385 {
386 firstValid = v;
387 break;
388 }
389 }
390
391 if ( !firstValid.valid() )
392 {
393 validIndicesSize_ = 0;
394 return glBuffer.prepareBuffer<VertId>( 0 );
395 }
396 }
397
398 auto buffer = glBuffer.prepareBuffer<VertId>( validIndicesSize_ );
399
400 BitSetParallelForAll( validPoints, [&] ( VertId v )
401 {
402 if ( v % step != 0 || v >= step * validIndicesSize_ )
403 return;
404
405 if ( validPoints.test( v ) )
406 {
407 buffer[v / step] = VertId( v / step );
408 }
409 else
410 {
411 buffer[v / step] = VertId( firstValid / step );
412 }
413 });
414
415 return buffer;
416}
417
418RenderBufferRef<unsigned> RenderPointsObject::loadVertSelectionTextureBuffer_()
419{

Callers

nothing calls this directly

Calls 6

BitSetParallelForAllFunction · 0.85
validMethod · 0.45
find_lastMethod · 0.45
find_firstMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected