Check if a sphere is visible
| 637 | |
| 638 | // Check if a sphere is visible |
| 639 | int Camera::checkSphereInFrustum(vec3 where, float radius) const { |
| 640 | int sphere_in_frustum = 2; |
| 641 | for (auto frustumPlane : frustumPlanes) { |
| 642 | float d = |
| 643 | frustumPlane[0] * where.x() + |
| 644 | frustumPlane[1] * where.y() + |
| 645 | frustumPlane[2] * where.z() + |
| 646 | frustumPlane[3]; |
| 647 | if (d <= -radius) { |
| 648 | return 0; // Sphere is entirely outside one of the frustum planes |
| 649 | } else if (d < radius) { |
| 650 | sphere_in_frustum = 1; // Sphere is intersecting a frustum plane |
| 651 | } |
| 652 | } |
| 653 | return sphere_in_frustum; |
| 654 | } |
| 655 | |
| 656 | #if defined(USE_SSE) |
| 657 | static __m128 simd_dot_product(__m128 x1, __m128 y1, __m128 z1, __m128 x2, __m128 y2, __m128 z2) { |
no test coverage detected