ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/spec_rgb.c
(Generate patch)

Comparing ray/src/common/spec_rgb.c (file contents):
Revision 2.31 by greg, Fri Dec 8 18:48:09 2023 UTC vs.
Revision 2.32 by greg, Wed Jan 17 17:36:20 2024 UTC

# Line 12 | Line 12 | static const char      RCSid[] = "$Id$";
12  
13   #include <stdio.h>
14   #include <string.h>
15 + #include <math.h>
16   #include "color.h"
17  
18   #define CEPS    1e-4                    /* color epsilon */
# Line 405 | Line 406 | scolor_melanopic(              /* compute melanopic integral for s
406   )
407   {
408          return(scolor2melanopic(scol, NCSAMP, WLPART));
409 + }
410 +
411 +
412 + void
413 + convertscolorcol(               /* any uniform spectrum to working */
414 +        SCOLOR rcol,
415 +        const COLORV src[],
416 +        int snc,
417 +        double swl0,
418 +        double swl1
419 + )
420 + {
421 +        if (NCSAMP > 3) {               /* spectrum -> spectrum */
422 +                convertscolor(rcol, NCSAMP, WLPART[0], WLPART[3],
423 +                                src, snc, swl0, swl1);
424 +        } else if ((snc <= MAXCSAMP) & (swl0 > swl1)) {
425 +                float   wlpt[4];        /* no intermediate conversion needed */
426 +                wlpt[0] = swl0; wlpt[3] = swl1;
427 +                wlpt[1] = WLPART[1]; wlpt[2] = WLPART[2];
428 +                scolor2rgb(rcol, (COLORV *)src, snc, wlpt);
429 +        } else {
430 +                SCOLOR  dcol;           /* else convert spectrum first */
431 +                int     dnc = snc*(WLPART[0] - WLPART[3])/fabs(swl0 - swl1) + .99;
432 +                if (dnc > MAXCSAMP) dnc = MAXCSAMP;
433 +                convertscolor(dcol, dnc, WLPART[0], WLPART[3], src, snc, swl0, swl1);
434 +                scolor2rgb(rcol, dcol, dnc, WLPART);
435 +        }
436   }
437  
438  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines