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

Comparing ray/src/rt/pmapdump.c (file contents):
Revision 2.11 by greg, Thu Aug 2 18:33:49 2018 UTC vs.
Revision 2.12 by rschregle, Wed Nov 21 19:30:59 2018 UTC

# Line 42 | Line 42 | typedef struct {
42     char *mat, *obj;
43   } RadianceDef;
44  
45  
45  
47 /* Colour code is as follows:    global         = blue
48                                 precomp global = cyan
49                                 caustic        = red
50                                 volume         = green
51                                 direct         = magenta
52                                 contrib        = yellow */  
46   const RadianceDef radDefs [] = {
47 <   {  "void plastic mat.global\n0\n0\n5 0 0 1 0 0\n",
47 >   {  "void plastic mat.global\n0\n0\n5 %f %f %f 0 0\n",
48        "mat.global sphere obj.global\n0\n0\n4 %g %g %g %g\n"
49     },
50 <   {  "void plastic mat.pglobal\n0\n0\n5 0 1 1 0 0\n",
50 >   {  "void plastic mat.pglobal\n0\n0\n5 %f %f %f 0 0\n",
51        "mat.pglobal sphere obj.global\n0\n0\n4 %g %g %g %g\n"
52     },
53 <   {  "void plastic mat.caustic\n0\n0\n5 1 0 0 0 0\n",
53 >   {  "void plastic mat.caustic\n0\n0\n5 %f %f %f 0 0\n",
54        "mat.caustic sphere obj.caustic\n0\n0\n4 %g %g %g %g\n"
55     },
56 <   {  "void plastic mat.volume\n0\n0\n5 0 1 0 0 0\n",
56 >   {  "void plastic mat.volume\n0\n0\n5 %f %f %f 0 0\n",
57        "mat.volume sphere obj.volume\n0\n0\n4 %g %g %g %g\n"
58     },
59 <   {  "void plastic mat.direct\n0\n0\n5 1 0 1 0 0\n",
59 >   {  "void plastic mat.direct\n0\n0\n5 %f %f %f 0 0\n",
60        "mat.direct sphere obj.direct\n0\n0\n4 %g %g %g %g\n"
61     },
62 <   {  "void plastic mat.contrib\n0\n0\n5 1 1 0 0 0\n",
62 >   {  "void plastic mat.contrib\n0\n0\n5 %f %f %f 0 0\n",
63        "mat.contrib sphere obj.contrib\n0\n0\n4 %g %g %g %g\n"
64     }
65   };
66  
67 + /* Default colour codes are as follows:   global         = blue
68 +                                          precomp global = cyan
69 +                                          caustic        = red
70 +                                          volume         = green
71 +                                          direct         = magenta
72 +                                          contrib        = yellow */
73 + const COLOR colDefs [] = {
74 +   {0, 0, 1}, {0, 1, 1}, {1, 0, 0}, {0, 1, 0}, {1, 0, 1}, {1, 1, 0}
75 + };
76  
77  
78   int main (int argc, char** argv)
# Line 79 | Line 81 | int main (int argc, char** argv)
81     RREAL          rad, radScale = RADSCALE, extent, dumpRatio;
82     unsigned       arg, j, ptype, dim;
83     long           numSpheres = NSPHERES;
84 +   COLOR          customCol = {0, 0, 0};
85     FILE           *pmapFile;
86     PhotonMap      pm;
87     PhotonPrimary  pri;
# Line 89 | Line 92 | int main (int argc, char** argv)
92    
93     if (argc < 2) {
94        puts("Dump photon maps as RADIANCE scene description\n");
95 <      printf("Usage: %s [-r radscale1] [-n nspheres1] pmap1 "
96 <             "[-r radscale2] [-n nspheres2] pmap2 ...\n", argv [0]);
95 >      printf("Usage: %s "
96 >             "[-r radscale1] [-n nspheres1] [-c rcol1 gcol1 bcol1] pmap1 "
97 >             "[-r radscale2] [-n nspheres2] [-c rcol2 gcol2 bcol2] pmap2 "
98 >             "...\n", argv [0]);
99        return 1;
100     }
101    
# Line 108 | Line 113 | int main (int argc, char** argv)
113                    error(USER, "invalid number of spheres");
114                 break;
115                
116 +            case 'c':
117 +               for (j = 0; j < 3; j++)
118 +                  if ((customCol [j] = atof(argv [++arg])) <= 0)
119 +                     error(USER, "invalid RGB colour");
120 +               break;
121 +              
122              default:
123                 sprintf(errmsg, "unknown option %s", argv [arg]);
124                 error(USER, errmsg);
# Line 151 | Line 162 | int main (int argc, char** argv)
162        printargs(argc, argv, stdout);
163        fputc('\n', stdout);
164        
165 <      /* Dump material def */  
166 <      fputs(radDefs [ptype].mat, stdout);
165 >      /* Dump material def */
166 >      if (intens(customCol) > 0)
167 >         printf(radDefs [ptype].mat,
168 >                customCol [0], customCol [1], customCol [2]);
169 >      else
170 >         printf(radDefs [ptype].mat,
171 >                colDefs [ptype][0], colDefs [ptype][1], colDefs [ptype][2]);
172        fputc('\n', stdout);
173        
174        /* Get number of photons */
# Line 270 | Line 286 | int main (int argc, char** argv)
286        /* Reset defaults for next dump */
287        radScale = RADSCALE;
288        numSpheres = NSPHERES;
289 +      customCol [0] = customCol [1] = customCol [2] = 0;
290     }
291    
292     return 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines