1 |
– |
/* Copyright (c) 1995 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 |
|
* rview.c - routines and variables for interactive view generation. |
6 |
|
* |
7 |
< |
* 3/24/87 |
7 |
> |
* External symbols declared in rpaint.h |
8 |
|
*/ |
9 |
|
|
10 |
+ |
#include "copyright.h" |
11 |
+ |
|
12 |
|
#include "ray.h" |
13 |
|
|
14 |
|
#include "rpaint.h" |
17 |
|
|
18 |
|
#include <ctype.h> |
19 |
|
|
20 |
< |
VIEW ourview = STDVIEW; /* viewing parameters */ |
21 |
< |
int hresolu, vresolu; /* image resolution */ |
20 |
> |
CUBE thescene; /* our scene */ |
21 |
> |
OBJECT nsceneobjs; /* number of objects in our scene */ |
22 |
|
|
23 |
|
int dimlist[MAXDIM]; /* sampling dimensions */ |
24 |
|
int ndims = 0; /* number of sampling dimensions */ |
25 |
|
int samplendx = 0; /* index for this sample */ |
26 |
|
|
27 |
+ |
extern void ambnotify(); |
28 |
+ |
void (*addobjnotify[])() = {ambnotify, NULL}; |
29 |
+ |
|
30 |
+ |
VIEW ourview = STDVIEW; /* viewing parameters */ |
31 |
+ |
int hresolu, vresolu; /* image resolution */ |
32 |
+ |
|
33 |
+ |
void (*trace)() = NULL; /* trace call */ |
34 |
+ |
|
35 |
+ |
int do_irrad = 0; /* compute irradiance? */ |
36 |
+ |
|
37 |
|
int psample = 8; /* pixel sample size */ |
38 |
|
double maxdiff = .15; /* max. sample difference */ |
39 |
|
|
60 |
|
int maxdepth = 4; /* maximum recursion depth */ |
61 |
|
double minweight = 1e-2; /* minimum ray weight */ |
62 |
|
|
63 |
+ |
char *ambfile = NULL; /* ambient file name */ |
64 |
|
COLOR ambval = BLKCOLOR; /* ambient value */ |
65 |
|
int ambvwt = 0; /* initial weight for ambient value */ |
66 |
|
double ambacc = 0.2; /* ambient accuracy */ |
72 |
|
int ambincl = -1; /* include == 1, exclude == 0 */ |
73 |
|
|
74 |
|
int greyscale = 0; /* map colors to brightness? */ |
75 |
< |
char *devname = dev_default; /* output device name */ |
75 |
> |
char *dvcname = dev_default; /* output device name */ |
76 |
|
|
77 |
|
struct driver *dev = NULL; /* driver functions */ |
78 |
|
|
91 |
|
#define CTRL(c) ((c)-'@') |
92 |
|
|
93 |
|
|
94 |
+ |
void |
95 |
|
quit(code) /* quit program */ |
96 |
|
int code; |
97 |
|
{ |
104 |
|
} |
105 |
|
|
106 |
|
|
107 |
+ |
void |
108 |
|
devopen(dname) /* open device driver */ |
109 |
|
char *dname; |
110 |
|
{ |
131 |
|
} |
132 |
|
|
133 |
|
|
134 |
+ |
void |
135 |
|
devclose() /* close our device */ |
136 |
|
{ |
137 |
|
if (dev != NULL) |
140 |
|
} |
141 |
|
|
142 |
|
|
143 |
+ |
void |
144 |
|
printdevices() /* print list of output devices */ |
145 |
|
{ |
146 |
|
register int i; |
150 |
|
} |
151 |
|
|
152 |
|
|
153 |
+ |
void |
154 |
|
rview() /* do a view */ |
155 |
|
{ |
156 |
|
char buf[32]; |
157 |
|
|
158 |
< |
devopen(devname); /* open device */ |
158 |
> |
devopen(dvcname); /* open device */ |
159 |
|
newimage(); /* start image (calls fillreserves) */ |
160 |
|
|
161 |
|
for ( ; ; ) { /* quit in command() */ |
183 |
|
} |
184 |
|
|
185 |
|
|
186 |
+ |
void |
187 |
|
fillreserves() /* fill memory reserves */ |
188 |
|
{ |
189 |
|
if (reserve_mem != NULL) |
190 |
|
return; |
191 |
< |
reserve_mem = malloc(RESERVE_AMT); |
191 |
> |
reserve_mem = (char *)malloc(RESERVE_AMT); |
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
+ |
void |
196 |
|
freereserves() /* free memory reserves */ |
197 |
|
{ |
198 |
|
if (reserve_mem == NULL) |
202 |
|
} |
203 |
|
|
204 |
|
|
205 |
+ |
void |
206 |
|
command(prompt) /* get/execute command */ |
207 |
|
char *prompt; |
208 |
|
{ |
331 |
|
devclose(); |
332 |
|
kill(0, SIGTSTP); |
333 |
|
/* pc stops here */ |
334 |
< |
devopen(devname); |
334 |
> |
devopen(dvcname); |
335 |
|
redraw(); |
336 |
|
break; |
337 |
|
#endif |
351 |
|
} |
352 |
|
|
353 |
|
|
354 |
+ |
void |
355 |
|
rsample() /* sample the image */ |
356 |
|
{ |
357 |
|
int xsiz, ysiz, y; |
374 |
|
return; |
375 |
|
pl = (PNODE **)malloc(xsiz*sizeof(PNODE *)); |
376 |
|
if (pl == NULL) { |
377 |
< |
free((char *)rl); |
377 |
> |
free((void *)rl); |
378 |
|
return; |
379 |
|
} |
380 |
|
/* |
435 |
|
} |
436 |
|
} |
437 |
|
escape: |
438 |
< |
free((char *)rl); |
439 |
< |
free((char *)pl); |
438 |
> |
free((void *)rl); |
439 |
> |
free((void *)pl); |
440 |
|
} |
441 |
|
|
442 |
|
|