1 |
– |
/* Copyright (c) 1986 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 |
|
* m_clip.c - routine for clipped (cut) objects. |
9 |
– |
* |
10 |
– |
* 3/17/86 |
6 |
|
*/ |
7 |
|
|
8 |
+ |
#include "copyright.h" |
9 |
+ |
|
10 |
|
#include "ray.h" |
11 |
|
|
12 |
|
/* |
18 |
|
*/ |
19 |
|
|
20 |
|
|
21 |
+ |
int |
22 |
|
m_clip(m, r) /* clip objects from ray */ |
23 |
|
register OBJREC *m; |
24 |
|
register RAY *r; |
25 |
|
{ |
26 |
|
OBJECT cset[MAXSET+1], *modset; |
27 |
+ |
OBJECT obj, mod; |
28 |
|
int entering; |
29 |
|
register int i; |
30 |
|
|
31 |
+ |
obj = objndx(m); |
32 |
|
if ((modset = (OBJECT *)m->os) == NULL) { |
33 |
– |
register OBJECT mod; |
34 |
– |
|
33 |
|
if (m->oargs.nsargs < 1 || m->oargs.nsargs > MAXSET) |
34 |
|
objerror(m, USER, "bad # arguments"); |
35 |
|
modset = (OBJECT *)malloc((m->oargs.nsargs+1)*sizeof(OBJECT)); |
39 |
|
for (i = 0; i < m->oargs.nsargs; i++) { |
40 |
|
if (!strcmp(m->oargs.sarg[i], VOIDID)) |
41 |
|
continue; |
42 |
< |
if ((mod = modifier(m->oargs.sarg[i])) == OVOID) { |
42 |
> |
if ((mod = lastmod(obj, m->oargs.sarg[i])) == OVOID) { |
43 |
|
sprintf(errmsg, "unknown modifier \"%s\"", |
44 |
|
m->oargs.sarg[i]); |
45 |
|
objerror(m, WARNING, errmsg); |
87 |
|
inside--; |
88 |
|
if (inside > 0) { /* we just hit the object */ |
89 |
|
flipsurface(r); |
90 |
< |
rayshade(r, modifier(m->oargs.sarg[0])); |
93 |
< |
return; |
90 |
> |
return(rayshade(r, lastmod(obj, m->oargs.sarg[0]))); |
91 |
|
} |
92 |
|
} |
93 |
|
raytrans(r); /* else transfer ray */ |
94 |
+ |
return(1); |
95 |
|
} |