ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rholo2.c
Revision: 3.2
Committed: Fri Oct 31 11:44:09 1997 UTC (26 years, 5 months ago) by gregl
Content type: text/plain
Branch: MAIN
Changes since 3.1: +6 -1 lines
Log Message:
initial bug fixes

File Contents

# Content
1 /* Copyright (c) 1997 Silicon Graphics, Inc. */
2
3 #ifndef lint
4 static char SCCSid[] = "$SunId$ SGI";
5 #endif
6
7 /*
8 * Rtrace support routines for holodeck rendering
9 */
10
11 #include "rholo.h"
12 #include "random.h"
13
14
15 packrays(rod, p) /* pack ray origins and directions */
16 register float *rod;
17 register PACKET *p;
18 {
19 static FVECT ro, rd;
20 BCOORD gc;
21 double d;
22 long r1, r2;
23 register int i;
24
25 if (!hdbcoord(gc, hdlist[p->hd], p->bi))
26 error(CONSISTENCY, "bad beam index in packrays");
27 for (i = 0; i < p->nr; i++) {
28 r1 = random(); r2 = random();
29 p->ra[i].r[0][0] = r1 ^ r2>>7;
30 p->ra[i].r[0][1] = r1<<2 ^ r2;
31 p->ra[i].r[1][0] = r1<<4 ^ r2>>15;
32 p->ra[i].r[1][1] = r1<<6 ^ r2>>23;
33 d = hdray(ro, rd, hdlist[p->hd], gc, p->ra[i].r);
34 if (p->offset != NULL) {
35 VSUM(ro, ro, rd, d); /* exterior only */
36 p->offset[i] = d;
37 }
38 VCOPY(rod, ro);
39 rod += 3;
40 VCOPY(rod, rd);
41 rod += 3;
42 }
43 }
44
45
46 donerays(p, rvl) /* encode finished ray computations */
47 register PACKET *p;
48 register float *rvl;
49 {
50 double d;
51 register int i;
52
53 for (i = 0; i < p->nr; i++) {
54 setcolr(p->ra[i].v, rvl[0], rvl[1], rvl[2]);
55 d = rvl[3];
56 if (p->offset != NULL)
57 d += p->offset[i];
58 p->ra[i].d = hdcode(hdlist[p->hd], d);
59 rvl += 4;
60 }
61 }