Find the surface we want to shoot from
| 235 | |
| 236 | // Find the surface we want to shoot from |
| 237 | void UpdateUnsentValues() { |
| 238 | float cur_unsent; |
| 239 | float max_unsent = 0.0f; |
| 240 | float sat_max_unsent = 0.0f; |
| 241 | int use_sat = 0; |
| 242 | int i; |
| 243 | rad_surface *sat_surface; |
| 244 | |
| 245 | static int last_report_time = -10; |
| 246 | |
| 247 | rad_TotalUnsent = 0.0f; |
| 248 | rad_MaxSurface = NULL; |
| 249 | |
| 250 | // Go through all the surfaces searching for the surface with the greatest |
| 251 | // exitance yet to be shot |
| 252 | |
| 253 | for (i = 0; i < rad_NumSurfaces; i++) { |
| 254 | rad_surface *surf = &rad_Surfaces[i]; |
| 255 | cur_unsent = GetUnsentFlux(surf); |
| 256 | rad_TotalUnsent += cur_unsent; |
| 257 | |
| 258 | if (cur_unsent > max_unsent) { |
| 259 | max_unsent = cur_unsent; |
| 260 | rad_MaxSurface = surf; |
| 261 | } |
| 262 | |
| 263 | // Always give satellites priority |
| 264 | if (surf->surface_type == ST_SATELLITE && cur_unsent > 0) { |
| 265 | if (cur_unsent > sat_max_unsent) { |
| 266 | use_sat = 1; |
| 267 | sat_max_unsent = cur_unsent; |
| 268 | sat_surface = surf; |
| 269 | } |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | // Update convergence |
| 274 | if (rad_TotalFlux > .0001) |
| 275 | rad_Convergence = fabs(rad_TotalUnsent) / rad_TotalFlux; |
| 276 | else |
| 277 | rad_Convergence = 0.0; |
| 278 | |
| 279 | mprintf_at(2, 3, 0, "Left=%f ", rad_Convergence); |
| 280 | |
| 281 | if (timer_GetTime() - last_report_time > 10.0) { |
| 282 | mprintf(0, "Percentage left=%f\n", rad_Convergence); |
| 283 | last_report_time = timer_GetTime(); |
| 284 | } |
| 285 | |
| 286 | if (use_sat) |
| 287 | rad_MaxSurface = sat_surface; |
| 288 | |
| 289 | if (!use_sat && Shoot_method == SM_SWITCH_AFTER_SATELLITES) { |
| 290 | SetupFormFactors(); |
| 291 | InitHemicube(Hemicube_resolution); |
| 292 | Shoot_method = SM_HEMICUBE; |
| 293 | } |
| 294 |
no test coverage detected