1 /*
2  * volpack.h
3  *
4  * Header file for VolPack.
5  *
6  * Copyright (c) 1994 The Board of Trustees of The Leland Stanford
7  * Junior University.  All rights reserved.
8  *
9  * Permission to use, copy, modify and distribute this software and its
10  * documentation for any purpose is hereby granted without fee, provided
11  * that the above copyright notice and this permission notice appear in
12  * all copies of this software and that you do not sell the software.
13  * Commercial licensing is available by contacting the author.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
17  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
18  *
19  * Author:
20  *    Phil Lacroute
21  *    Computer Systems Laboratory
22  *    Electrical Engineering Dept.
23  *    Stanford University
24  */
25 
26 /*
27  * $Date: 1994/12/30 23:52:38 $
28  * $Revision: 1.27 $
29  */
30 
31 #ifndef _VOLPACK
32 #define _VOLPACK
33 
34 /*******************************************************************
35  * Definitions to customize declarations for different C dialects. *
36  *******************************************************************/
37 
38 #ifdef __STDC__
39 #ifndef NO_PROTOTYPE
40 #define ANSI_C
41 #endif
42 #endif
43 
44 #ifdef __cplusplus
45 #define ANSI_C
46 #define EXTERN extern "C"
47 #else
48 #define EXTERN extern
49 #endif
50 
51 #ifdef ANSI_C
52 #define ANSI_ARGS(x)    x
53 #else
54 #define ANSI_ARGS(x)    ()
55 #endif
56 
57 /*******************************************************************
58  * Configuration constants.                                        *
59  *******************************************************************/
60 
61 #define VP_EPS	1.0e-11		/* smallest reasonable nonzero number */
62 #define VP_MAX_VOLUME_DIM 1024	/* maximum length of a voxel scanline */
63 #define VP_MAX_FIELDS	6	/* maximum number of fields in a voxel */
64 #define VP_MAX_MATERIAL	6	/* maximum number of materials in a volume */
65 #define VP_MAX_LIGHTS	6	/* maximum number of lights */
66 
67 /* magic numbers for disk files */
68 #define VP_CVFILE_MAGIC		0x4F4F5F5F /* classified volume file */
69 #define VP_OCTFILE_MAGIC	0x4F4F6F6F /* min-max octree file */
70 #define VP_RVFILE_MAGIC		0x4F4F7F7F /* raw volume file */
71 #define VP_VPCFILE_MAGIC	0x4F4F8F8F /* rendering context dump */
72 
73 #define VP_VERSION		"1.1"	/* version string */
74 #define VP_MAJOR_VERSION	1	/* major version number */
75 #define VP_MINOR_VERSION	1	/* minor version number */
76 
77 /*******************************************************************
78  * Global constants.                                               *
79  *******************************************************************/
80 
81 /* options for vpGet* and vpSet* */
82 #define VP_XLEN			1000	/* x dimension of volume */
83 #define VP_YLEN			1001	/* y dimension of volume */
84 #define VP_ZLEN			1002	/* z dimension of volume */
85 #define VP_BYTES_PER_VOXEL	1003	/* size of raw voxel in bytes */
86 #define VP_VOXEL_FIELD_COUNT	1004	/* number of fields in a voxel */
87 #define VP_SHADE_FIELD_COUNT	1005	/* number of fields for shading */
88 #define VP_FIELD_SIZES		1006	/* size of each field */
89 #define VP_FIELD_OFFSETS	1007	/* byte offsets for each field */
90 #define VP_FIELD_MAXES		1008	/* max. value for each field */
91 #define VP_VOXEL_DATA		1009	/* pointer to voxel data */
92 #define VP_VOXEL_DATA_SIZE	1010	/* size of voxel data in bytes */
93 #define VP_VOXEL_XSTRIDE	1011	/* voxel data strides */
94 #define VP_VOXEL_YSTRIDE	1012	/* voxel data strides */
95 #define VP_VOXEL_ZSTRIDE	1013	/* voxel data strides */
96 #define VP_MIN_VOXEL_OPACITY	1014	/* thresh. for classification */
97 #define VP_CLASSIFY_FIELD_COUNT	1015	/* number of fields for classifier */
98 #define VP_CLASSIFY_FIELDS	1016	/* classification field numbers */
99 #define VP_CLASSIFY_TABLES	1017	/* classification tables */
100 #define VP_CLASSIFY_TABLE_SIZES	1018	/* classification table sizes */
101 #define VP_COLOR_CHANNELS	1019	/* number of color channels */
102 #define VP_SHADE_FUNC		1020	/* shading callback */
103 #define VP_GRAY_SHADE_FUNC	1021	/* grayscale shading function */
104 #define VP_RGB_SHADE_FUNC	1022	/* RGB shading function */
105 #define VP_SHADE_COLOR_TABLE	1023	/* shading color lookup table */
106 #define VP_SHADE_COLOR_SIZE	1024	/* size of shading color table */
107 #define VP_SHADE_WEIGHT_TABLE	1025	/* shading weight lookup table */
108 #define VP_SHADE_WEIGHT_SIZE	1026	/* size of shading weight table */
109 #define VP_SHADE_COLOR_FIELD	1027	/* field for color table index */
110 #define VP_SHADE_WEIGHT_FIELD	1028	/* field for weight table index */
111 #define VP_LIGHT_BOTH_SIDES	1029	/* use two-sided lighting */
112 #define VP_REVERSE_SURFACE_SIDES 1030	/* reverse interior and exterior */
113 #define VP_DEPTH_CUE		1031	/* depth cueing */
114 #define VP_DEPTH_CUE_FRONT	1032	/* depth cueing front factor */
115 #define VP_DEPTH_CUE_DENSITY	1034	/* depth cueing density */
116 #define VP_DEPTH_CUE_TABLE_SIZE	1035	/* # of entries in depth-cue table */
117 #define VP_DEPTH_CUE_SIZE_HINT	1036	/* hint for # of entries */
118 #define VP_DEPTH_CUE_QUANTIZATION 1037	/* smallest resolvable depth */
119 #define VP_CONCAT_MODE		1038	/* VP_CONCAT_LEFT or VP_CONCAT_RIGHT */
120 #define VP_IMAGE		1039	/* image array */
121 #define VP_IMAGE_WIDTH		1040	/* image width */
122 #define VP_IMAGE_HEIGHT		1041	/* image height */
123 #define VP_IMAGE_SCAN_SIZE	1042	/* bytes per scan in image */
124 #define VP_MAX_RAY_OPACITY	1043	/* thresh. for early ray termination */
125 #define VP_VIEW_AXIS		1044	/* principal viewing axis */
126 #define VP_INTERMEDIATE_WIDTH	1045	/* width of intermediate image */
127 #define VP_INTERMEDIATE_HEIGHT	1046	/* height of intermediate image */
128 #define VP_INTERMEDIATE_COLOR	1047	/* color channels in int. image */
129 #define VP_INT_WIDTH_HINT	1048	/* hint for intermediate image */
130 #define VP_INT_HEIGHT_HINT	1049	/* hint for intermediate height */
131 #define VP_VIEW_X_AXIS		1050	/* enable X viewing axis */
132 #define VP_VIEW_Y_AXIS		1051	/* enable Y viewing axis */
133 #define VP_VIEW_Z_AXIS		1052	/* enable Z viewing axis */
134 #define VP_VIEW_X_SIZE		1053	/* size of X view data */
135 #define VP_VIEW_Y_SIZE		1054	/* size of Y view data */
136 #define VP_VIEW_Z_SIZE		1055	/* size of Z view data */
137 #define VP_MMOCTREE_THRESHOLDS	1056	/* thresholds for min-max octree */
138 #define VP_MMOCTREE_SIZE	1057	/* size of min-max octree */
139 #define VP_LOG_ALLOC_FUNC	1058	/* function to log allocations */
140 #define VP_LOG_FREE_FUNC	1059	/* function to log deallocations */
141 #define VP_STATUS_FUNC		1060	/* function to give progress reports */
142 #define VP_READ_FUNC		1061	/* function to read from file */
143 #define VP_WRITE_FUNC		1062	/* function to write to file */
144 #define VP_MMAP_FUNC		1063	/* function to memory map a file */
145 #define VP_CLIENT_FUNC		1064	/* client data */
146 #define VP_MATERIAL_COUNT	1065	/* number of materials */
147 #define VP_CURRENT_MATRIX	1066	/* current transformation matrix */
148 #define VP_CLIENT_DATA		1067	/* client data */
149 #define VP_SHADOW		1068	/* enable shadows */
150 #define VP_SHADOW_LIGHT		1069	/* light number for shadows */
151 #define VP_SHADOW_WIDTH_HINT	1070	/* hint for width of shadow buffer */
152 #define VP_SHADOW_HEIGHT_HINT	1071	/* hint for height of shadow buffer */
153 #define VP_SHADOW_WIDTH		1072	/* width of shadow image */
154 #define VP_SHADOW_HEIGHT	1073	/* height of shadow image */
155 #define VP_SHADOW_COLOR_TABLE	1074	/* shadow color lookup table */
156 #define VP_SHADOW_COLOR_SIZE	1075	/* size of shadow color table */
157 #define VP_SHADOW_BIAS		1076	/* shadow bias distance */
158 #define VP_PIXEL_TYPE		1077	/* image pixel type */
159 #define VP_CLAMP_SHADE_TABLE	1078	/* clamp shade table entries */
160 #define VP_COMPOSITE_ORDER	1079	/* slice compositing order */
161 #define VP_AXIS_OVERRIDE	1080	/* override for best_view_axis */
162 #define VP_TRACE_SHADOW_K	1081	/* slice number for shadow tracing */
163 
164 /* light numbers for vpSetLight */
165 #define VP_LIGHT0		2000
166 #define VP_LIGHT1		2001
167 #define VP_LIGHT2		2002
168 #define VP_LIGHT3		2003
169 #define VP_LIGHT4		2004
170 #define VP_LIGHT5		2005
171 
172 /* property codes for vpSetLight */
173 #define VP_COLOR		2100	/* light color */
174 #define VP_DIRECTION		2101	/* light direction */
175 
176 /* material numbers for vpSetMaterial */
177 #define VP_MATERIAL0		2200
178 #define VP_MATERIAL1		2201
179 #define VP_MATERIAL2		2202
180 #define VP_MATERIAL3		2203
181 #define VP_MATERIAL4		2204
182 #define VP_MATERIAL5		2205
183 
184 /* property codes for vpSetMaterial */
185 #define VP_AMBIENT		2300	/* ambient material coefficients */
186 #define VP_DIFFUSE		2301	/* diffuse material coefficients */
187 #define VP_SPECULAR		2302	/* specular material coefficients */
188 #define VP_SHINYNESS		2303	/* specular exponent */
189 
190 
191 /* projection types for vpWindow and vpWindowPHIGS */
192 #define VP_PARALLEL		2400	/* parallel projection */
193 #define VP_PERSPECTIVE		2401	/* perspective projection */
194 
195 /* volume type codes for vpExtract */
196 #define VP_RAW_VOLUME		2500	/* unclassified volume */
197 #define VP_CLASSIFIED_VOLUME    2501	/* classified volume, optimal view */
198 #define VP_CLX_VOLUME		2502	/* classified volume, X view */
199 #define VP_CLY_VOLUME		2503	/* classified volume, Y view */
200 #define VP_CLZ_VOLUME		2504	/* classified volume, Z view */
201 
202 /* matrix concatenation modes for vpSeti(VP_CONCAT_MODE) */
203 #define VP_CONCAT_RIGHT		2600	/* concatenate matrices on right */
204 #define VP_CONCAT_LEFT		2601	/* concatenate matrices on left */
205 
206 /* surface side codes for vpSetMaterial (these are bit fields) */
207 #define VP_EXTERIOR		1
208 #define VP_INTERIOR		2
209 #define VP_BOTH_SIDES		(VP_EXTERIOR | VP_INTERIOR)
210 
211 /* principal axes (used as array indexes) */
212 #define VP_X_AXIS		0
213 #define VP_Y_AXIS		1
214 #define VP_Z_AXIS		2
215 #define VP_NO_AXIS		-1
216 
217 /* transformation matrices (used as array indexes) */
218 #define VP_MODEL		0   /* modelling transform (object -> world) */
219 #define VP_VIEW			1   /* viewing transform (world -> eye) */
220 #define VP_PROJECT		2   /* projection transform (eye -> clip) */
221 #define VP_SCREEN		8   /* screen transform (object -> screen) */
222 
223 /* special field type codes */
224 #define VP_SKIP_FIELD		-1	/* ignore a field */
225 #define VP_OPACITY_FIELD	-2	/* compute opacity */
226 #define VP_CORRECTED_OPAC_FIELD	-3	/* compute opac. corrected for view */
227 #define VP_COLOR_FIELD		-4	/* compute color */
228 
229 /* buffer codes */
230 #define VP_IMAGE_BUFFER		4000	/* intermediate image buffer */
231 #define VP_SHADOW_BUFFER	4001	/* shadow buffer */
232 
233 /* pixel formats */
234 #define VP_ALPHA		5000	/* opacity */
235 #define VP_LUMINANCE		5001	/* grayscale color */
236 #define VP_LUMINANCEA		5002	/* grayscale color + opacity */
237 #define VP_RGB			5003	/* RGB color */
238 #define VP_RGBA			5004	/* RGB color + opacity */
239 #define VP_BGR			5005	/* RGB color, reverse byte order */
240 #define VP_ABGR			5006	/* RGB color + opacity, reverse order*/
241 
242 /* voxel fields computed by vpScanlineNormals */
243 #define VP_NORM_SIZE		2	/* 2 byte normal index */
244 #define VP_SCALAR_SIZE		1	/* 1 byte scalar value */
245 #define VP_GRAD_SIZE		1	/* 1 byte gradient magnitude */
246 
247 #define VP_NORM_MAX		7923	/* maximum value of a 13 bit normal */
248 #define VP_SCALAR_MAX		255	/* maximum value of a scalar */
249 #define VP_GRAD_MAX		221	/* maximum value of a gradient */
250 
251 #define VP_OPACITY_MAX		255	/* maximum value of an opacity */
252 
253 /* data types */
254 #define VP_UCHAR		1200	/* unsigned char */
255 #define VP_USHORT		1201	/* unsigned short */
256 #define VP_FLOAT		1202	/* float */
257 
258 /* filter types */
259 #define VP_BOX_FILTER		1300	/* box filter */
260 #define VP_LINEAR_FILTER	1301	/* linear filter (triangle) */
261 #define VP_GAUSSIAN_FILTER	1302	/* gaussian, sigma defined below */
262 #define VP_BSPLINE_FILTER	1303	/* cubic bspline filter */
263 #define VP_MITCHELL_FILTER	1304	/* Mitchell bicubic filter */
264 
265 #define VP_GAUSSIAN_SIGMA	0.4
266 
267 /*******************************************************************
268  * Macros.                                                         *
269  *******************************************************************/
270 
271 /* set fields of a vector */
272 #define vpSetVector3(v, v0, v1, v2)	v[0]=v0; v[1]=v1; v[2]=v2
273 #define vpSetVector4(v, v0, v1, v2, v3)	v[0]=v0; v[1]=v1; v[2]=v2; v[3]=v3
274 
275 /* compute an offset to a field in a structure */
276 #define vpFieldOffset(ptr, field)	((char *)&(ptr)->field - (char *)(ptr))
277 
278 /*******************************************************************
279  * Data type definitions.                                          *
280  *******************************************************************/
281 
282 typedef unsigned vpResult;		/* result code */
283 typedef double vpVector3[3];		/* 3 element vector */
284 typedef double vpVector4[4];		/* 4 element vector */
285 typedef double vpMatrix3[3][3];		/* 3 by 3 element matrix */
286 typedef double vpMatrix4[4][4];		/* 4 by 4 element matrix */
287 
288 typedef struct _vp_context vpContext;
289 
290 /*******************************************************************
291  * Debugging codes.                                                *
292  *******************************************************************/
293 
294 #define VPDEBUG_VIEW		0	/* view transform calculations */
295 #define VPDEBUG_RENDER		1	/* high-level rendering stages */
296 #define VPDEBUG_RBUF		2	/* render buffer allocation */
297 #define VPDEBUG_OPCCORRECT	3	/* opacity correction */
298 #define VPDEBUG_DEPTHCUE	4	/* depth cueing */
299 #define VPDEBUG_PYRAMID		5	/* pyramid construction */
300 #define VPDEBUG_OCTREE		6	/* octree construction */
301 #define VPDEBUG_CLSFYOCTREE	7	/* octree classification */
302 #define VPDEBUG_OCTREERUNS	8	/* runs computed from octree */
303 #define VPDEBUG_OCTREETRAVERSE	9	/* octree traversal */
304 #define VPDEBUG_TRANSPOSE	10	/* volume transposing */
305 #define VPDEBUG_COMPOSITE	11	/* compositing */
306 #define VPDEBUG_SHADOW		12	/* shadows */
307 #define VPDEBUG_COUNT		13      /* total number of codes */
308 
309 /*******************************************************************
310  * Timer codes.                                                    *
311  *******************************************************************/
312 
313 #define VPTIMER_SHADE		0	/* compute shading lookup table */
314 #define VPTIMER_COMPOSITE	1	/* compositing loop */
315 #define VPTIMER_DEPTHCUE	2	/* depth cueing fixup loop */
316 #define VPTIMER_WARP		3	/* 2D warp */
317 #define VPTIMER_TRAVERSE_RUNS	4	/* traverse runs during compositing */
318 #define VPTIMER_PROCESS_VOXELS	5	/* process voxels during compositing */
319 #define VPTIMER_ERT		6	/* early ray termination overhead */
320 #define VPTIMER_CLSFY_OCTREE	7	/* classify octree nodes */
321 #define VPTIMER_TRAVERSE_OCTREE	8	/* traverse octree nodes */
322 #define VPTIMER_RENDER		9	/* render */
323 #define VPTIMER_CLEAR	       10	/* clear intermediate image */
324 #define VPTIMER_COUNT	       11	/* total number of codes */
325 
326 /*******************************************************************
327  * Error codes.                                                    *
328  *******************************************************************/
329 
330 #define VP_OK	0			/* successful return */
331 #define VPERROR_FIRST		1000
332 #define VPERROR_LIMIT_EXCEEDED	1000	/* exceeded a built-in limit */
333 #define VPERROR_SINGULAR	1001	/* singular vector or matrix */
334 #define VPERROR_IO		1002	/* file I/O error */
335 #define VPERROR_BAD_SIZE	1003	/* invalid buffer size */
336 #define VPERROR_BAD_IMAGE	1004	/* invalid image definition */
337 #define VPERROR_BAD_SHADER	1005	/* invalid shader definition */
338 #define VPERROR_BAD_CLASSIFIER	1006	/* invalid classifier definition */
339 #define VPERROR_BAD_VOLUME	1007	/* invalid volume definition */
340 #define VPERROR_BAD_VOXEL	1008	/* invalid voxel definition */
341 #define VPERROR_BAD_OPTION	1009	/* invalid option code */
342 #define VPERROR_BAD_VALUE	1010	/* argument out of range */
343 #define VPERROR_BAD_FILE	1011	/* file has bad magic number */
344 #define VPERROR_BAD_SHADOW	1012	/* cannot compute shadow buffer */
345 #define VPERROR_LAST		1012
346 
347 /*******************************************************************
348  * Global variables.                                               *
349  *******************************************************************/
350 
351 EXTERN char *vpCompilerOptions;
352 
353 /*******************************************************************
354  * Function declarations.                                          *
355  *******************************************************************/
356 
357 /* contexts */
358 EXTERN vpContext *	    vpCreateContext ANSI_ARGS((void));
359 EXTERN void		    vpDestroyContext ANSI_ARGS((vpContext *vpc));
360 
361 /* volumes */
362 EXTERN vpResult		    vpSetVolumeSize ANSI_ARGS((vpContext *vpc,
363 				int xlen, int ylen, int zlen));
364 EXTERN vpResult		    vpSetVoxelSize ANSI_ARGS((vpContext *vpc,
365 				int bytes_per_voxel, int num_voxel_fields,
366 				int num_shade_fields, int num_clsfy_fields));
367 EXTERN vpResult		    vpSetVoxelField ANSI_ARGS((vpContext *vpc,
368 				int field_num, int field_size,
369 				int field_offset, int field_max));
370 EXTERN vpResult		    vpSetRawVoxels ANSI_ARGS((vpContext *vpc,
371 				void *raw_voxels, int raw_voxels_size,
372 				int xstride, int ystride, int zstride));
373 
374 /* classification */
375 EXTERN vpResult		    vpSetClassifierTable ANSI_ARGS((vpContext *vpc,
376 				int param_num, int param_field, float *table,
377 				int table_size));
378 EXTERN vpResult		    vpClassifyScalars ANSI_ARGS((vpContext *vpc,
379 			        unsigned char *scalar_data, int length,
380 				int scalar_field, int grad_field,
381 				int norm_field));
382 EXTERN vpResult		    vpClassifyVolume ANSI_ARGS((vpContext *vpc));
383 EXTERN vpResult		    vpClassifyScanline ANSI_ARGS((vpContext *vpc,
384 				void *voxels));
385 EXTERN vpResult		    vpDestroyClassifiedVolume ANSI_ARGS((
386 				vpContext *vpc));
387 EXTERN vpResult		    vpMinMaxOctreeThreshold ANSI_ARGS((vpContext *vpc,
388 				int param, int range));
389 EXTERN vpResult		    vpCreateMinMaxOctree ANSI_ARGS((vpContext *vpc,
390 				int root_node_size, int base_node_size));
391 EXTERN vpResult		    vpDestroyMinMaxOctree ANSI_ARGS((vpContext *vpc));
392 EXTERN vpResult		    vpOctreeMask ANSI_ARGS((vpContext *vpc,
393 				unsigned char *array, int array_size,
394 				int max_level));
395 
396 /* shading */
397 EXTERN vpResult		    vpSetLookupShader ANSI_ARGS((vpContext *vpc,
398 				int color_channels, int num_materials,
399 				int color_field, float *color_table,
400 				int color_table_size, int weight_field,
401 				float *weight_table, int weight_table_size));
402 EXTERN vpResult		    vpSetShadowLookupShader ANSI_ARGS((vpContext *vpc,
403 				int color_channels, int num_materials,
404 				int color_field, float *color_table,
405 				int color_table_size, int weight_field,
406 				float *weight_table, int weight_table_size,
407 				float *shadow_table, int shadow_table_size));
408 EXTERN vpResult		    vpSetMaterial ANSI_ARGS((vpContext *vpc,
409 				int material, int property, int surface_side,
410 				double r, double g, double b));
411 EXTERN vpResult		    vpSetLight ANSI_ARGS((vpContext *vpc,
412 				int light_num, int property, double n0,
413 				double n1, double n2));
414 EXTERN vpResult		    vpSetDepthCueing ANSI_ARGS((vpContext *vpc,
415 				double front_factor, double density));
416 EXTERN int		    vpNormalIndex ANSI_ARGS((double nx, double ny,
417 				double nz));
418 EXTERN vpResult		    vpNormal ANSI_ARGS((int n, double *nx, double *ny,
419 				double *nz));
420 EXTERN vpResult		    vpScanlineNormals ANSI_ARGS((vpContext *vpc,
421 				int length, unsigned char *scalar_data,
422 				unsigned char *scalar_minus_y,
423 				unsigned char *scalar_plus_y,
424 				unsigned char *scalar_minus_z,
425 				unsigned char *scalar_plus_z,
426 				void *voxel_data, int scalar_field,
427 				int grad_field, int norm_field));
428 EXTERN vpResult		    vpVolumeNormals ANSI_ARGS((vpContext *vpc,
429 				unsigned char *scalar_data, int length,
430 				int scalar_field, int grad_field,
431 				int norm_field));
432 EXTERN vpResult		    vpShadeTable ANSI_ARGS((vpContext *vpc));
433 
434 /* view */
435 EXTERN vpResult		    vpCurrentMatrix ANSI_ARGS((vpContext *vpc,
436 				int option));
437 EXTERN vpResult		    vpIdentityMatrix ANSI_ARGS((vpContext *vpc));
438 EXTERN vpResult		    vpSetMatrix ANSI_ARGS((vpContext *vpc,
439 				vpMatrix4 matrix));
440 EXTERN vpResult		    vpMultMatrix ANSI_ARGS((vpContext *vpc,
441 				vpMatrix4 matrix));
442 EXTERN vpResult		    vpTranslate ANSI_ARGS((vpContext *vpc,
443 				double tx, double ty, double tz));
444 EXTERN vpResult		    vpRotate ANSI_ARGS((vpContext *vpc,
445 				int axis, double degrees));
446 EXTERN vpResult		    vpScale ANSI_ARGS((vpContext *vpc,
447 				double sx, double sy, double sz));
448 EXTERN vpResult		    vpWindow ANSI_ARGS((vpContext *vpc,
449 				int type, double left, double right,
450 				double bottom, double top, double near,
451 				double far));
452 EXTERN vpResult		    vpWindowPHIGS ANSI_ARGS((vpContext *vpc,
453 				vpVector3 vrp, vpVector3 vpn, vpVector3 vup,
454 				vpVector3 prp, double viewport_umin,
455 				double viewport_umax, double viewport_vmin,
456 				double viewport_vmax, double viewport_front,
457 				double viewport_back, int projection_type));
458 
459 /* images */
460 EXTERN vpResult		    vpSetImage ANSI_ARGS((vpContext *vpc,
461 				unsigned char *image, int width, int height,
462 				int bytes_per_scan, int pixel_type));
463 
464 /* other options */
465 EXTERN vpResult		    vpEnable ANSI_ARGS((vpContext *vpc,
466 				int option, int value));
467 EXTERN vpResult		    vpSeti ANSI_ARGS((vpContext *vpc, int option,
468 				int value));
469 EXTERN vpResult		    vpSetd ANSI_ARGS((vpContext *vpc, int option,
470 				double value));
471 EXTERN vpResult		    vpSetCallback ANSI_ARGS((vpContext *vpc,
472 				int option, void *func));
473 EXTERN vpResult		    vpSetClientData ANSI_ARGS((vpContext *vpc,
474 				void *client_data));
475 EXTERN vpResult		    vpSetDebug ANSI_ARGS((vpContext *vpc, int flag,
476 				int value));
477 EXTERN vpResult		    vpTracePixel ANSI_ARGS((vpContext *vpc,
478 				int trace_u, int trace_v));
479 EXTERN vpResult		    vpGetTimer ANSI_ARGS((vpContext *vpc, int option,
480 				int *iptr));
481 EXTERN vpResult		    vpClearTimer ANSI_ARGS((vpContext *vpc,
482 				int option));
483 
484 /* rendering */
485 EXTERN vpResult		    vpRenderClassifiedVolume ANSI_ARGS((
486 				vpContext *vpc));
487 EXTERN vpResult		    vpRenderRawVolume ANSI_ARGS((vpContext *vpc));
488 EXTERN vpResult		    vpBruteForceRender ANSI_ARGS((vpContext *vpc));
489 
490 /* retrieving state */
491 EXTERN vpResult		    vpGeti ANSI_ARGS((vpContext *vpc, int option,
492 				int *iptr));
493 EXTERN vpResult		    vpGetd ANSI_ARGS((vpContext *vpc, int option,
494 				double *dptr));
495 EXTERN vpResult		    vpGetp ANSI_ARGS((vpContext *vpc, int option,
496 				void **pptr));
497 EXTERN vpResult		    vpGetMatrix ANSI_ARGS((vpContext *vpc,
498 				int matrix_code, vpMatrix4 matrix));
499 EXTERN vpResult		    vpGetMaterial ANSI_ARGS((vpContext *vpc,
500 				int material, int property, int surface_side,
501 				double *r, double *g, double *b));
502 EXTERN vpResult		    vpGetLight ANSI_ARGS((vpContext *vpc,
503 				int light_num, int property,
504 				double *n0, double *n1, double *n2));
505 EXTERN vpResult		    vpGetImage ANSI_ARGS((vpContext *vpc,
506 				void *image, int width, int height,
507 				int scan_bytes, int pixel_type,
508 				int image_type));
509 EXTERN vpResult		    vpGetError ANSI_ARGS((vpContext *vpc));
510 EXTERN char *		    vpGetErrorString ANSI_ARGS((vpResult code));
511 
512 /* linear algebra */
513 EXTERN void		    vpIdentity3 ANSI_ARGS((vpMatrix3 m));
514 EXTERN void		    vpIdentity4 ANSI_ARGS((vpMatrix4 m));
515 EXTERN vpResult		    vpNormalize3 ANSI_ARGS((vpVector3 v));
516 EXTERN void		    vpMatrixVectorMult4 ANSI_ARGS((vpVector4 v2,
517 				vpMatrix4 m, vpVector4 v1));
518 EXTERN void		    vpMatrixMult4 ANSI_ARGS((vpMatrix4 m3,
519 				vpMatrix4 m2, vpMatrix4 m1));
520 EXTERN void		    vpCrossProduct ANSI_ARGS((vpVector3 p,
521 				vpVector3 v, vpVector3 w));
522 EXTERN vpResult		    vpSolveSystem4 ANSI_ARGS((vpMatrix4 a, double **b,
523 				int m));
524 
525 /* file I/O */
526 EXTERN vpResult		    vpStoreClassifiedVolume ANSI_ARGS((vpContext *vpc,
527 				int fd));
528 EXTERN vpResult		    vpLoadClassifiedVolume ANSI_ARGS((vpContext *vpc,
529 				int fd));
530 EXTERN vpResult		    vpStoreMinMaxOctree ANSI_ARGS((vpContext *vpc,
531 				int fd));
532 EXTERN vpResult		    vpLoadMinMaxOctree ANSI_ARGS((vpContext *vpc,
533 				int fd));
534 EXTERN vpResult		    vpStoreRawVolume ANSI_ARGS((vpContext *vpc,
535 				int fd));
536 EXTERN vpResult		    vpLoadRawVolume ANSI_ARGS((vpContext *vpc,
537 				int fd));
538 EXTERN vpResult		    vpStoreContext ANSI_ARGS((vpContext *vpc, int fd));
539 EXTERN vpResult		    vpLoadContext ANSI_ARGS((vpContext *vpc, int fd));
540 
541 /* misc. utilities */
542 EXTERN vpResult		    vpExtract ANSI_ARGS((vpContext *vpc,
543 				int volume_type, int x0, int y0, int z0,
544 				int x1, int y1, int z1, int field, void *dst,
545 				int dst_size, int dst_xstride, int dst_ystride,
546 				int dst_zstride));
547 EXTERN vpResult		    vpRamp ANSI_ARGS((float *dst, int stride,
548 				int num_points, int *ramp_x, float *ramp_y));
549 EXTERN vpResult		    vpTranspose ANSI_ARGS((vpContext *vpc, int kaxis));
550 EXTERN vpResult		    vpSetFilter ANSI_ARGS((vpContext *vpc,
551 				int num_taps, int num_phases, float *weights));
552 EXTERN vpResult		    vpResample ANSI_ARGS((vpContext *vpc,
553 				int num_dimens, int *src_dimens,
554 				int *dst_dimens, int *src_strides,
555 				int *dst_strides, int element_type,
556 				void *in_array, void *out_array));
557 EXTERN vpResult		    vpResample2D ANSI_ARGS((
558 				void *in_array, int in_x, int in_y,
559 				void *out_array, int out_x, int out_y,
560 				int element_type, int filter_type));
561 EXTERN vpResult		    vpResample3D ANSI_ARGS((
562 				void *in_array, int in_x, int in_y, int in_z,
563 				void *out_array, int out_x, int out_y,
564 				int out_z, int element_type, int filter_type));
565 EXTERN vpResult		    vpBoxFilter ANSI_ARGS((int num_taps,
566 				int num_phases, float *weights,
567 				int weights_bytes));
568 EXTERN vpResult		    vpLinearFilter ANSI_ARGS((int num_taps,
569 				int num_phases, float *weights,
570 				int weights_bytes));
571 EXTERN vpResult		    vpBicubicFilter ANSI_ARGS((double b_value,
572 				double c_value, int num_taps, int num_phases,
573 				float *weights, int weights_bytes));
574 EXTERN vpResult		    vpGaussianFilter ANSI_ARGS((double sigma,
575 				int num_taps, int num_phases, float *weights,
576 				int weights_bytes));
577 #endif /* _VOLPACK */
578