| 433 | } |
| 434 | |
| 435 | FaceBitSet 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 | |
| 460 | ConstObjAndPick Viewport::const_pick_render_object() const |
| 461 | { |
nothing calls this directly
no test coverage detected