/************** Output Routines ***************/ void dumpall(struct application *ap, int depth) { int i; union radrec r; if ( depth > numreflect ) { bu_log( "dumpall: %d reflections!\n", depth ); } /* Firing record */ /*printf( "Ray [%d %d], depth = %d\n", ap->a_x, ap->a_y, depth );*/ memset((char *)&r, 0, sizeof(r)); /*XXX*/ r.f.head[0] = 'f'; r.f.head[1] = 'i'; r.f.head[2] = 'r'; r.f.head[3] = 'e'; /* * Make sure there's enough space in * the physical record. */ i = 1 + depth; if ( depth < numreflect ) i++; /* escape */ if ( precindex + i > 256 ) writephysrec( outfp ); r.f.irf = i-1; /* num recs in ray, not counting fire */ r.f.ox = ap->a_ray.r_pt[0]; /* ray origin */ r.f.oy = ap->a_ray.r_pt[1]; r.f.oz = ap->a_ray.r_pt[2]; r.f.h = (ap->a_x - width/2) * viewsize/width; r.f.v = (ap->a_y - height/2) * viewsize/height; r.f.ih = ap->a_x + 1; /* Radsim counts from 1 */ r.f.iv = ap->a_y + 1; writerec( &r, outfp ); for ( i = 0; i < depth; i++ ) { dumpray( &rayinfo[i] ); } if ( depth == numreflect ) return; /* no escape */ /* Escape record */ memset((char *)&r, 0, sizeof(r)); /*XXX*/ r.e.head[0] = 'e'; r.e.head[1] = 's'; r.e.head[2] = 'c'; r.e.head[3] = 'p'; r.e.sight = -3; /* XXX line of sight for escape? */ r.e.dx = rayinfo[depth-1].spec[0]; /* escape direction */ r.e.dy = rayinfo[depth-1].spec[1]; r.e.dz = rayinfo[depth-1].spec[2]; writerec( &r, outfp ); }
/* * Write a logical record * * Outputs the current physical record if full. */ int writerec(union radrec *rp, FILE *fp) { if ( precindex >= 256 ) { if ( writephysrec( fp ) == 0 ) return( 0 ); } memcpy(&physrec[precindex*sizeof(*rp)], rp, sizeof(*rp)); precindex++; recnum++; if ( precindex >= 256 ) { if ( writephysrec( fp ) == 0 ) return( 0 ); } return( 1 ); }
/* end of a frame */ void view_end(void) { /* flush any partial output record */ if ( precindex > 0 ) { writephysrec( outfp ); } bu_log( "view_end: %d physical records, (%d/%d) logical\n", precnum, recnum, precnum*256 ); }
/* end of a frame */ void view_end(struct application *UNUSED(ap)) { /* flush any partial output record */ if (precindex > 0) { writephysrec(outfp); } bu_log("view_end: %d physical records, (%d/%d) logical\n", precnum, recnum, precnum*256); }