|
From: <kin...@us...> - 2004-02-27 16:52:16
|
Update of /cvsroot/teem/teem/src/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20918/bin Modified Files: emap.c Log Message: starting to expand number of quantized normal schemes Index: emap.c =================================================================== RCS file: /cvsroot/teem/teem/src/bin/emap.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** emap.c 9 Feb 2004 07:20:46 -0000 1.7 --- emap.c 27 Feb 2004 16:42:52 -0000 1.8 *************** *** 24,29 **** #include <teem/limn.h> ! char *emapInfo = ("Creates environment maps based on limn's 16checker " ! "normal quantization method. By taking into account " "camera parameters, this allows for both lights in " "both world and view space. Solely out of laziness, " --- 24,29 ---- #include <teem/limn.h> ! char *emapInfo = ("Creates environment maps based on limn's \"checker\" " ! "normal quantization methods. By taking into account " "camera parameters, this allows for both lights in " "both world and view space. Solely out of laziness, " *************** *** 41,46 **** char *me, *outS, *errS, *debugS; airArray *mop; ! float amb[3], *linfo, *debug, *map, W[3], V[3]; ! int li, ui, vi, qn; limnLight *light; limnCamera *cam; --- 41,46 ---- char *me, *outS, *errS, *debugS; airArray *mop; ! float amb[3], *linfo, *debug, *map, W[3], V[3], diff; ! int li, ui, vi, qn, bits, method; limnLight *light; limnCamera *cam; *************** *** 57,60 **** --- 57,63 ---- "input nrrd containing light information", NULL, NULL, nrrdHestNrrd); + hestOptAdd(&hopt, "b", "# bits", airTypeInt, 1, 1, &bits, "16", + "number of bits to use for normal quantization, " + "between 8 and 16 inclusive. "); hestOptAdd(&hopt, "amb", "ambient RGB", airTypeFloat, 3, 3, amb, "0 0 0", "ambient light color"); *************** *** 80,83 **** --- 83,102 ---- airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); + switch(bits) { + case 16: method = limnQN16checker; break; + case 15: method = limnQN15checker; break; + case 14: method = limnQN14checker; break; + case 13: method = limnQN13checker; break; + case 12: method = limnQN12checker; break; + case 11: method = limnQN11checker; break; + case 10: method = limnQN10checker; break; + case 9: method = limnQN9checker; break; + case 8: method = limnQN8checker; break; + default: + fprintf(stderr, "%s: requested #bits (%d) not in valid range [8,16]\n", + me, bits); + airMopError(mop); return 1; + } + if (!(nrrdTypeFloat == nlight->type && 2 == nlight->dim && *************** *** 111,115 **** nmap=nrrdNew(); airMopAdd(mop, nmap, (airMopper)nrrdNuke, airMopAlways); ! if (limnEnvMapFill(nmap, limnLightDiffuseCB, limnQN16checker, light)) { airMopAdd(mop, errS = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: problem making environment map:\n%s\n", me, errS); --- 130,134 ---- nmap=nrrdNew(); airMopAdd(mop, nmap, (airMopper)nrrdNuke, airMopAlways); ! if (limnEnvMapFill(nmap, limnLightDiffuseCB, method, light)) { airMopAdd(mop, errS = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: problem making environment map:\n%s\n", me, errS); *************** *** 141,152 **** ELL_3V_SET(V, u, v, -w); ELL_3MV_MUL(W, V2W, V); ! qn = limnVtoQN_f[limnQN16checker](W); ELL_3V_COPY(debug + 3*(ui + 1024*vi), map + 3*qn); /* second, the far side of the sphere */ ELL_3V_SET(V, u, v, w); ELL_3MV_MUL(W, V2W, V); ! qn = limnVtoQN_f[limnQN16checker](W); ELL_3V_COPY(debug + 3*(ui + 512 + 1024*vi), map + 3*qn); } } --- 160,185 ---- ELL_3V_SET(V, u, v, -w); ELL_3MV_MUL(W, V2W, V); ! qn = limnVtoQN_f[method](W); ! /* ! limnQNtoV_f[method](V, qn); ! ELL_3V_SUB(W, W, V); ! diff = ELL_3V_LEN(W); ! ELL_3V_SET(debug + 3*(ui + 1024*vi), diff, diff, diff); ! */ ELL_3V_COPY(debug + 3*(ui + 1024*vi), map + 3*qn); + /* second, the far side of the sphere */ ELL_3V_SET(V, u, v, w); ELL_3MV_MUL(W, V2W, V); ! qn = limnVtoQN_f[method](W); ! /* ! limnQNtoV_f[method](V, qn); ! ELL_3V_SUB(W, W, V); ! diff = ELL_3V_LEN(W); ! ELL_3V_SET(debug + 3*(ui + 512 + 1024*vi), diff, diff, diff); ! */ ELL_3V_COPY(debug + 3*(ui + 512 + 1024*vi), map + 3*qn); + } } |