| 26 |
|
|
| 27 |
|
#include "ray.h" |
| 28 |
|
|
| 29 |
+ |
#include "octree.h" |
| 30 |
+ |
|
| 31 |
|
#include "otypes.h" |
| 32 |
|
|
| 33 |
|
int inform = 'a'; /* input format */ |
| 59 |
|
oputp(), oputn(), oputs(), oputw(), oputm(); |
| 60 |
|
|
| 61 |
|
static int (*ray_out[10])(), (*every_out[10])(); |
| 62 |
+ |
static int castonly; |
| 63 |
|
|
| 64 |
|
static int puta(), putf(), putd(); |
| 65 |
|
|
| 129 |
|
extern int ourtrace(), (*trace)(); |
| 130 |
|
register int (**table)() = ray_out; |
| 131 |
|
|
| 132 |
+ |
castonly = 1; |
| 133 |
|
while (*vs) |
| 134 |
|
switch (*vs++) { |
| 135 |
|
case 't': /* trace */ |
| 136 |
|
*table = NULL; |
| 137 |
|
table = every_out; |
| 138 |
|
trace = ourtrace; |
| 139 |
+ |
castonly = 0; |
| 140 |
|
break; |
| 141 |
|
case 'o': /* origin */ |
| 142 |
|
*table++ = oputo; |
| 146 |
|
break; |
| 147 |
|
case 'v': /* value */ |
| 148 |
|
*table++ = oputv; |
| 149 |
+ |
castonly = 0; |
| 150 |
|
break; |
| 151 |
|
case 'l': /* length */ |
| 152 |
|
*table++ = oputl; |
| 153 |
+ |
castonly = 0; |
| 154 |
|
break; |
| 155 |
|
case 'p': /* point */ |
| 156 |
|
*table++ = oputp; |
| 180 |
|
VCOPY(thisray.rorg, org); |
| 181 |
|
VCOPY(thisray.rdir, dir); |
| 182 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
| 183 |
< |
rayvalue(&thisray); |
| 183 |
> |
if (castonly) |
| 184 |
> |
localhit(&thisray, &thescene) || sourcehit(&thisray); |
| 185 |
> |
else |
| 186 |
> |
rayvalue(&thisray); |
| 187 |
|
|
| 188 |
|
if (ray_out[0] == NULL) |
| 189 |
|
return; |