| 142 | } |
| 143 | |
| 144 | static void update(CullingSet &set, CullableType::Enum type, u32 object_id, const Sphere &sphere, const Matrix4x4 &world) |
| 145 | { |
| 146 | u32 i; |
| 147 | u32 num_objects = array::size(set.id); |
| 148 | for (i = 0; i < num_objects; ++i) { |
| 149 | if (set.id[i] == object_id && set.type[i] == type) |
| 150 | break; |
| 151 | } |
| 152 | if (i == num_objects) { |
| 153 | // Not found, add it. |
| 154 | add(set, { world, sphere, object_id, type }); |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | Sphere sw; |
| 159 | sphere::transform(sw, sphere, world); |
| 160 | set.sphere_w[i] = sw; |
| 161 | } |
| 162 | |
| 163 | static void cull_spheres(CullingSet &set, const Frustum &view_frustum, u32 offset, u32 count) |
| 164 | { |
no test coverage detected