| 356 | extern void AddSpectra(spectra *dest, spectra *a, spectra *b); |
| 357 | |
| 358 | void NormalizeExitance() { |
| 359 | int i, t; |
| 360 | float rmax = 0.0f; |
| 361 | |
| 362 | for (i = 0; i < rad_NumSurfaces; i++) { |
| 363 | rad_surface *surf = &rad_Surfaces[i]; |
| 364 | spectra *emit = &surf->emittance; |
| 365 | |
| 366 | for (t = 0; t < surf->xresolution * surf->yresolution; t++) { |
| 367 | rad_element *ep = &surf->elements[t]; |
| 368 | |
| 369 | if (ep->flags & EF_IGNORE) |
| 370 | continue; |
| 371 | |
| 372 | if (Shoot_from_patch) { |
| 373 | ep->exitance.r += emit->r; |
| 374 | ep->exitance.g += emit->g; |
| 375 | ep->exitance.b += emit->b; |
| 376 | } |
| 377 | |
| 378 | /* if (ep->exitance.r>1) |
| 379 | ep->exitance.r=1; |
| 380 | if (ep->exitance.g>1) |
| 381 | ep->exitance.g=1; |
| 382 | if (ep->exitance.b>1) |
| 383 | ep->exitance.b=1;*/ |
| 384 | |
| 385 | rmax = GetMaxColor(&ep->exitance); |
| 386 | |
| 387 | if (rmax > 1.0 && rmax > 0.0) { |
| 388 | ep->exitance.r /= rmax; |
| 389 | ep->exitance.g /= rmax; |
| 390 | ep->exitance.b /= rmax; |
| 391 | } |
| 392 | } |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | // Shuts down the radiosity stuff, freeing memory, etc |
| 397 | void CloseRadiosityRun() { |
no test coverage detected