| 161 | } |
| 162 | |
| 163 | static void cull_spheres(CullingSet &set, const Frustum &view_frustum, u32 offset, u32 count) |
| 164 | { |
| 165 | ENTER_PROFILE_SCOPE(__func__); |
| 166 | |
| 167 | const u32 num = offset + count; |
| 168 | for (u32 i = offset; i < num; ++i) { |
| 169 | Sphere &sphere_w = set.sphere_w[i]; |
| 170 | |
| 171 | u32 inside = UINT32_MAX; |
| 172 | for (u32 j = 0; j < 6; ++j) { |
| 173 | const Plane3 &plane = view_frustum.planes[j]; |
| 174 | |
| 175 | f32 n_dot_c = dot(plane.n, sphere_w.c); |
| 176 | inside &= u32(n_dot_c + sphere_w.r >= plane.d); |
| 177 | } |
| 178 | |
| 179 | set.visible[i] = inside; |
| 180 | } |
| 181 | |
| 182 | LEAVE_PROFILE_SCOPE(); |
| 183 | } |
| 184 | |
| 185 | static void cull_none(CullingSet &set) |
| 186 | { |