8 |
|
extern "C" { |
9 |
|
#endif |
10 |
|
|
11 |
– |
|
12 |
– |
#ifndef MG_VMAJOR |
13 |
– |
|
11 |
|
/* must include stdio.h and stdlib.h before us */ |
12 |
|
|
13 |
+ |
#include "ccolor.h" |
14 |
+ |
|
15 |
|
#define MG_VMAJOR 2 /* major version number */ |
16 |
|
#define MG_VMINOR 0 /* minor version number */ |
17 |
|
|
197 |
|
* (materials, colors, vectors) |
198 |
|
*/ |
199 |
|
|
201 |
– |
#define C_CMINWL 380 /* minimum wavelength */ |
202 |
– |
#define C_CMAXWL 780 /* maximum wavelength */ |
203 |
– |
#define C_CNSS 41 /* number of spectral samples */ |
204 |
– |
#define C_CWLI ((C_CMAXWL-C_CMINWL)/(C_CNSS-1)) |
205 |
– |
#define C_CMAXV 10000 /* nominal maximum sample value */ |
206 |
– |
#define C_CLPWM (683./C_CMAXV) /* peak lumens/watt multiplier */ |
207 |
– |
|
208 |
– |
#define C_CSSPEC 01 /* flag if spectrum is set */ |
209 |
– |
#define C_CDSPEC 02 /* flag if defined w/ spectrum */ |
210 |
– |
#define C_CSXY 04 /* flag if xy is set */ |
211 |
– |
#define C_CDXY 010 /* flag if defined w/ xy */ |
212 |
– |
#define C_CSEFF 020 /* flag if efficacy set */ |
213 |
– |
|
214 |
– |
typedef struct { |
215 |
– |
int clock; /* incremented each change */ |
216 |
– |
char *client_data; /* pointer to private client-owned data */ |
217 |
– |
short flags; /* what's been set */ |
218 |
– |
short ssamp[C_CNSS]; /* spectral samples, min wl to max */ |
219 |
– |
long ssum; /* straight sum of spectral values */ |
220 |
– |
float cx, cy; /* xy chromaticity value */ |
221 |
– |
float eff; /* efficacy (lumens/watt) */ |
222 |
– |
} C_COLOR; |
223 |
– |
|
224 |
– |
#define C_DEFCOLOR { 1, NULL, C_CDXY|C_CSXY|C_CSSPEC|C_CSEFF,\ |
225 |
– |
{C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,\ |
226 |
– |
C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,\ |
227 |
– |
C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,\ |
228 |
– |
C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,\ |
229 |
– |
C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,\ |
230 |
– |
C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,\ |
231 |
– |
C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV},\ |
232 |
– |
(long)C_CNSS*C_CMAXV, 1./3., 1./3., 178.006 } |
233 |
– |
|
234 |
– |
#define c_cval(c,l) ((double)(c)->ssamp[((l)-C_MINWL)/C_CWLI] / (c)->ssum) |
235 |
– |
|
200 |
|
#define C_1SIDEDTHICK 0.005 /* assumed thickness of 1-sided mat. */ |
201 |
|
|
202 |
|
typedef struct { |
242 |
|
extern C_MATERIAL *c_getmaterial(char *); /* get a named material */ |
243 |
|
extern C_VERTEX *c_getvert(char *); /* get a named vertex */ |
244 |
|
extern C_COLOR *c_getcolor(char *); /* get a named color */ |
281 |
– |
extern void c_ccvt(C_COLOR *, int); /* fix color representation */ |
282 |
– |
extern int c_isgrey(C_COLOR *); /* check if color is grey */ |
245 |
|
|
246 |
|
/************************************************************************* |
247 |
|
* Definitions for hierarchical object name handler |
355 |
|
#ifndef MEM_PTR |
356 |
|
#define MEM_PTR void * |
357 |
|
#endif |
396 |
– |
|
397 |
– |
#endif /*MG_VMAJOR*/ |
398 |
– |
|
358 |
|
|
359 |
|
#ifdef __cplusplus |
360 |
|
} |