--- ray/src/util/ranimove1.c 2008/04/17 14:44:25 3.13 +++ ray/src/util/ranimove1.c 2010/11/05 04:36:24 3.16 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: ranimove1.c,v 3.13 2008/04/17 14:44:25 greg Exp $"; +static const char RCSid[] = "$Id: ranimove1.c,v 3.16 2010/11/05 04:36:24 greg Exp $"; #endif /* * ranimove1.c @@ -54,6 +54,7 @@ static void setmotion(int n, FVECT wpos); static void init_frame_sample(void); +#if 0 extern void write_map( /* write out float map (debugging) */ float *mp, @@ -79,6 +80,7 @@ write_map( /* write out float map (debugging) */ } fclose(fp); } +#endif static void @@ -105,6 +107,7 @@ next_frame(void) /* prepare next frame buffer */ error(USER, errmsg); } if (cbuffer == NULL) { + int n; /* compute resolution and allocate */ switch (sscanf(vval(RESOLUTION), "%d %d %lf", &hres, &vres, &pixaspect)) { @@ -140,6 +143,10 @@ next_frame(void) /* prepare next frame buffer */ (cprev==NULL) | (zprev == NULL) | (oprev==NULL) | (aprev==NULL)) error(SYSTEM, "out of memory in init_frame"); + for (n = hres*vres; n--; ) { + zprev[n] = -1.f; + oprev[n] = OVOID; + } frm_stop = getTime() + rtperfrm; } else { COLOR *cp; /* else just swap buffers */ @@ -369,8 +376,10 @@ init_frame_sample(void) /* sample our initial frame * if (!sample_here(x, y)) { /* just cast */ rayorigin(&ir, PRIMARY, NULL, NULL); if (!localhit(&ir, &thescene)) { - if (ir.ro != &Aftplane) - sourcehit(&ir); + if (ir.ro != &Aftplane && sourcehit(&ir)) { + rayshade(&ir, ir.ro->omod); + rayparticipate(&ir); + } copycolor(cbuffer[n], ir.rcol); zbuffer[n] = ir.rot; obuffer[n] = ir.robj; @@ -399,7 +408,7 @@ init_frame_sample(void) /* sample our initial frame * zbuffer[n] = ir.rot; obuffer[n] = ir.robj; sbuffer[n] = 1; - if (ir.rot >= FHUGE) + if (ir.rot >= 0.99*FHUGE) abuffer[n] = ADISTANT; else { abuffer[n] = ALOWQ; @@ -452,15 +461,12 @@ getambcolor( /* get ambient color for object if we ca if (obj == OVOID) return(0); - op = objptr(obj); - if ((op->otype == OBJ_INSTANCE) & (op->omod == OVOID)) + op = objptr(obj); /* search for material */ + if (op->omod == OVOID) return(0); - /* search for material */ - do { - if (op->omod == OVOID || ofun[op->otype].flags & T_X) - return(0); - op = objptr(op->omod); - } while (!ismaterial(op->otype)); + op = findmaterial(objptr(op->omod)); + if (op == NULL) + return(0); /* * Since this routine is called to compute the difference * from rendering with and without interreflections, @@ -474,7 +480,7 @@ getambcolor( /* get ambient color for object if we ca if (lv[0] == op->oname[0] && !strcmp(lv+1, op->oname+1)) break; - if ((lv != NULL) != hirendparams.ambincl) + if ((lv != NULL) ^ hirendparams.ambincl) return(0); } switch (op->otype) { @@ -664,12 +670,6 @@ init_frame(void) /* render base (low quality) frame restart = (!nobjects || vdef(MOVE)); if (!restart && curparams != &lorendparams && nprocs > 1) restart = -1; - if (restart > 0) { - if (nprocs > 1) - ray_pdone(0); - else - ray_done(0); - } /* post low quality parameters */ if (curparams != &lorendparams) ray_restore(curparams = &lorendparams); @@ -701,7 +701,7 @@ init_frame(void) /* render base (low quality) frame init_frame_sample(); /* initialize frame error */ comp_frame_error(); -return; +#if 0 { float *ebuf = (float *)malloc(sizeof(float)*hres*vres); char fnm[256]; @@ -713,6 +713,7 @@ return; write_map(ebuf, fnm); free((void *)ebuf); } +#endif } @@ -903,7 +904,7 @@ send_frame(void) /* send frame to destination */ int y; /* open output picture */ sprintf(pfname, vval(BASENAME), fcur); - strcat(pfname, ".pic"); + strcat(pfname, ".hdr"); fp = fopen(pfname, "w"); if (fp == NULL) { sprintf(errmsg, "cannot open output frame \"%s\"", pfname);