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

Method findCameraLookingFaces

source/MRViewer/MRViewport.cpp:435–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

433}
434
435FaceBitSet Viewport::findCameraLookingFaces( const Mesh& mesh, const AffineXf3f& meshToWorld ) const
436{
437 const auto normals = computePerFaceNormals( mesh );
438 FaceBitSet faces;
439 faces.resize( normals.size() );
440
441 const auto cameraPos = getCameraPoint();
442
443 BitSetParallelFor( mesh.topology.getValidFaces(), [&]( FaceId f )
444 {
445 auto transformedNormal = meshToWorld.A * normals[f];
446 if ( params_.orthographic )
447 {
448 if ( ( dot( transformedNormal, cameraPos ) > 0.0f ) )
449 faces.set( f );
450 }
451 else
452 {
453 if ( dot( transformedNormal, cameraPos - mesh.triCenter( f ) ) > 0.0f )
454 faces.set( f );
455 }
456 } );
457 return faces;
458}
459
460ConstObjAndPick Viewport::const_pick_render_object() const
461{

Callers

nothing calls this directly

Calls 7

computePerFaceNormalsFunction · 0.85
BitSetParallelForFunction · 0.85
triCenterMethod · 0.80
dotFunction · 0.70
resizeMethod · 0.45
sizeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected