hooverContext * hooverContextNew() { hooverContext *ctx; ctx = (hooverContext *)calloc(1, sizeof(hooverContext)); if (ctx) { ctx->cam = limnCameraNew(); ELL_3V_SET(ctx->volSize, 0, 0, 0); ELL_3V_SET(ctx->volSpacing, AIR_NAN, AIR_NAN, AIR_NAN); ctx->volCentering = hooverDefVolCentering; ctx->shape = NULL; ctx->imgSize[0] = ctx->imgSize[1] = 0; ctx->imgCentering = hooverDefImgCentering; ctx->user = NULL; ctx->numThreads = 1; ctx->workIdx = 0; ctx->workMutex = NULL; ctx->renderBegin = hooverStubRenderBegin; ctx->threadBegin = hooverStubThreadBegin; ctx->rayBegin = hooverStubRayBegin; ctx->sample = hooverStubSample; ctx->rayEnd = hooverStubRayEnd; ctx->threadEnd = hooverStubThreadEnd; ctx->renderEnd = hooverStubRenderEnd; } return(ctx); }
int main(int argc, const char *argv[]) { const char *me; char *err; limnCamera *cam; float mat[16]; hestOpt *hopt=NULL; airArray *mop; mop = airMopNew(); cam = limnCameraNew(); airMopAdd(mop, cam, (airMopper)limnCameraNix, airMopAlways); me = argv[0]; hestOptAdd(&hopt, "fr", "eye pos", airTypeDouble, 3, 3, cam->from, NULL, "camera eye point"); hestOptAdd(&hopt, "at", "at pos", airTypeDouble, 3, 3, cam->at, "0 0 0", "camera look-at point"); hestOptAdd(&hopt, "up", "up dir", airTypeDouble, 3, 3, cam->up, "0 0 1", "camera pseudo up vector"); hestOptAdd(&hopt, "rh", NULL, airTypeInt, 0, 0, &(cam->rightHanded), NULL, "use a right-handed UVN frame (V points down)"); hestParseOrDie(hopt, argc-1, argv+1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE); airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways); airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); cam->neer = -1; cam->dist = 0; cam->faar = 1; cam->atRelative = AIR_TRUE; if (limnCameraUpdate(cam)) { fprintf(stderr, "%s: trouble:\n%s\n", me, err = biffGet(LIMN)); free(err); return 1; } printf("%s: W2V:\n", me); ELL_4M_COPY(mat, cam->W2V); ell_4m_print_f(stdout, mat); printf("\n"); printf("%s: V2W:\n", me); ELL_4M_COPY(mat, cam->V2W); ell_4m_print_f(stdout, mat); airMopOkay(mop); return 0; }
int main(int argc, const char *argv[]) { hestOpt *hopt=NULL; hestParm *hparm; Nrrd *nlight, *nmap, *ndebug; const char *me; char *outS, *errS, *debugS; airArray *mop; float amb[3], *linfo, *debug, *map, vscl; unsigned li, ui, vi; int qn, bits, method, doerr; limnLight *light; limnCamera *cam; double u, v, r, w, V2W[9], diff, WW[3], VV[3]; me = argv[0]; mop = airMopNew(); hparm = hestParmNew(); airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways); hparm->elideSingleEmptyStringDefault = AIR_TRUE; cam = limnCameraNew(); airMopAdd(mop, cam, (airMopper)limnCameraNix, airMopAlways); hestOptAdd(&hopt, "i", "nlight", airTypeOther, 1, 1, &nlight, NULL, "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"); hestOptAdd(&hopt, "fr", "from point", airTypeDouble, 3, 3, cam->from,"1 0 0", "position of camera, used to determine view vector"); hestOptAdd(&hopt, "at", "at point", airTypeDouble, 3, 3, cam->at, "0 0 0", "camera look-at point, used to determine view vector"); hestOptAdd(&hopt, "up", "up vector", airTypeDouble, 3, 3, cam->up, "0 0 1", "camera pseudo-up vector, used to determine view coordinates"); hestOptAdd(&hopt, "rh", NULL, airTypeInt, 0, 0, &(cam->rightHanded), NULL, "use a right-handed UVN frame (V points down)"); hestOptAdd(&hopt, "vs", "view-dir scaling", airTypeFloat, 1, 1, &vscl, "1", "scaling along view-direction of location of " "view-space lights"); hestOptAdd(&hopt, "o", "filename", airTypeString, 1, 1, &outS, NULL, "file to write output envmap to"); hestOptAdd(&hopt, "d", "filename", airTypeString, 1, 1, &debugS, "", "Use this option to save out (to the given filename) a rendering " "of the front (on the left) and back (on the right) of a sphere " "as shaded with the new environment map. U increases " "right-ward, V increases downward. The back sphere half is " "rendered as though the front half was removed"); hestOptAdd(&hopt, "err", NULL, airTypeInt, 0, 0, &doerr, NULL, "If using \"-d\", make the image represent the error between the " "real and quantized vector"); hestParseOrDie(hopt, argc-1, argv+1, hparm, me, emapInfo, AIR_TRUE, AIR_TRUE, AIR_TRUE); airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways); airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); switch(bits) { case 16: method = limnQN16octa; break; case 15: method = limnQN15octa; break; case 14: method = limnQN14octa; break; case 13: method = limnQN13octa; break; case 12: method = limnQN12octa; break; case 11: method = limnQN11octa; break; case 10: method = limnQN10octa; break; case 9: method = limnQN9octa; break; case 8: method = limnQN8octa; 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 && 7 == nlight->axis[0].size && LIMN_LIGHT_NUM >= nlight->axis[1].size)) { fprintf(stderr, "%s: nlight isn't valid format for light specification, " "must be: float type, 2-dimensional, 7\tx\tN size, N <= %d\n", me, LIMN_LIGHT_NUM); airMopError(mop); return 1; } cam->neer = -0.000000001; cam->dist = 0; cam->faar = 0.0000000001; cam->atRelative = AIR_TRUE; if (limnCameraUpdate(cam)) { airMopAdd(mop, errS = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: problem with camera:\n%s\n", me, errS); airMopError(mop); return 1; } light = limnLightNew(); airMopAdd(mop, light, (airMopper)limnLightNix, airMopAlways); limnLightAmbientSet(light, amb[0], amb[1], amb[2]); for (li=0; li<nlight->axis[1].size; li++) { int vsp; float lxyz[3]; linfo = (float *)(nlight->data) + 7*li; vsp = !!linfo[0]; ELL_3V_COPY(lxyz, linfo + 4); if (vsp) { lxyz[2] *= vscl; } limnLightSet(light, li, vsp, linfo[1], linfo[2], linfo[3], lxyz[0], lxyz[1], lxyz[2]); } if (limnLightUpdate(light, cam)) { airMopAdd(mop, errS = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: problem with lights:\n%s\n", me, errS); airMopError(mop); return 1; } 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); airMopError(mop); return 1; } map = (float *)nmap->data; if (nrrdSave(outS, nmap, NULL)) { fprintf(stderr, "%s: trouble:\n%s", me, errS = biffGetDone(NRRD)); free(errS); return 1; } if (airStrlen(debugS)) { ELL_34M_EXTRACT(V2W, cam->V2W); ndebug = nrrdNew(); nrrdMaybeAlloc_va(ndebug, nrrdTypeFloat, 3, AIR_CAST(size_t, 3), AIR_CAST(size_t, 1024), AIR_CAST(size_t, 512)); airMopAdd(mop, ndebug, (airMopper)nrrdNuke, airMopAlways); debug = (float *)ndebug->data; for (vi=0; vi<=511; vi++) { v = AIR_AFFINE(0, vi, 511, -0.999, 0.999); for (ui=0; ui<=511; ui++) { u = AIR_AFFINE(0, ui, 511, -0.999, 0.999); r = sqrt(u*u + v*v); if (r > 1) { continue; } w = sqrt(1 - r*r); /* first, the near side of the sphere */ ELL_3V_SET(VV, u, v, -w); ELL_3MV_MUL(WW, V2W, VV); qn = limnVtoQN_d[method](WW); if (doerr) { limnQNtoV_d[method](VV, qn); ELL_3V_SUB(WW, WW, VV); diff = ELL_3V_LEN(WW); ELL_3V_SET_TT(debug + 3*(ui + 1024*vi), float, diff, diff, diff); } else { ELL_3V_COPY(debug + 3*(ui + 1024*vi), map + 3*qn); } /* second, the far side of the sphere */ ELL_3V_SET(VV, u, v, w); ELL_3MV_MUL(WW, V2W, VV); qn = limnVtoQN_d[method](WW); if (doerr) { limnQNtoV_d[method](VV, qn); ELL_3V_SUB(WW, WW, VV); diff = ELL_3V_LEN(WW); ELL_3V_SET_TT(debug + 3*(ui + 512 + 1024*vi), float, diff, diff, diff); } else { ELL_3V_COPY(debug + 3*(ui + 512 + 1024*vi), map + 3*qn); } } }
int main(int argc, const char *argv[]) { const char *me; char *err, *inS, *outS; limnCamera *cam; float bg[3], winscale, edgeWidth[5], creaseAngle; hestOpt *hopt=NULL; airArray *mop; limnObject *obj; limnLook *look; unsigned int lookIdx; limnWindow *win; Nrrd *nmap; FILE *file; int wire, concave, describe, reverse, nobg; mop = airMopNew(); cam = limnCameraNew(); airMopAdd(mop, cam, (airMopper)limnCameraNix, airMopAlways); me = argv[0]; hestOptAdd(&hopt, "i", "input OFF", airTypeString, 1, 1, &inS, NULL, "input OFF file"); hestOptAdd(&hopt, "fr", "from point", airTypeDouble, 3, 3, cam->from,"4 4 4", "position of camera, used to determine view vector"); hestOptAdd(&hopt, "at", "at point", airTypeDouble, 3, 3, cam->at, "0 0 0", "camera look-at point, used to determine view vector"); hestOptAdd(&hopt, "up", "up vector", airTypeDouble, 3, 3, cam->up, "0 0 1", "camera pseudo-up vector, used to determine view coordinates"); hestOptAdd(&hopt, "rh", NULL, airTypeInt, 0, 0, &(cam->rightHanded), NULL, "use a right-handed UVN frame (V points down)"); hestOptAdd(&hopt, "or", NULL, airTypeInt, 0, 0, &(cam->orthographic), NULL, "use orthogonal projection"); hestOptAdd(&hopt, "ur", "uMin uMax", airTypeDouble, 2, 2, cam->uRange, "-1 1", "range in U direction of image plane"); hestOptAdd(&hopt, "vr", "vMin vMax", airTypeDouble, 2, 2, cam->vRange, "-1 1", "range in V direction of image plane"); hestOptAdd(&hopt, "e", "envmap", airTypeOther, 1, 1, &nmap, "", "16octa-based environment map", NULL, NULL, nrrdHestNrrd); hestOptAdd(&hopt, "ws", "winscale", airTypeFloat, 1, 1, &winscale, "200", "world to points (PostScript) scaling"); hestOptAdd(&hopt, "wire", NULL, airTypeInt, 0, 0, &wire, NULL, "just do wire-frame rendering"); hestOptAdd(&hopt, "concave", NULL, airTypeInt, 0, 0, &concave, NULL, "use slightly buggy rendering method suitable for " "concave or self-occluding objects"); hestOptAdd(&hopt, "reverse", NULL, airTypeInt, 0, 0, &reverse, NULL, "reverse ordering of vertices per face (needed if they " "specified in clockwise order)"); hestOptAdd(&hopt, "describe", NULL, airTypeInt, 0, 0, &describe, NULL, "for debugging: list object definition of OFF read"); hestOptAdd(&hopt, "bg", "background", airTypeFloat, 3, 3, bg, "1 1 1", "background RGB color; each component in range [0.0,1.0]"); hestOptAdd(&hopt, "nobg", NULL, airTypeInt, 0, 0, &nobg, NULL, "don't initially fill with background color"); hestOptAdd(&hopt, "wd", "5 widths", airTypeFloat, 5, 5, edgeWidth, "0.0 0.0 3.0 2.0 0.0", "width of edges drawn for five kinds of " "edges: back non-crease, back crease, " "silohuette, front crease, front non-crease"); hestOptAdd(&hopt, "ca", "angle", airTypeFloat, 1, 1, &creaseAngle, "30", "dihedral angles greater than this are creases"); hestOptAdd(&hopt, "o", "output PS", airTypeString, 1, 1, &outS, "out.ps", "output file to render postscript into"); hestParseOrDie(hopt, argc-1, argv+1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE); airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways); airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); cam->neer = -0.000000001; cam->dist = 0; cam->faar = 0.0000000001; cam->atRelative = AIR_TRUE; if (limnCameraUpdate(cam)) { fprintf(stderr, "%s: trouble:\n%s\n", me, err = biffGet(LIMN)); free(err); return 1; } obj = limnObjectNew(10, AIR_TRUE); airMopAdd(mop, obj, (airMopper)limnObjectNix, airMopAlways); if (!(file = airFopen(inS, stdin, "r"))) { fprintf(stderr, "%s: couldn't open \"%s\" for reading\n", me, inS); airMopError(mop); return 1; } airMopAdd(mop, file, (airMopper)airFclose, airMopAlways); if (limnObjectReadOFF(obj, file)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); airMopError(mop); return 1; } if (describe) { fprintf(stdout, "----------------- POST-READ -----------------\n"); limnObjectDescribe(stdout, obj); fprintf(stdout, "----------------- POST-READ -----------------\n"); } if (reverse) { if (limnObjectFaceReverse(obj)) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); airMopError(mop); return 1; } } if (describe) { fprintf(stdout, "----------------- POST-REVERSE -----------------\n"); limnObjectDescribe(stdout, obj); fprintf(stdout, "----------------- POST-REVERSE -----------------\n"); } win = limnWindowNew(limnDevicePS); win->ps.lineWidth[limnEdgeTypeBackFacet] = edgeWidth[0]; win->ps.lineWidth[limnEdgeTypeBackCrease] = edgeWidth[1]; win->ps.lineWidth[limnEdgeTypeContour] = edgeWidth[2]; win->ps.lineWidth[limnEdgeTypeFrontCrease] = edgeWidth[3]; win->ps.lineWidth[limnEdgeTypeFrontFacet] = edgeWidth[4]; win->ps.wireFrame = wire; win->ps.creaseAngle = creaseAngle; win->ps.noBackground = nobg; ELL_3V_COPY(win->ps.bg, bg); win->file = airFopen(outS, stdout, "w"); airMopAdd(mop, win, (airMopper)limnWindowNix, airMopAlways); win->scale = winscale; for (lookIdx=0; lookIdx<obj->lookNum; lookIdx++) { look = obj->look + lookIdx; /* earlier version of limn/test/soid used (0.2,0.8,0.0), I think. Now we assume that any useful shading is happening in the emap */ ELL_3V_SET(look->kads, 0.2, 0.8, 0); } if (limnObjectRender(obj, cam, win) || (concave ? limnObjectPSDrawConcave(obj, cam, nmap, win) : limnObjectPSDraw(obj, cam, nmap, win))) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); airMopError(mop); return 1; } fclose(win->file); if (describe) { fprintf(stdout, "----------------- POST-RENDER -----------------\n"); limnObjectDescribe(stdout, obj); fprintf(stdout, "----------------- POST-RENDER -----------------\n"); } airMopOkay(mop); return 0; }
int main(int argc, char *argv[]) { char *me, *err, *outS; limnCamera *cam; float matA[16], matB[16], winscale, edgeWidth[5]; hestOpt *hopt=NULL; airArray *mop; limnObject *obj; limnLook *look; int lookIdx; limnWindow *win; int partIdx, wire, concave; Nrrd *nmap; mop = airMopNew(); cam = limnCameraNew(); airMopAdd(mop, cam, (airMopper)limnCameraNix, airMopAlways); me = argv[0]; hestOptAdd(&hopt, "fr", "from point", airTypeDouble, 3, 3, cam->from,"4 4 4", "position of camera, used to determine view vector"); hestOptAdd(&hopt, "at", "at point", airTypeDouble, 3, 3, cam->at, "0 0 0", "camera look-at point, used to determine view vector"); hestOptAdd(&hopt, "up", "up vector", airTypeDouble, 3, 3, cam->up, "0 0 1", "camera pseudo-up vector, used to determine view coordinates"); hestOptAdd(&hopt, "rh", NULL, airTypeInt, 0, 0, &(cam->rightHanded), NULL, "use a right-handed UVN frame (V points down)"); hestOptAdd(&hopt, "or", NULL, airTypeInt, 0, 0, &(cam->orthographic), NULL, "use orthogonal projection"); hestOptAdd(&hopt, "ur", "uMin uMax", airTypeDouble, 2, 2, cam->uRange, "-1 1", "range in U direction of image plane"); hestOptAdd(&hopt, "vr", "vMin vMax", airTypeDouble, 2, 2, cam->vRange, "-1 1", "range in V direction of image plane"); hestOptAdd(&hopt, "e", "envmap", airTypeOther, 1, 1, &nmap, NULL, "16checker-based environment map", NULL, NULL, nrrdHestNrrd); hestOptAdd(&hopt, "ws", "winscale", airTypeFloat, 1, 1, &winscale, "200", "world to points (PostScript) scaling"); hestOptAdd(&hopt, "wire", NULL, airTypeInt, 0, 0, &wire, NULL, "just do wire-frame rendering"); hestOptAdd(&hopt, "concave", NULL, airTypeInt, 0, 0, &concave, NULL, "use slightly buggy rendering method suitable for " "concave or self-occluding objects"); hestOptAdd(&hopt, "wd", "5 widths", airTypeFloat, 5, 5, edgeWidth, "0.0 0.0 3.0 2.0 0.0", "width of edges drawn for five kinds of " "edges: back non-crease, back crease, " "silohuette, front crease, front non-crease"); hestOptAdd(&hopt, "o", "output PS", airTypeString, 1, 1, &outS, "out.ps", "output file to render postscript into"); hestParseOrDie(hopt, argc-1, argv+1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE); airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways); airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways); cam->neer = -0.000000001; cam->dist = 0; cam->faar = 0.0000000001; cam->atRelative = AIR_TRUE; if (limnCameraUpdate(cam)) { fprintf(stderr, "%s: trouble:\n%s\n", me, err = biffGet(LIMN)); free(err); return 1; } obj = limnObjectNew(10, AIR_TRUE); airMopAdd(mop, obj, (airMopper)limnObjectNix, airMopAlways); /* create limnLooks for diffuse (#0) and flat (#1) shading */ lookIdx = airArrayLenIncr(obj->lookArr, 2); look = obj->look + lookIdx + 0; ELL_4V_SET(look->rgba, 1, 1, 1, 1); ELL_3V_SET(look->kads, 0, 1, 0); look->spow = 0; look = obj->look + lookIdx + 1; ELL_4V_SET(look->rgba, 1, 1, 1, 1); ELL_3V_SET(look->kads, 1, 0, 0); look->spow = 0; /* X axis: rod */ partIdx = limnObjectCylinderAdd(obj, 0, 0, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 1, 0.2, 0.2); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 1.3, 0.0, 0.0); ell_4m_post_mul_f(matA, matB); limnObjectPartTransform(obj, partIdx, matA); /* Y axis: rod + ball */ partIdx = limnObjectCylinderAdd(obj, 0, 1, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 0.2, 1, 0.2); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 1.3, 0.0); ell_4m_post_mul_f(matA, matB); limnObjectPartTransform(obj, partIdx, matA); partIdx = limnObjectPolarSphereAdd(obj, 0, 0, 32, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 0.28, 0.28, 0.28); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 2.6, 0.0); ell_4m_post_mul_f(matA, matB); limnObjectPartTransform(obj, partIdx, matA); /* Z axis: rod + ball + ball */ partIdx = limnObjectCylinderAdd(obj, 0, 2, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 0.2, 0.2, 1); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, 1.3); ell_4m_post_mul_f(matA, matB); limnObjectPartTransform(obj, partIdx, matA); partIdx = limnObjectPolarSphereAdd(obj, 0, 1, 32, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 0.28, 0.28, 0.28); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, 2.6); ell_4m_post_mul_f(matA, matB); limnObjectPartTransform(obj, partIdx, matA); partIdx = limnObjectPolarSphereAdd(obj, 0, 2, 32, 16); ELL_4M_IDENTITY_SET(matA); ELL_4M_SCALE_SET(matB, 0.28, 0.28, 0.28); ell_4m_post_mul_f(matA, matB); ELL_4M_TRANSLATE_SET(matB, 0.0, 0.0, 3.2); ell_4m_post_mul_f(matA, matB); limnObjectPartTransform(obj, partIdx, matA); win = limnWindowNew(limnDevicePS); win->scale = winscale; win->ps.wireFrame = wire; win->ps.lineWidth[limnEdgeTypeBackFacet] = edgeWidth[0]; win->ps.lineWidth[limnEdgeTypeBackCrease] = edgeWidth[1]; win->ps.lineWidth[limnEdgeTypeContour] = edgeWidth[2]; win->ps.lineWidth[limnEdgeTypeFrontCrease] = edgeWidth[3]; win->ps.lineWidth[limnEdgeTypeFrontFacet] = edgeWidth[4]; win->file = fopen(outS, "w"); airMopAdd(mop, win, (airMopper)limnWindowNix, airMopAlways); if (limnObjectRender(obj, cam, win) || (concave ? limnObjectPSDrawConcave(obj, cam, nmap, win) : limnObjectPSDraw(obj, cam, nmap, win))) { airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); airMopError(mop); return 1; } fclose(win->file); airMopOkay(mop); return 0; }
int main(int argc, char **argv) { Nrrd *nraw; limnCamera *cam; echoRTParm *parm; echoGlobalState *state; echoScene *scene; airArray *mop; char *me, *err, *env; int E, tmp; AIR_UNUSED(argc); me = argv[0]; mop = airMopNew(); cam = limnCameraNew(); airMopAdd(mop, cam, (airMopper)limnCameraNix, airMopAlways); cam->neer = 0; cam->dist = 0; cam->faar = 0; cam->atRelative = AIR_TRUE; cam->dist = 0; cam->rightHanded = AIR_TRUE; parm = echoRTParmNew(); airMopAdd(mop, parm, (airMopper)echoRTParmNix, airMopAlways); state = echoGlobalStateNew(); airMopAdd(mop, state, (airMopper)echoGlobalStateNix, airMopAlways); scene = echoSceneNew(); airMopAdd(mop, scene, (airMopper)echoSceneNix, airMopAlways); nraw = nrrdNew(); airMopAdd(mop, nraw, (airMopper)nrrdNuke, airMopAlways); /* makeSceneGlass(cam, parm, scene); */ /* makeSceneGlass2(cam, parm, scene); */ /* makeSceneGlassMetal(cam, parm, scene); */ /* makeSceneGlassTest(cam, parm, scene); */ /* makeSceneBVH(cam, parm, scene); */ /* makeSceneInstance(cam, parm, scene); */ /* makeSceneTexture(cam, parm, scene); */ /* makeSceneSimple(cam, parm, scene); */ /* makeSceneRainLights(cam, parm, scene); */ /* makeSceneAntialias(cam, parm, scene); */ makeSceneShadow(cam, parm, scene); /* makeSceneDOF(cam, parm, scene); */ if ((env = getenv("NT"))) { if (1 == sscanf(env, "%d", &tmp)) { parm->numThreads = tmp; } } else { parm->numThreads = 1; } E = 0; if (!E) E |= echoRTRender(nraw, cam, scene, parm, state); if (E) { airMopAdd(mop, err = biffGetDone(ECHO), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); airMopError(mop); return 1; } printf("render time = %g seconds (%g fps)\n", state->time, 1.0/state->time); if (!E) E |= nrrdSave("raw.nrrd", nraw, NULL); if (E) { airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways); fprintf(stderr, "%s: trouble:\n%s\n", me, err); airMopError(mop); return 1; } airMopOkay(mop); return 0; }