4 |
|
/* |
5 |
|
* ranimove1.c |
6 |
|
* |
7 |
< |
* Basic frame rendering routines for ranimate(1). |
7 |
> |
* Basic frame rendering routines for ranimove(1). |
8 |
|
* |
9 |
|
* Created by Gregory Ward on Wed Jan 08 2003. |
10 |
|
*/ |
54 |
|
static void init_frame_sample(void); |
55 |
|
|
56 |
|
|
57 |
+ |
#if 0 |
58 |
|
extern void |
59 |
|
write_map( /* write out float map (debugging) */ |
60 |
|
float *mp, |
80 |
|
} |
81 |
|
fclose(fp); |
82 |
|
} |
83 |
+ |
#endif |
84 |
|
|
85 |
|
|
86 |
|
static void |
369 |
|
continue; |
370 |
|
} |
371 |
|
if (!sample_here(x, y)) { /* just cast */ |
372 |
< |
rayorigin(&ir, NULL, PRIMARY, 1.0); |
372 |
> |
rayorigin(&ir, PRIMARY, NULL, NULL); |
373 |
|
if (!localhit(&ir, &thescene)) { |
374 |
|
if (ir.ro != &Aftplane) |
375 |
|
sourcehit(&ir); |
387 |
|
} |
388 |
|
if (nprocs > 1) { /* get sample */ |
389 |
|
int rval; |
390 |
< |
rayorigin(&ir, NULL, PRIMARY, 1.0); |
390 |
> |
rayorigin(&ir, PRIMARY, NULL, NULL); |
391 |
|
ir.rno = n; |
392 |
|
rval = ray_pqueue(&ir); |
393 |
|
if (!rval) |
660 |
|
init_frame(void) /* render base (low quality) frame */ |
661 |
|
{ |
662 |
|
int restart; |
661 |
– |
|
663 |
|
/* allocate/swap buffers */ |
664 |
|
next_frame(); |
665 |
|
/* check rendering status */ |
666 |
|
restart = (!nobjects || vdef(MOVE)); |
667 |
|
if (!restart && curparams != &lorendparams && nprocs > 1) |
668 |
|
restart = -1; |
668 |
– |
if (restart > 0) { |
669 |
– |
if (nprocs > 1) |
670 |
– |
ray_pdone(1); |
671 |
– |
else |
672 |
– |
ray_done(1); |
673 |
– |
} |
669 |
|
/* post low quality parameters */ |
670 |
|
if (curparams != &lorendparams) |
671 |
|
ray_restore(curparams = &lorendparams); |
697 |
|
init_frame_sample(); |
698 |
|
/* initialize frame error */ |
699 |
|
comp_frame_error(); |
700 |
< |
return; |
700 |
> |
#if 0 |
701 |
|
{ |
702 |
|
float *ebuf = (float *)malloc(sizeof(float)*hres*vres); |
703 |
|
char fnm[256]; |
709 |
|
write_map(ebuf, fnm); |
710 |
|
free((void *)ebuf); |
711 |
|
} |
712 |
+ |
#endif |
713 |
|
} |
714 |
|
|
715 |
|
|
758 |
|
continue; |
759 |
|
nc = getclosest(neigh, NPINTERP, x, y); |
760 |
|
setcolor(cbuffer[n], 0., 0., 0.); |
761 |
+ |
if (nc <= 0) { /* no acceptable neighbors */ |
762 |
+ |
if (y < vres-1) |
763 |
+ |
nc = fndx(x, y+1); |
764 |
+ |
else if (x < hres-1) |
765 |
+ |
nc = fndx(x+1, y); |
766 |
+ |
else |
767 |
+ |
continue; |
768 |
+ |
copycolor(cbuffer[n], cbuffer[nc]); |
769 |
+ |
continue; |
770 |
+ |
} |
771 |
|
wsum = 0.; |
772 |
|
while (nc-- > 0) { |
773 |
|
copycolor(cval, cbuffer[neigh[nc]]); |
777 |
|
addcolor(cbuffer[n], cval); |
778 |
|
wsum += w; |
779 |
|
} |
780 |
< |
if (wsum > FTINY) { |
781 |
< |
w = 1.0/wsum; |
776 |
< |
scalecolor(cbuffer[n], w); |
777 |
< |
} |
780 |
> |
w = 1.0/wsum; |
781 |
> |
scalecolor(cbuffer[n], w); |
782 |
|
} |
783 |
|
/* motion blur if requested */ |
784 |
|
if (mblur > .02) { |