00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "paramset.h"
00025 #include "error.h"
00026 #include "constant.h"
00027 #include <sstream>
00028 #include <string>
00029
00030 using namespace lux;
00031
00032
00033 ParamSet::ParamSet(const ParamSet &p2) {
00034 *this = p2;
00035 }
00036
00037
00038
00039 ParamSet::ParamSet(int n, const char * pluginName, char* tokens[], char* params[])
00040 {
00041
00042
00043
00044
00045 std::string pn(pluginName);
00046
00047 for(int i=0;i<n;i++)
00048 {
00049 std::string s(tokens[i]);
00050
00051 if (s == "B")
00052 AddFloat(s,(float*)(params[i]));
00053 if (s == "C")
00054 AddFloat(s, (float*)(params[i]));
00055 if (s == "Pw")
00056 AddFloat(s, (float*)(params[i]),
00057 4 * FindOneInt("nu", i) * FindOneInt("nv", i));
00058 if (s == "Pz")
00059 AddFloat(s, (float*)(params[i]),
00060 FindOneInt("nu", i) * FindOneInt("nv", i));
00061 if (s == "a")
00062 AddFloat(s, (float*)(params[i]));
00063 if (s == "aconst")
00064 AddFloat(s, (float*)(params[i]));
00065 if (s == "alpha")
00066 AddFloat(s, (float*)(params[i]));
00067 if (s == "aperture")
00068 AddFloat(s, (float*)(params[i]));
00069 if (s == "aperture_diameter")
00070 AddFloat(s, (float*)(params[i]));
00071 if (s == "b")
00072 AddFloat(s, (float*)(params[i]));
00073 if (s == "baseflatness")
00074 AddFloat(s, (float*)(params[i]));
00075 if (s == "bconst")
00076 AddFloat(s, (float*)(params[i]));
00077 if (s == "brickdepth")
00078 AddFloat(s, (float*)(params[i]));
00079 if (s == "brickheight")
00080 AddFloat(s, (float*)(params[i]));
00081 if (s == "brickwidth")
00082 AddFloat(s, (float*)(params[i]));
00083 if (s == "bright")
00084 AddFloat(s, (float*)(params[i]));
00085 if (s == "bumpmapsampledistance")
00086 AddFloat(s, (float*)(params[i]));
00087 if (s == "burn")
00088 AddFloat(s, (float*)(params[i]));
00089 if (s == "cconst")
00090 AddFloat(s, (float*)(params[i]));
00091 if (s == "compo_override_alpha_value")
00092 AddFloat(s, (float*)(params[i]));
00093 if (s == "coneangle")
00094 AddFloat(s, (float*)(params[i]));
00095 if (s == "conedeltaangle")
00096 AddFloat(s, (float*)(params[i]));
00097 if (s == "contrast")
00098 AddFloat(s, (float*)(params[i]));
00099 if (s == "contrast_ywa")
00100 AddFloat(s, (float*)(params[i]));
00101 if (s == "cropwindow")
00102 AddFloat(s, (float*)(params[i]), 4);
00103
00104
00105 if (s == "dconst")
00106 AddFloat(s, (float*)(params[i]));
00107 if (s == "density") AddFloat(s, (float*)(params[i]), FindOneInt("nx", i) * FindOneInt("ny", i) * FindOneInt("ny", i));
00108 if (s == "diffusereflectreject_threshold")
00109 AddFloat(s, (float*)(params[i]));
00110 if (s == "diffuserefractreject_threshold")
00111 AddFloat(s, (float*)(params[i]));
00112 if (s == "distamount")
00113 AddFloat(s, (float*)(params[i]));
00114 if (s == "distancethreshold")
00115 AddFloat(s, (float*)(params[i]));
00116 if (s == "dmoffset")
00117 AddFloat(s, (float*)(params[i]));
00118 if (s == "dmscale")
00119 AddFloat(s, (float*)(params[i]));
00120 if (s == "econst")
00121 AddFloat(s, (float*)(params[i]));
00122 if (s == "efficacy")
00123 AddFloat(s, (float*)(params[i]));
00124 if (s == "emptybonus")
00125 AddFloat(s, (float*)(params[i]));
00126 if (s == "end")
00127 AddFloat(s, (float*)(params[i]));
00128 if (s == "energy")
00129 AddFloat(s, (float*)(params[i]));
00130 if (s == "exposure")
00131 AddFloat(s, (float*)(params[i]));
00132 if (s == "eyerrthreshold")
00133 AddFloat(s, (float*)(params[i]));
00134 if (s == "filmdiag")
00135 AddFloat(s, (float*)(params[i]));
00136 if (s == "filmdistance")
00137 AddFloat(s, (float*)(params[i]));
00138 if (s == "focaldistance")
00139 AddFloat(s, (float*)(params[i]));
00140 if (s == "fov")
00141 AddFloat(s, (float*)(params[i]));
00142 if (s == "frameaspectratio")
00143 AddFloat(s, (float*)(params[i]));
00144 if (s == "freq")
00145 AddFloat(s, (float*)(params[i]));
00146 if (s == "fstop")
00147 AddFloat(s, (float*)(params[i]));
00148 if (s == "fullsweepthreshold")
00149 AddFloat(s, (float*)(params[i]));
00150 if (s == "g")
00151 AddFloat(s, (float*)(params[i]));
00152 if (s == "gain")
00153 AddFloat(s, (float*)(params[i]));
00154 if (s == "gamma")
00155 AddFloat(s, (float*)(params[i]));
00156 if (s == "gatherangle")
00157 AddFloat(s, (float*)(params[i]));
00158 if (s == "glossyreflectreject_threshold")
00159 AddFloat(s, (float*)(params[i]));
00160 if (s == "glossyrefractreject_threshold")
00161 AddFloat(s, (float*)(params[i]));
00162 if (s == "h")
00163 AddFloat(s, (float*)(params[i]));
00164 if (s == "height")
00165 AddFloat(s, (float*)(params[i]));
00166 if (s == "hither")
00167 AddFloat(s, (float*)(params[i]));
00168 if (s == "innerradius")
00169 AddFloat(s, (float*)(params[i]));
00170 if (s == "lacu")
00171 AddFloat(s, (float*)(params[i]));
00172 if (s == "largemutationprob")
00173 AddFloat(s, (float*)(params[i]));
00174 if (s == "lensradius")
00175 AddFloat(s, (float*)(params[i]));
00176 if (s == "lightrrthreshold")
00177 AddFloat(s, (float*)(params[i]));
00178 if (s == "linear_exposure")
00179 AddFloat(s, (float*)(params[i]));
00180 if (s == "linear_fstop")
00181 AddFloat(s, (float*)(params[i]));
00182 if (s == "linear_gamma")
00183 AddFloat(s, (float*)(params[i]));
00184 if (s == "linear_sensitivity")
00185 AddFloat(s, (float*)(params[i]));
00186 if (s == "majorradius")
00187 AddFloat(s, (float*)(params[i]));
00188 if (s == "maxY")
00189 AddFloat(s, (float*)(params[i]));
00190 if (s == "maxanisotropy")
00191 AddFloat(s, (float*)(params[i]));
00192 if (s == "maxphotondist")
00193 AddFloat(s, (float*)(params[i]));
00194 if (s == "micromutationprob")
00195 AddFloat(s, (float*)(params[i]));
00196 if (s == "mindist")
00197 AddFloat(s, (float*)(params[i]));
00198 if (s == "minkovsky_exp")
00199 AddFloat(s, (float*)(params[i]));
00200 if (s == "minorradius")
00201 AddFloat(s, (float*)(params[i]));
00202 if (s == "mortarsize")
00203 AddFloat(s, (float*)(params[i]));
00204 if (s == "mutationrange")
00205 AddFloat(s, (float*)(params[i]));
00206 if (s == "nabla")
00207 AddFloat(s, (float*)(params[i]));
00208 if (s == "noiseoffset")
00209 AddFloat(s, (float*)(params[i]));
00210 if (s == "noisescale")
00211 AddFloat(s, (float*)(params[i]));
00212 if (s == "noisesize")
00213 AddFloat(s, (float*)(params[i]));
00214 if (s == "octs")
00215 AddFloat(s, (float*)(params[i]));
00216 if (s == "offset")
00217 AddFloat(s, (float*)(params[i]));
00218 if (s == "omega")
00219 AddFloat(s, (float*)(params[i]));
00220 if (s == "outscale")
00221 AddFloat(s, (float*)(params[i]));
00222 if (s == "phimax")
00223 AddFloat(s, (float*)(params[i]));
00224 if (s == "postscale")
00225 AddFloat(s, (float*)(params[i]));
00226 if (s == "power" && pn == "area")
00227 AddFloat(s, (float*)(params[i]));
00228 if (s == "prescale")
00229 AddFloat(s, (float*)(params[i]));
00230 if (s == "radius")
00231 AddFloat(s, (float*)(params[i]));
00232 if (s == "reinhard_burn")
00233 AddFloat(s, (float*)(params[i]));
00234 if (s == "reinhard_postscale")
00235 AddFloat(s, (float*)(params[i]));
00236 if (s == "reinhard_prescale")
00237 AddFloat(s, (float*)(params[i]));
00238 if (s == "relsize")
00239 AddFloat(s, (float*)(params[i]));
00240 if (s == "roughness")
00241 AddFloat(s, (float*)(params[i]));
00242 if (s == "rrcontinueprob")
00243 AddFloat(s, (float*)(params[i]));
00244 if (s == "scale")
00245 AddFloat(s, (float*)(params[i]));
00246 if (s == "screenwindow")
00247 AddFloat(s, (float*)(params[i]), 4);
00248 if (s == "sensitivity")
00249 AddFloat(s, (float*)(params[i]));
00250 if (s == "sharpness")
00251 AddFloat(s, (float*)(params[i]));
00252 if (s == "shutterclose")
00253 AddFloat(s, (float*)(params[i]));
00254 if (s == "shutteropen")
00255 AddFloat(s, (float*)(params[i]));
00256 if (s == "spheresize")
00257 AddFloat(s, (float*)(params[i]));
00258 if (s == "st")
00259 AddFloat(s, (float*)(params[i]),
00260 2 * FindOneInt("nvertices", i));
00261 if (s == "start")
00262 AddFloat(s, (float*)(params[i]));
00263 if (s == "stepsize")
00264 AddFloat(s, (float*)(params[i]));
00265 if (s == "tau")
00266 AddFloat(s, (float*)(params[i]));
00267 if (s == "temperature")
00268 AddFloat(s, (float*)(params[i]));
00269 if (s == "thetamax")
00270 AddFloat(s, (float*)(params[i]));
00271 if (s == "thetamin")
00272 AddFloat(s, (float*)(params[i]));
00273 if (s == "turbidity")
00274 AddFloat(s, (float*)(params[i]));
00275 if (s == "turbulance")
00276 AddFloat(s, (float*)(params[i]));
00277 if (s == "turbulence")
00278 AddFloat(s, (float*)(params[i]));
00279 if (s == "u0")
00280 AddFloat(s, (float*)(params[i]));
00281 if (s == "u1")
00282 AddFloat(s, (float*)(params[i]));
00283 if (s == "udelta")
00284 AddFloat(s, (float*)(params[i]));
00285 if (s == "uknots")
00286 AddFloat(s, (float*)(params[i]),
00287 FindOneInt("nu", i) + FindOneInt("uorder", i));
00288 if (s == "uscale")
00289 AddFloat(s, (float*)(params[i]));
00290 if (s == "uv")
00291 AddFloat(s, (float*)(params[i]),
00292 2 * FindOneInt("nvertices", i));
00293 if (s == "v0")
00294 AddFloat(s, (float*)(params[i]));
00295 if (s == "v00")
00296 AddFloat(s, (float*)(params[i]));
00297 if (s == "v01")
00298 AddFloat(s, (float*)(params[i]));
00299 if (s == "v1")
00300 AddFloat(s, (float*)(params[i]));
00301 if (s == "v10")
00302 AddFloat(s, (float*)(params[i]));
00303 if (s == "v11")
00304 AddFloat(s, (float*)(params[i]));
00305 if (s == "value")
00306 AddFloat(s, (float*)(params[i]));
00307 if (s == "variability")
00308 AddFloat(s, (float*)(params[i]));
00309 if (s == "variation")
00310 AddFloat(s, (float*)(params[i]));
00311 if (s == "vdelta")
00312 AddFloat(s,(float*)(params[i]));
00313 if (s == "vknots")
00314 AddFloat(s, (float*)(params[i]),
00315 FindOneInt("nv", i) + FindOneInt("vorder", i));
00316 if (s == "vscale")
00317 AddFloat(s, (float*)(params[i]));
00318 if (s == "w1")
00319 AddFloat(s, (float*)(params[i]));
00320 if (s == "w2")
00321 AddFloat(s, (float*)(params[i]));
00322 if (s == "w3")
00323 AddFloat(s, (float*)(params[i]));
00324 if (s == "w4")
00325 AddFloat(s, (float*)(params[i]));
00326 if (s == "wavelength")
00327 AddFloat(s, (float*)(params[i]));
00328
00329
00330 if (s == "width")
00331 AddFloat(s, (float*)(params[i]));
00332 if (s == "xwidth")
00333 AddFloat(s, (float*)(params[i]));
00334 if (s == "yon")
00335 AddFloat(s, (float*)(params[i]));
00336 if (s == "ywa")
00337 AddFloat(s, (float*)(params[i]));
00338 if (s == "ywidth")
00339 AddFloat(s, (float*)(params[i]));
00340 if (s == "zmax")
00341 AddFloat(s, (float*)(params[i]));
00342 if (s == "zmin")
00343 AddFloat(s, (float*)(params[i]));
00344
00345
00346 if (s == "blades")
00347 AddInt(s, (int*)(params[i]));
00348 if (s == "causticphotons")
00349 AddInt(s, (int*)(params[i]));
00350 if (s == "chainlength")
00351 AddInt(s, (int*)(params[i]));
00352 if (s == "coltype")
00353 AddInt(s, (int*)(params[i]));
00354 if (s == "costsamples")
00355 AddInt(s, (int*)(params[i]));
00356 if (s == "diffusereflectdepth")
00357 AddInt(s, (int*)(params[i]));
00358 if (s == "diffusereflectsamples")
00359 AddInt(s, (int*)(params[i]));
00360 if (s == "diffuserefractdepth")
00361 AddInt(s, (int*)(params[i]));
00362 if (s == "diffuserefractsamples")
00363 AddInt(s, (int*)(params[i]));
00364 if (s == "dimension")
00365 AddInt(s, (int*)(params[i]));
00366 if (s == "directphotons")
00367 AddInt(s, (int*)(params[i]));
00368 if (s == "directsamples")
00369 AddInt(s, (int*)(params[i]));
00370 if (s == "discardmipmaps")
00371 AddInt(s, (int*)(params[i]));
00372 if (s == "displayinterval")
00373 AddInt(s, (int*)(params[i]));
00374 if (s == "eyedepth")
00375 AddInt(s, (int*)(params[i]));
00376 if (s == "finalgathersamples")
00377 AddInt(s, (int*)(params[i]));
00378 if (s == "glossyreflectdepth")
00379 AddInt(s, (int*)(params[i]));
00380 if (s == "glossyreflectsamples")
00381 AddInt(s, (int*)(params[i]));
00382 if (s == "glossyrefractdepth")
00383 AddInt(s, (int*)(params[i]));
00384 if (s == "glossyrefractsamples")
00385 AddInt(s, (int*)(params[i]));
00386 if (s == "haltspp")
00387 AddInt(s, (int*)(params[i]));
00388 if( s == "indices")
00389 AddInt(s, (int*)(params[i]),
00390 FindOneInt("nvertices", i));
00391 if (s == "indirectphotons")
00392 AddInt(s, (int*)(params[i]));
00393 if (s == "indirectsamples")
00394 AddInt(s, (int*)(params[i]));
00395 if (s == "intersectcost")
00396 AddInt(s, (int*)(params[i]));
00397 if (s == "lightdepth")
00398 AddInt(s, (int*)(params[i]));
00399 if (s == "maxconsecrejects")
00400 AddInt(s, (int*)(params[i]));
00401 if (s == "maxdepth")
00402 AddInt(s, (int*)(params[i]));
00403 if (s == "maxphotondepth")
00404 AddInt(s, (int*)(params[i]));
00405 if (s == "maxprims")
00406 AddInt(s, (int*)(params[i]));
00407 if (s == "maxprimsperleaf")
00408 AddInt(s, (int*)(params[i]));
00409 if (s == "nlevels")
00410 AddInt(s, (int*)(params[i]));
00411 if (s == "nlights")
00412 AddInt(s, (int*)(params[i]));
00413 if (s == "noisedepth")
00414 AddInt(s, (int*)(params[i]));
00415 if (s == "nphotonused")
00416 AddInt(s, (int*)(params[i]));
00417 if (s == "nsamples")
00418 AddInt(s, (int*)(params[i]));
00419 if (s == "nsets")
00420 AddInt(s, (int*)(params[i]));
00421 if (s == "nsubdivlevels")
00422 AddInt(s, (int*)(params[i]));
00423 if (s == "nu")
00424 AddInt(s, (int*)(params[i]));
00425 if (s == "nv")
00426 AddInt(s, (int*)(params[i]));
00427 if (s == "nx")
00428 AddInt(s, (int*)(params[i]));
00429 if (s == "ny")
00430 AddInt(s, (int*)(params[i]));
00431 if (s == "nz")
00432 AddInt(s, (int*)(params[i]));
00433 if (s == "octaves")
00434 AddInt(s, (int*)(params[i]));
00435 if (s == "pixelsamples")
00436 AddInt(s, (int*)(params[i]));
00437 if (s == "power" && pn == "perspective")
00438 AddInt(s, (int*)(params[i]));
00439
00440
00441 if (s == "radiancephotons")
00442 AddInt(s, (int*)(params[i]));
00443 if (s == "reject_warmup")
00444 AddInt(s, (int*)(params[i]));
00445 if (s == "skipfactor")
00446 AddInt(s, (int*)(params[i]));
00447 if (s == "specularreflectdepth")
00448 AddInt(s, (int*)(params[i]));
00449 if (s == "specularrefractdepth")
00450 AddInt(s, (int*)(params[i]));
00451 if (s == "spheres")
00452 AddInt(s, (int*)(params[i]));
00453 if (s == "traversalcost")
00454 AddInt(s, (int*)(params[i]));
00455 if (s == "treetype")
00456 AddInt(s, (int*)(params[i]));
00457
00458
00459 if (s == "uorder")
00460 AddInt(s, (int*)(params[i]));
00461 if (s == "vorder")
00462 AddInt(s, (int*)(params[i]));
00463 if (s == "writeinterval")
00464 AddInt(s, (int*)(params[i]));
00465 if (s == "xresolution")
00466 AddInt(s, (int*)(params[i]));
00467 if (s == "xsamples")
00468 AddInt(s, (int*)(params[i]));
00469 if (s == "yresolution")
00470 AddInt(s, (int*)(params[i]));
00471 if (s == "ysamples")
00472 AddInt(s, (int*)(params[i]));
00473
00474
00475 if (s == "architectural")
00476 AddBool(s, (bool*)(params[i]));
00477 if (s == "autofocus")
00478 AddBool(s, (bool*)(params[i]));
00479 if (s == "compo_override_alpha")
00480 AddBool(s, (bool*)(params[i]));
00481 if (s == "compo_use_key")
00482 AddBool(s, (bool*)(params[i]));
00483 if (s == "compo_visible_emission")
00484 AddBool(s, (bool*)(params[i]));
00485 if (s == "compo_visible_indirect_emission")
00486 AddBool(s, (bool*)(params[i]));
00487 if (s == "compo_visible_indirect_material")
00488 AddBool(s, (bool*)(params[i]));
00489 if (s == "compo_visible_material")
00490 AddBool(s, (bool*)(params[i]));
00491 if (s == "dbg_enabledirect")
00492 AddBool(s, (bool*)(params[i]));
00493 if (s == "dbg_enableindircaustic")
00494 AddBool(s, (bool*)(params[i]));
00495 if (s == "dbg_enableindirdiffuse")
00496 AddBool(s, (bool*)(params[i]));
00497 if (s == "dbg_enableindirspecular")
00498 AddBool(s, (bool*)(params[i]));
00499 if (s == "dbg_enableradiancemap")
00500 AddBool(s, (bool*)(params[i]));
00501 if (s == "debug")
00502 AddBool(s, (bool*)(params[i]));
00503 if (s == "diffusereflectreject")
00504 AddBool(s, (bool*)(params[i]));
00505 if (s == "diffuserefractreject")
00506 AddBool(s, (bool*)(params[i]));
00507 if (s == "directdiffuse")
00508 AddBool(s, (bool*)(params[i]));
00509 if (s == "directglossy")
00510 AddBool(s, (bool*)(params[i]));
00511 if (s == "directsampleall")
00512 AddBool(s, (bool*)(params[i]));
00513 if (s == "dmnormalsmooth")
00514 AddBool(s, (bool*)(params[i]));
00515 if (s == "dmsharpboundary")
00516 AddBool(s, (bool*)(params[i]));
00517 if (s == "finalgather")
00518 AddBool(s, (bool*)(params[i]));
00519 if (s == "flipxy")
00520 AddBool(s, (bool*)(params[i]));
00521 if (s == "flipz")
00522 AddBool(s, (bool*)(params[i]));
00523 if (s == "glossyreflectreject")
00524 AddBool(s, (bool*)(params[i]));
00525 if (s == "glossyrefractreject")
00526 AddBool(s, (bool*)(params[i]));
00527 if (s == "includeenvironment")
00528 AddBool(s, (bool*)(params[i]));
00529 if (s == "indirectdiffuse")
00530 AddBool(s, (bool*)(params[i]));
00531 if (s == "indirectglossy")
00532 AddBool(s, (bool*)(params[i]));
00533 if (s == "indirectsampleall")
00534 AddBool(s, (bool*)(params[i]));
00535 if (s == "premultiplyalpha")
00536 AddBool(s, (bool*)(params[i]));
00537 if (s == "refineimmediately")
00538 AddBool(s, (bool*)(params[i]));
00539 if (s == "restart_resume_flm")
00540 AddBool(s, (bool*)(params[i]));
00541 if (s == "smooth")
00542 AddBool(s, (bool*)(params[i]));
00543 if (s == "usevariance")
00544 AddBool(s, (bool*)(params[i]));
00545 if (s == "write_exr")
00546 AddBool(s, (bool*)(params[i]));
00547 if (s == "write_exr_ZBuf")
00548 AddBool(s, (bool*)(params[i]));
00549 if (s == "write_exr_applyimaging")
00550 AddBool(s, (bool*)(params[i]));
00551 if (s == "write_exr_gamutclamp")
00552 AddBool(s, (bool*)(params[i]));
00553 if (s == "write_exr_halftype")
00554 AddBool(s, (bool*)(params[i]));
00555 if (s == "write_png")
00556 AddBool(s, (bool*)(params[i]));
00557 if (s == "write_png_16bit")
00558 AddBool(s, (bool*)(params[i]));
00559 if (s == "write_png_ZBuf")
00560 AddBool(s, (bool*)(params[i]));
00561 if (s == "write_png_gamutclamp")
00562 AddBool(s, (bool*)(params[i]));
00563 if (s == "write_resume_flm")
00564 AddBool(s, (bool*)(params[i]));
00565 if (s == "write_tga")
00566 AddBool(s, (bool*)(params[i]));
00567 if (s == "write_tga_ZBuf")
00568 AddBool(s, (bool*)(params[i]));
00569 if (s == "write_tga_gamutclamp")
00570 AddBool(s, (bool*)(params[i]));
00571
00572
00573 if (s == "aamode")
00574 AddString(s, new string(params[i]));
00575 if (s == "acceltype")
00576 AddString(s, new string(params[i]));
00577 if (s == "basesampler")
00578 AddString(s, new string(params[i]));
00579 if (s == "displacementmap")
00580 AddString(s, new string(params[i]));
00581 if (s == "distmetric")
00582 AddString(s, new string(params[i]));
00583 if (s == "distribution")
00584 AddString(s, new string(params[i]));
00585 if (s == "endtransform")
00586 AddString(s, new string(params[i]));
00587 if (s == "filename")
00588 AddString(s, new string(params[i]));
00589 if (s == "filtertype")
00590 AddString(s, new string(params[i]));
00591 if (s == "iesname")
00592 AddString(s, new string(params[i]));
00593 if (s == "ldr_clamp_method")
00594 AddString(s, new string(params[i]));
00595 if (s == "mapname")
00596 AddString(s, new string(params[i]));
00597 if (s == "mapping")
00598 AddString(s, new string(params[i]));
00599 if (s == "name")
00600 AddString(s, new string(params[i]));
00601 if (s == "namedmaterial1")
00602 AddString(s, new string(params[i]));
00603 if (s == "namedmaterial2")
00604 AddString(s, new string(params[i]));
00605 if (s == "noisebasis")
00606 AddString(s, new string(params[i]));
00607 if (s == "noisebasis2")
00608 AddString(s, new string(params[i]));
00609 if (s == "noisetype")
00610 AddString(s, new string(params[i]));
00611 if (s == "photonmapsfile")
00612 AddString(s, new string(params[i]));
00613 if (s == "pixelsampler")
00614 AddString(s, new string(params[i]));
00615 if (s == "quadtype")
00616 AddString(s, new string(params[i]));
00617 if (s == "renderingmode")
00618 AddString(s, new string(params[i]));
00619 if (s == "rrstrategy")
00620 AddString(s, new string(params[i]));
00621 if (s == "scheme")
00622 AddString(s, new string(params[i]));
00623 if (s == "shutterdistribution")
00624 AddString(s, new string(params[i]));
00625 if (s == "specfile")
00626 AddString(s, new string(params[i]));
00627 if (s == "strategy")
00628 AddString(s, new string(params[i]));
00629 if (s == "subdivscheme")
00630 AddString(s, new string(params[i]));
00631 if (s == "tonemapkernel")
00632 AddString(s, new string(params[i]));
00633 if (s == "tritype")
00634 AddString(s, new string(params[i]));
00635 if (s == "type")
00636 AddString(s, new string(params[i]));
00637 if (s == "wrap")
00638 AddString(s, new string(params[i]));
00639 if (s == "write_exr_channels")
00640 AddString(s, new string(params[i]));
00641 if (s == "write_exr_compressiontype")
00642 AddString(s, new string(params[i]));
00643 if (s == "write_exr_zbuf_normalization")
00644 AddString(s, new string(params[i]));
00645 if (s == "write_png_channels")
00646 AddString(s, new string(params[i]));
00647 if (s == "write_pxr_zbuf_normalization")
00648 AddString(s, new string(params[i]));
00649 if (s == "write_tga_channels")
00650 AddString(s, new string(params[i]));
00651 if (s == "write_tga_zbuf_normalization")
00652 AddString(s, new string(params[i]));
00653
00654
00655 if (s == "P") {
00656 if (pn == "nurbs")
00657 AddPoint(s, (Point*)(params[i]),
00658 FindOneInt("nu", i) * FindOneInt("nv", i));
00659 else
00660 AddPoint(s, (Point*)(params[i]),
00661 FindOneInt("nvertices", i));
00662 }
00663 if (s == "from")
00664 AddPoint(s, (Point*)(params[i]));
00665 if (s == "p0")
00666 AddPoint(s, (Point*)(params[i]));
00667 if (s == "p1")
00668 AddPoint(s, (Point*)(params[i]));
00669 if (s == "p2")
00670 AddPoint(s, (Point*)(params[i]));
00671 if (s == "to")
00672 AddPoint(s,(Point*)(params[i]));
00673
00674
00675 if (s == "N")
00676 AddNormal(s, (Normal*)(params[i]),
00677 FindOneInt("nvertices", i));
00678
00679
00680 if (s == "rotate")
00681 AddVector(s, (Vector*)(params[i]));
00682 if (s == "scale")
00683 AddVector(s, (Vector*)(params[i]));
00684 if (s == "sundir")
00685 AddVector(s, (Vector*)(params[i]));
00686 if (s == "translate")
00687 AddVector(s, (Vector*)(params[i]));
00688 if (s == "updir")
00689 AddVector(s, (Vector*)(params[i]));
00690 if (s == "v1")
00691 AddVector(s, (Vector*)(params[i]));
00692 if (s == "v2")
00693 AddVector(s, (Vector*)(params[i]));
00694
00695
00696 if (s == "Ka")
00697 AddTexture(s, std::string(params[i]));
00698 if (s == "Kd")
00699 AddTexture(s, std::string(params[i]));
00700 if (s == "Kr")
00701 AddTexture(s, std::string(params[i]));
00702 if (s == "Ks")
00703 AddTexture(s, std::string(params[i]));
00704 if (s == "Ks1")
00705 AddTexture(s, std::string(params[i]));
00706 if (s == "Ks2")
00707 AddTexture(s, std::string(params[i]));
00708 if (s == "Ks3")
00709 AddTexture(s, std::string(params[i]));
00710 if (s == "Kt")
00711 AddTexture(s, std::string(params[i]));
00712 if (s == "L")
00713 AddTexture(s, std::string(params[i]));
00714 if (s == "M1")
00715 AddTexture(s, std::string(params[i]));
00716 if (s == "M2")
00717 AddTexture(s, std::string(params[i]));
00718 if (s == "M3")
00719 AddTexture(s, std::string(params[i]));
00720 if (s == "R1")
00721 AddTexture(s, std::string(params[i]));
00722 if (s == "R2")
00723 AddTexture(s, std::string(params[i]));
00724 if (s == "R3")
00725 AddTexture(s, std::string(params[i]));
00726 if (s == "amount")
00727 AddTexture(s, std::string(params[i]));
00728 if (s == "bricktex")
00729 AddTexture(s, std::string(params[i]));
00730 if (s == "bumpmap")
00731 AddTexture(s, std::string(params[i]));
00732 if (s == "cauchyb")
00733 AddTexture(s, std::string(params[i]));
00734 if (s == "d")
00735 AddTexture(s, std::string(params[i]));
00736 if (s == "film")
00737 AddTexture(s, std::string(params[i]));
00738 if (s == "filmindex")
00739 AddTexture(s, std::string(params[i]));
00740 if (s == "index")
00741 AddTexture(s, std::string(params[i]));
00742 if (s == "inside")
00743 AddTexture(s, std::string(params[i]));
00744 if (s == "mortartex")
00745 AddTexture(s, std::string(params[i]));
00746 if (s == "outside")
00747 AddTexture(s, std::string(params[i]));
00748 if (s == "sigma")
00749 AddTexture(s, std::string(params[i]));
00750 if (s == "tex1")
00751 AddTexture(s, std::string(params[i]));
00752 if (s == "tex2")
00753 AddTexture(s, std::string(params[i]));
00754 if (s == "uroughness")
00755 AddTexture(s, std::string(params[i]));
00756 if (s == "vroughness")
00757 AddTexture(s, std::string(params[i]));
00758
00759
00760 if (s == "L")
00761 AddRGBColor(s, new RGBColor((float*)params[i]));
00762 if (s == "Le")
00763 AddRGBColor(s, new RGBColor((float*)params[i]));
00764 if (s == "compo_key_color")
00765 AddRGBColor(s, new RGBColor((float*)params[i]));
00766 if (s == "sigma_a")
00767 AddRGBColor(s, new RGBColor((float*)params[i]));
00768 if (s == "sigma_s")
00769 AddRGBColor(s, new RGBColor((float*)params[i]));
00770 if (s == "v00")
00771 AddRGBColor(s, new RGBColor((float*)params[i]));
00772 if (s == "v01")
00773 AddRGBColor(s, new RGBColor((float*)params[i]));
00774 if (s == "v10")
00775 AddRGBColor(s, new RGBColor((float*)params[i]));
00776 if (s == "v11")
00777 AddRGBColor(s, new RGBColor((float*)params[i]));
00778 if (s == "value")
00779 AddRGBColor(s, new RGBColor((float*)params[i]));
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789 }
00790 }
00791
00792 ParamSet &ParamSet::operator=(const ParamSet &p2) {
00793 if (&p2 != this) {
00794 Clear();
00795 u_int i;
00796 for (i = 0; i < p2.ints.size(); ++i)
00797 ints.push_back(p2.ints[i]->Clone());
00798 for (i = 0; i < p2.bools.size(); ++i)
00799 bools.push_back(p2.bools[i]->Clone());
00800 for (i = 0; i < p2.floats.size(); ++i)
00801 floats.push_back(p2.floats[i]->Clone());
00802 for (i = 0; i < p2.points.size(); ++i)
00803 points.push_back(p2.points[i]->Clone());
00804 for (i = 0; i < p2.vectors.size(); ++i)
00805 vectors.push_back(p2.vectors[i]->Clone());
00806 for (i = 0; i < p2.normals.size(); ++i)
00807 normals.push_back(p2.normals[i]->Clone());
00808 for (i = 0; i < p2.spectra.size(); ++i)
00809 spectra.push_back(p2.spectra[i]->Clone());
00810 for (i = 0; i < p2.strings.size(); ++i)
00811 strings.push_back(p2.strings[i]->Clone());
00812 for (i = 0; i < p2.textures.size(); ++i)
00813 textures.push_back(p2.textures[i]->Clone());
00814 }
00815 return *this;
00816 }
00817
00818 void ParamSet::Add(ParamSet ¶ms) {
00819 #define ADD_PARAMSETITEM_VECTOR(VEC,ADD_METHOD) \
00820 for( u_int i = 0; i < VEC.size(); i++ ) { \
00821 ADD_METHOD(VEC[i]->name, VEC[i]->data, VEC[i]->nItems ); \
00822 }
00823
00824 ADD_PARAMSETITEM_VECTOR(params.ints, AddInt);
00825 ADD_PARAMSETITEM_VECTOR(params.bools, AddBool);
00826 ADD_PARAMSETITEM_VECTOR(params.floats, AddFloat);
00827 ADD_PARAMSETITEM_VECTOR(params.points, AddPoint);
00828 ADD_PARAMSETITEM_VECTOR(params.vectors, AddVector);
00829 ADD_PARAMSETITEM_VECTOR(params.normals, AddNormal);
00830 ADD_PARAMSETITEM_VECTOR(params.spectra, AddRGBColor);
00831 ADD_PARAMSETITEM_VECTOR(params.strings, AddString);
00832 for( u_int i = 0; i < params.textures.size(); i++ ) {
00833 AddTexture(params.textures[i]->name, *(params.textures[i]->data));
00834 }
00835
00836 #undef ADD_PARAMSETITEM_VECTOR
00837 }
00838
00839 void ParamSet::AddFloat(const string &name,
00840 const float *data,
00841 int nItems) {
00842 EraseFloat(name);
00843 floats.push_back(new ParamSetItem<float>(name,
00844 data,
00845 nItems));
00846 }
00847 void ParamSet::AddInt(const string &name, const int *data, int nItems) {
00848 EraseInt(name);
00849 ADD_PARAM_TYPE(int, ints);
00850 }
00851 void ParamSet::AddBool(const string &name, const bool *data, int nItems) {
00852 EraseBool(name);
00853 ADD_PARAM_TYPE(bool, bools);
00854 }
00855 void ParamSet::AddPoint(const string &name, const Point *data, int nItems) {
00856 ErasePoint(name);
00857 ADD_PARAM_TYPE(Point, points);
00858 }
00859 void ParamSet::AddVector(const string &name, const Vector *data, int nItems) {
00860 EraseVector(name);
00861 ADD_PARAM_TYPE(Vector, vectors);
00862 }
00863 void ParamSet::AddNormal(const string &name, const Normal *data, int nItems) {
00864 EraseNormal(name);
00865 ADD_PARAM_TYPE(Normal, normals);
00866 }
00867 void ParamSet::AddRGBColor(const string &name, const RGBColor *data, int nItems) {
00868 EraseRGBColor(name);
00869 ADD_PARAM_TYPE(RGBColor, spectra);
00870 }
00871 void ParamSet::AddString(const string &name, const string *data, int nItems) {
00872 EraseString(name);
00873 ADD_PARAM_TYPE(string, strings);
00874 }
00875 void ParamSet::AddTexture(const string &name, const string &value) {
00876 EraseTexture(name);
00877 textures.push_back(new ParamSetItem<string>(name, (string *)&value, 1));
00878 }
00879 bool ParamSet::EraseInt(const string &n) {
00880 for (u_int i = 0; i < ints.size(); ++i)
00881 if (ints[i]->name == n) {
00882 delete ints[i];
00883 ints.erase(ints.begin() + i);
00884 return true;
00885 }
00886 return false;
00887 }
00888 bool ParamSet::EraseBool(const string &n) {
00889 for (u_int i = 0; i < bools.size(); ++i)
00890 if (bools[i]->name == n) {
00891 delete bools[i];
00892 bools.erase(bools.begin() + i);
00893 return true;
00894 }
00895 return false;
00896 }
00897 bool ParamSet::EraseFloat(const string &n) {
00898 for (u_int i = 0; i < floats.size(); ++i)
00899 if (floats[i]->name == n) {
00900 delete floats[i];
00901 floats.erase(floats.begin() + i);
00902 return true;
00903 }
00904 return false;
00905 }
00906 bool ParamSet::ErasePoint(const string &n) {
00907 for (u_int i = 0; i < points.size(); ++i)
00908 if (points[i]->name == n) {
00909 delete points[i];
00910 points.erase(points.begin() + i);
00911 return true;
00912 }
00913 return false;
00914 }
00915 bool ParamSet::EraseVector(const string &n) {
00916 for (u_int i = 0; i < vectors.size(); ++i)
00917 if (vectors[i]->name == n) {
00918 delete vectors[i];
00919 vectors.erase(vectors.begin() + i);
00920 return true;
00921 }
00922 return false;
00923 }
00924 bool ParamSet::EraseNormal(const string &n) {
00925 for (u_int i = 0; i < normals.size(); ++i)
00926 if (normals[i]->name == n) {
00927 delete normals[i];
00928 normals.erase(normals.begin() + i);
00929 return true;
00930 }
00931 return false;
00932 }
00933 bool ParamSet::EraseRGBColor(const string &n) {
00934 for (u_int i = 0; i < spectra.size(); ++i)
00935 if (spectra[i]->name == n) {
00936 delete spectra[i];
00937 spectra.erase(spectra.begin() + i);
00938 return true;
00939 }
00940 return false;
00941 }
00942 bool ParamSet::EraseString(const string &n) {
00943 for (u_int i = 0; i < strings.size(); ++i)
00944 if (strings[i]->name == n) {
00945 delete strings[i];
00946 strings.erase(strings.begin() + i);
00947 return true;
00948 }
00949 return false;
00950 }
00951 bool ParamSet::EraseTexture(const string &n) {
00952 for (u_int i = 0; i < textures.size(); ++i)
00953 if (textures[i]->name == n) {
00954 delete textures[i];
00955 textures.erase(textures.begin() + i);
00956 return true;
00957 }
00958 return false;
00959 }
00960 float ParamSet::FindOneFloat(const string &name,
00961 float d) const {
00962 for (u_int i = 0; i < floats.size(); ++i)
00963 if (floats[i]->name == name &&
00964 floats[i]->nItems == 1) {
00965 floats[i]->lookedUp = true;
00966 return *(floats[i]->data);
00967 }
00968 return d;
00969 }
00970 const float *ParamSet::FindFloat(const string &name,
00971 int *nItems) const {
00972 for (u_int i = 0; i < floats.size(); ++i)
00973 if (floats[i]->name == name) {
00974 *nItems = floats[i]->nItems;
00975 floats[i]->lookedUp = true;
00976 return floats[i]->data;
00977 }
00978 return NULL;
00979 }
00980 const int *ParamSet::FindInt(const string &name, int *nItems) const {
00981 LOOKUP_PTR(ints);
00982 }
00983 const bool *ParamSet::FindBool(const string &name, int *nItems) const {
00984 LOOKUP_PTR(bools);
00985 }
00986 int ParamSet::FindOneInt(const string &name, int d) const {
00987 LOOKUP_ONE(ints);
00988 }
00989 bool ParamSet::FindOneBool(const string &name, bool d) const {
00990 LOOKUP_ONE(bools);
00991 }
00992 const Point *ParamSet::FindPoint(const string &name, int *nItems) const {
00993 LOOKUP_PTR(points);
00994 }
00995 Point ParamSet::FindOnePoint(const string &name, const Point &d) const {
00996 LOOKUP_ONE(points);
00997 }
00998 const Vector *ParamSet::FindVector(const string &name, int *nItems) const {
00999 LOOKUP_PTR(vectors);
01000 }
01001 Vector ParamSet::FindOneVector(const string &name, const Vector &d) const {
01002 LOOKUP_ONE(vectors);
01003 }
01004 const Normal *ParamSet::FindNormal(const string &name, int *nItems) const {
01005 LOOKUP_PTR(normals);
01006 }
01007 Normal ParamSet::FindOneNormal(const string &name, const Normal &d) const {
01008 LOOKUP_ONE(normals);
01009 }
01010 const RGBColor *ParamSet::FindRGBColor(const string &name, int *nItems) const {
01011 LOOKUP_PTR(spectra);
01012 }
01013 RGBColor ParamSet::FindOneRGBColor(const string &name, const RGBColor &d) const {
01014 LOOKUP_ONE(spectra);
01015 }
01016 const string *ParamSet::FindString(const string &name, int *nItems) const {
01017 LOOKUP_PTR(strings);
01018 }
01019 string ParamSet::FindOneString(const string &name, const string &d) const {
01020 LOOKUP_ONE(strings);
01021 }
01022 string ParamSet::FindTexture(const string &name) const {
01023 string d = "";
01024 LOOKUP_ONE(textures);
01025 }
01026 void ParamSet::ReportUnused() const {
01027 #define CHECK_UNUSED(v) \
01028 for (i = 0; i < (v).size(); ++i) \
01029 if (!(v)[i]->lookedUp) \
01030 { \
01031 std::stringstream ss; \
01032 ss<<"Parameter '"<<(v)[i]->name<<"' not used"; \
01033 luxError(LUX_NOERROR,LUX_WARNING,ss.str().c_str()); \
01034 }
01035 u_int i;
01036 CHECK_UNUSED(ints); CHECK_UNUSED(bools);
01037 CHECK_UNUSED(floats); CHECK_UNUSED(points);
01038 CHECK_UNUSED(vectors); CHECK_UNUSED(normals);
01039 CHECK_UNUSED(spectra); CHECK_UNUSED(strings);
01040 CHECK_UNUSED(textures);
01041 }
01042 void ParamSet::Clear() {
01043 #define DEL_PARAMS(name) \
01044 for (u_int i = 0; i < (name).size(); ++i) \
01045 delete (name)[i]; \
01046 (name).erase((name).begin(), (name).end())
01047 DEL_PARAMS(ints); DEL_PARAMS(bools);
01048 DEL_PARAMS(floats); DEL_PARAMS(points);
01049 DEL_PARAMS(vectors); DEL_PARAMS(normals);
01050 DEL_PARAMS(spectra); DEL_PARAMS(strings);
01051 DEL_PARAMS(textures);
01052 #undef DEL_PARAMS
01053 }
01054 string ParamSet::ToString() const {
01055 string ret;
01056 u_int i;
01057 int j;
01058 string typeString;
01059 const int bufLen = 48*1024*1024;
01060 static char *buf = new char[bufLen];
01061 char *bufEnd = buf + bufLen;
01062 for (i = 0; i < ints.size(); ++i) {
01063 char *bufp = buf;
01064 *bufp = '\0';
01065 ParamSetItem<int> *item = ints[i];
01066 typeString = "integer ";
01067
01068 int nPrint = item->nItems;
01069 ret += string("\"");
01070 ret += typeString;
01071 ret += item->name;
01072 ret += string("\"");
01073 ret += string(" [");
01074 for (j = 0; j < nPrint; ++j)
01075 bufp += snprintf(bufp, bufEnd - bufp, "%d ", item->data[j]);
01076 ret += buf;
01077 ret += string("] ");
01078 }
01079 for (i = 0; i < bools.size(); ++i) {
01080 char *bufp = buf;
01081 *bufp = '\0';
01082 ParamSetItem<bool> *item = bools[i];
01083 typeString = "bool ";
01084
01085 int nPrint = item->nItems;
01086 ret += string("\"");
01087 ret += typeString;
01088 ret += item->name;
01089 ret += string("\"");
01090 ret += string(" [");
01091 for (j = 0; j < nPrint; ++j)
01092 bufp += snprintf(bufp, bufEnd - bufp, "\"%s\" ", item->data[j] ? "true" : "false");
01093 ret += buf;
01094 ret += string("] ");
01095 }
01096 for (i = 0; i < floats.size(); ++i) {
01097 char *bufp = buf;
01098 *bufp = '\0';
01099 ParamSetItem<float> *item = floats[i];
01100 typeString = "float ";
01101
01102 int nPrint = item->nItems;
01103 ret += string("\"");
01104 ret += typeString;
01105 ret += item->name;
01106 ret += string("\"");
01107 ret += string(" [");
01108 for (j = 0; j < nPrint; ++j)
01109 bufp += snprintf(bufp, bufEnd - bufp, "%.8g ", item->data[j]);
01110 ret += buf;
01111 ret += string("] ");
01112 }
01113 for (i = 0; i < points.size(); ++i) {
01114 char *bufp = buf;
01115 *bufp = '\0';
01116 ParamSetItem<Point> *item = points[i];
01117 typeString = "point ";
01118
01119 int nPrint = item->nItems;
01120 ret += string("\"");
01121 ret += typeString;
01122 ret += item->name;
01123 ret += string("\"");
01124 ret += string(" [");
01125 for (j = 0; j < nPrint; ++j)
01126 bufp += snprintf(bufp, bufEnd - bufp, "%.8g %.8g %.8g ", item->data[j].x,
01127 item->data[j].y, item->data[j].z);
01128 ret += buf;
01129 ret += string("] ");
01130 }
01131 for (i = 0; i < vectors.size(); ++i) {
01132 char *bufp = buf;
01133 *bufp = '\0';
01134 ParamSetItem<Vector> *item = vectors[i];
01135 typeString = "vector ";
01136
01137 int nPrint = item->nItems;
01138 ret += string("\"");
01139 ret += typeString;
01140 ret += item->name;
01141 ret += string("\"");
01142 ret += string(" [");
01143 for (j = 0; j < nPrint; ++j)
01144 bufp += snprintf(bufp, bufEnd - bufp, "%.8g %.8g %.8g ", item->data[j].x,
01145 item->data[j].y, item->data[j].z);
01146 ret += buf;
01147 ret += string("] ");
01148 }
01149 for (i = 0; i < normals.size(); ++i) {
01150 char *bufp = buf;
01151 *bufp = '\0';
01152 ParamSetItem<Normal> *item = normals[i];
01153 typeString = "normal ";
01154
01155 int nPrint = item->nItems;
01156 ret += string("\"");
01157 ret += typeString;
01158 ret += item->name;
01159 ret += string("\"");
01160 ret += string(" [");
01161 for (j = 0; j < nPrint; ++j)
01162 bufp += snprintf(bufp, bufEnd - bufp, "%.8g %.8g %.8g ", item->data[j].x,
01163 item->data[j].y, item->data[j].z);
01164 ret += buf;
01165 ret += string("] ");
01166 }
01167 for (i = 0; i < strings.size(); ++i) {
01168 char *bufp = buf;
01169 *bufp = '\0';
01170 ParamSetItem<string> *item = strings[i];
01171 typeString = "string ";
01172
01173 int nPrint = item->nItems;
01174 ret += string("\"");
01175 ret += typeString;
01176 ret += item->name;
01177 ret += string("\"");
01178 ret += string(" [");
01179 for (j = 0; j < nPrint; ++j)
01180 bufp += snprintf(bufp, bufEnd - bufp, "\"%s\" ", item->data[j].c_str());
01181 ret += buf;
01182 ret += string("] ");
01183 }
01184 for (i = 0; i < textures.size(); ++i) {
01185 char *bufp = buf;
01186 *bufp = '\0';
01187 ParamSetItem<string> *item = textures[i];
01188 typeString = "texture ";
01189
01190 int nPrint = item->nItems;
01191 ret += string("\"");
01192 ret += typeString;
01193 ret += item->name;
01194 ret += string("\"");
01195 ret += string(" [");
01196 for (j = 0; j < nPrint; ++j)
01197 bufp += snprintf(bufp, bufEnd - bufp, "\"%s\" ", item->data[j].c_str());
01198 ret += buf;
01199 ret += string("] ");
01200 }
01201 for (i = 0; i < spectra.size(); ++i) {
01202 char *bufp = buf;
01203 *bufp = '\0';
01204 ParamSetItem<RGBColor> *item = spectra[i];
01205 typeString = "color ";
01206
01207 int nPrint = item->nItems;
01208 ret += string("\"");
01209 ret += typeString;
01210 ret += item->name;
01211 ret += string("\"");
01212 ret += string(" [");
01213 for (j = 0; j < nPrint; ++j)
01214 bufp += snprintf(bufp, bufEnd - bufp, "%.8g %.8g %.8g ", item->data[j].c[0],
01215 item->data[j].c[1], item->data[j].c[2]);
01216 ret += buf;
01217 ret += string("] ");
01218 }
01219 return ret;
01220 }
01221
01222 boost::shared_ptr<Texture<SWCSpectrum> >
01223 TextureParams::GetSWCSpectrumTexture(const string &n,
01224 const RGBColor &def) const {
01225 string name = geomParams.FindTexture(n);
01226 if (name == "") name = materialParams.FindTexture(n);
01227 if (name != "") {
01228 if (SWCSpectrumTextures.find(name) != SWCSpectrumTextures.end())
01229 return SWCSpectrumTextures[name];
01230 else {
01231 std::stringstream ss;
01232 ss << "Couldn't find color texture named '" << name << "' for " << n;
01233 luxError(LUX_BADTOKEN, LUX_ERROR, ss.str().c_str());
01234 }
01235 }
01236 RGBColor val = geomParams.FindOneRGBColor(n,
01237 materialParams.FindOneRGBColor(n, def));
01238 return boost::shared_ptr<Texture<SWCSpectrum> >(new ConstantRGBColorTexture<SWCSpectrum>(val));
01239 }
01240 boost::shared_ptr<Texture<float> > TextureParams::GetFloatTexture(const string &n) const {
01241 string name = geomParams.FindTexture(n);
01242 if (name == "") name = materialParams.FindTexture(n);
01243 if (name != "") {
01244 if (floatTextures.find(name) != floatTextures.end())
01245 return floatTextures[name];
01246 else {
01247 std::stringstream ss;
01248 ss << "Couldn't find float texture named '" << name << "' for " << n;
01249 luxError(LUX_BADTOKEN, LUX_ERROR, ss.str().c_str());
01250 }
01251 }
01252 return boost::shared_ptr<Texture<float> >();
01253 }
01254 boost::shared_ptr<Texture<float> > TextureParams::GetFloatTexture(const string &n,
01255 float def) const {
01256 boost::shared_ptr<Texture<float> > texture = GetFloatTexture(n);
01257 if (texture) return texture;
01258 float val = FindFloat(n, def);
01259 return boost::shared_ptr<Texture<float> >(new ConstantFloatTexture<float>(val));
01260 }
01261