| 281 | } |
| 282 | |
| 283 | void appendGPUVisibleFaces( const Viewport& viewport, const BitSet& pixBs, |
| 284 | const std::vector<std::shared_ptr<ObjectMesh>>& objects, |
| 285 | std::vector<FaceBitSet>& visibleFaces, bool includeBackfaces /*= true */ ) |
| 286 | { |
| 287 | const auto orthoBackwards = viewport.getBackwardDirection(); |
| 288 | auto gpuPickerVisibleFaces = viewport.findVisibleFaces( pixBs ); |
| 289 | for ( int i = 0; i < objects.size(); ++i ) |
| 290 | { |
| 291 | const auto& selMesh = objects[i]; |
| 292 | auto it = gpuPickerVisibleFaces.find( selMesh ); |
| 293 | if ( it == gpuPickerVisibleFaces.end() ) |
| 294 | continue; |
| 295 | if ( !includeBackfaces ) |
| 296 | { |
| 297 | const auto xf = selMesh->worldXf(); |
| 298 | BitSetParallelFor( it->second, [&] ( FaceId f ) |
| 299 | { |
| 300 | auto n = selMesh->mesh()->dirDblArea( f ); |
| 301 | Vector3f cameraDir; |
| 302 | if ( viewport.getParameters().orthographic ) |
| 303 | cameraDir = orthoBackwards; |
| 304 | else |
| 305 | cameraDir = -viewport.unprojectPixelRay( to2dim( viewport.projectToViewportSpace( selMesh->mesh()->triCenter( f ) ) ) ).d; |
| 306 | if ( dot( xf.A * n, cameraDir ) < 0 ) |
| 307 | it->second.set( f, false ); |
| 308 | } ); |
| 309 | } |
| 310 | visibleFaces[i] |= it->second; |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | VertBitSet findVertsInViewportArea( const Viewport& viewport, const BitSet& pixBs, const ObjectPoints& obj, |
| 315 | bool includeBackfaces /*= true */, bool onlyVisible /*= false */ ) |
nothing calls this directly
no test coverage detected