| 1 |
– |
/* Copyright (c) 1990 Regents of the University of California */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* o_instance.c - routines for computing ray intersections with octrees. |
| 9 |
– |
* |
| 10 |
– |
* 11/11/88 |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
+ |
#include "copyright.h" |
| 9 |
+ |
|
| 10 |
|
#include "ray.h" |
| 11 |
|
|
| 12 |
|
#include "instance.h" |
| 21 |
|
register int i; |
| 22 |
|
/* get the octree */ |
| 23 |
|
in = getinstance(o, IO_ALL); |
| 24 |
< |
/* duplicate and clear ray */ |
| 24 |
> |
/* copy and transform ray */ |
| 25 |
|
copystruct(&rcont, r); |
| 29 |
– |
rayclear(&rcont); |
| 30 |
– |
/* transform ray to new space */ |
| 26 |
|
multp3(rcont.rorg, r->rorg, in->x.b.xfm); |
| 27 |
|
multv3(rcont.rdir, r->rdir, in->x.b.xfm); |
| 28 |
|
for (i = 0; i < 3; i++) |
| 29 |
|
rcont.rdir[i] /= in->x.b.sca; |
| 30 |
< |
/* trace it */ |
| 30 |
> |
rcont.rmax *= in->x.b.sca; |
| 31 |
> |
/* clear and trace it */ |
| 32 |
> |
rayclear(&rcont); |
| 33 |
|
if (!localhit(&rcont, &in->obj->scube)) |
| 34 |
|
return(0); /* missed */ |
| 35 |
|
if (rcont.rot * in->x.f.sca >= r->rot) |