File: ge3d.h

package info (click to toggle)
vrwave 0.9-4
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 5,032 kB
  • ctags: 7,153
  • sloc: java: 15,050; ansic: 8,219; sh: 458; makefile: 181
file content (438 lines) | stat: -rw-r--r-- 12,268 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
#if 0
//<copyright>
//
// Copyright (c) 1992,93,94,95,96,97
// Institute for Information Processing and Computer Supported New Media (IICM),
// Graz University of Technology, Austria.
//
// This file is part of VRweb.
//
// VRweb is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
//
// VRweb is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with VRweb; see the file LICENCE. If not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
//
//</copyright>
#endif

/*
 * File:     ge3d.h
 *
 * Authors:  Michael Hofer (until May 92) and Michael Pichler
 *
 * Created:   1 Apr 92
 *
 * Changed:  20 Dec 97   Karl Heinz Wagenbrunn (stereo view, transparency)
 *
 * Changed:  12 Feb 97   Michael Pichler
 *
 * $Id: ge3d.h,v 1.21 1997/09/22 14:48:28 jwolte Exp $
 *
 */


/*
 * Interface to the Graphics Engine 3D
 *
 */


#ifndef ge3d_ge3d_h
#define ge3d_ge3d_h


#ifdef __cplusplus
#define GE3D_PROTOTYPES
extern "C" {
#endif
#ifdef __GNUC__
#define GE3D_PROTOTYPES
#endif


/*
 * now (read: September 1997) we take the liberty to assume you are
 * using an ANSI-C compiler. See notes in ge3d_ogl.c or ge3d_mesa.c if
 * you are still using a K&R C-compiler - better yet, look at the man
 * pages of your compiler for flags to switch it to ANSI-C mode.
 */

#define GE3D_PROTOTYPES


#include "ge3drc.h"  /* revision control */

#include "face.h"
#include "vectors.h"
#include "color.h"
#include "mtl.h"


/* changed from mode_t to ge3d_mode_t (collision with CC/types.h) */

enum ge3d_mode_t
{ ge3d_wireframe,
  ge3d_hidden_line,
  ge3d_flat_shading,
  ge3d_smooth_shading,
  ge3d_texturing
};

enum ge3d_hint_t
{ hint_depthbuffer,
  hint_backfaceculling,
  hint_lighting,
  hint_texlighting,
  hint_ambientcolor,
  hint_quadslices,
  hint_transparency,
  hint_ccw
};

enum ge3d_bitplane_t
{ ge3d_normal_planes,
  ge3d_overlay_planes
};

enum ge3d_bitmapformat_t
{
  ge3d_ubyte_RGB_TB,    /* RGB triples of unsigned byte, no filling byte, top-to-bottom */
  ge3d_ubyte_I_BT,      /* intensity, bottom-to-top */
  ge3d_ubyte_IA_BT,     /* intensity and Alpha, bottom-to-top */
  ge3d_ubyte_RGB_BT,    /* RGB triples, bottom-to-top */
  ge3d_ubyte_RGBA_BT,   /* RGBA quadruples, bottom-to-top */
  ge3d_int_I_BT,        /* int array (32 bit), 0xII values, bottom-to-top */
  ge3d_int_IA_BT,       /* int array (32 bit), 0xIIAA values, bottom-to-top */
  ge3d_int_RGB_BT,      /* int array (32 bit), 0xRRGGBB values, bottom-to-top */
  ge3d_int_RGBA_BT,     /* int array (32 bit), 0xRRGGBBAA values, bottom-to-top */
  ge3d_int_ARGB_TB      /* int array (32 bit), 0xAARRGGBB values, top-to-bottom */
};                      /* all int values in native byte order */

enum ge3d_antialiasing_t
{ ge3d_aa_lines = 0x1,
  ge3d_aa_polygons = 0x2,
  ge3d_aa_polygons_front2back = 0x4,
  ge3d_aa_all = ~0
};

enum ge3d_camera_t  /* constants for ge3dCamera */
{
  /* if neither cam_perspective nor cam_orthographic set, projection matrix unchanged */
  cam_perspective = 0x1,
  cam_orthographic = 0x2,
  /* if neither cam_absolute nor cam_relative set, modelview matrix unchanged */
  cam_absolute = 0x4,
  cam_relative = 0x8
};

enum ge3d_eye_t  /* stereo flags */
{
  eye_monoview = 0,
  eye_right = 1,
  eye_left = 2
};

enum ge3d_transparency_t  /* transparency method */
{
  transp_off = 0,
  transp_stipple = 1,
  transp_blend = 2
};

enum ge3d_cylinder_t  /* cylinder parts */
{
  cyl_sides = 0x1,
  cyl_bottom = 0x2,
  cyl_top = 0x4,
  cyl_all = 0x7
};


/* only C++ treats global const ints const */
#define ge3d_maxmipmap_quality 5



#ifdef GE3D_PROTOTYPES


void ge3d_openwindow ();
void ge3d_linkXwindow (void*, void*);
void ge3d_init_ ();
void ge3dHint (int /*ge3d_hint_t*/, int /*value*/);

void ge3d_clearscreen ();
void ge3d_swapbuffers ();

void ge3d_moveto (float, float, float);
void ge3dMoveTo (const point3D*);
void ge3d_lineto (float, float, float);
void ge3dLineTo (const point3D*);
void ge3d_line (float, float, float, float, float, float);
void ge3dLine (const point3D*, const point3D*);
void ge3d_wirecube (float, float, float, float, float, float);
/* void ge3dWireCube (const point3D*, const point3D*) -- macro */
void ge3dPolyLines2D (float*);

void ge3dCube (const point3D*, const point3D*);
void ge3dShadedPolygon (int, const point3D*, const colorRGB*);

/* void ge3d_polygon (...); */  /* macro */
void ge3dPolygon (const point3D* vl, int nv, const int* vi,
  const vector3D* nl, int nn, const int* ni, const vector3D* fn,
  const point2D* tv, int nt, const int* ti);
/* void ge3d_polyhedron (point3D*, vector3D*, int, face*); */  /* macro */
void ge3dPolyhedron (point3D*, vector3D*, point2D*, int, face*);
void ge3d_wirepolyhedron (point3D*, vector3D*, int, face*);
void ge3dFaceSet (const point3D* vl, int nv, const int* vi,
  const materialsGE3D* ml, int mb, int nm, const int* mi,
  const vector3D* nl, int nn, const int* ni, const vector3D* fn,
  const point2D* tl, int nt, const int* ti);
void ge3dLineSet (const point3D* vl, int nv, const int* vi);
void ge3dLineSet2 (const point3D* vl, int nv, const int* vi,
  int nc, const colorRGB* co, int nci, const int* ci, int pv);
void ge3dPointSet (const point3D*, int);
void ge3dPointSet2 (const point3D*, int, const colorRGB*, int);

void ge3dSphere (float);
void ge3dCylinder (float br, float tr, float b, float h, int);

void ge3d_setmode (int);

void ge3d_setbackgcolor (float, float, float);
void ge3dBackgroundColor (const colorRGB*);
void ge3d_setfillcolor (float, float, float);
void ge3dMaterial (int /*ge3d_material_t*/, const materialsGE3D*);  /* front/back, definitions */
void ge3dDefaultMaterial ();
void ge3dFillColor (const colorRGB*);
void ge3d_setlinecolor (float, float, float);
void ge3dLineColor (const colorRGB*);
void ge3d_setlinestyle (short);
void ge3d_setlinewidth (short);
void ge3dAntialiasing (int);  /* ge3d_antialiasing_t */
int ge3dAntialiasingSupport ();
void ge3dAlphaTest (float threshold);

void ge3d_text (float, float, float, const char*);
void ge3dText (const point3D*, const char*);

void ge3d_rect (float, float, float, float);
void ge3d_rectf (float, float, float, float);
void ge3dFilledRect (float, float, float, float, float);
void ge3d_circle (float, float, float);
void ge3d_circf (float, float, float);
void ge3d_arc (float, float, float, float, float);

void ge3dSetLightSource (int index, const colorRGB*, const point3D*, float positional, int camlgt);
void ge3dLightSource (int index, const colorRGB*, /*const*/ matrix4D, float positional, int camlgt);
void ge3dSpotLight (int index, const colorRGB*, const point3D* pos, const vector3D* dir,
  float droprate, float cutangle);
void ge3d_switchlight (int, int);
void ge3dGlobalAmbient (const colorRGB*);

void ge3d_transform_mc_wc (float, float, float, float*, float*, float*);
void ge3dTransformMcWc (const point3D*, point3D*);
void ge3d_transformvector_mc_wc (float, float, float, float*, float*, float*);
void ge3dTransformVectorMcWc (const vector3D*, vector3D*);

void ge3d_clearzbuffer ();
void ge3d_colormask (int, int, int, int);  /* RGBA */

void ge3d_setcamera (const point3D*, const point3D*, const point3D*,
  float, float, float, float, float, int /*ge3d_eye_t*/, float, float);
void ge3d_ortho_cam (const point3D*, const point3D*, const point3D*, float, float, float, float);
void ge3dCamera (int /*ge3d_camera_t*/, const point3D*, float, const vector3D*, float, float, float, float);

void ge3d_push_matrix ();
void ge3dPushIdentity ();
void ge3dLoadIdentity ();
void ge3d_push_this_matrix (const float [4][4]);
void ge3d_push_new_matrix (const float [4][4]);
void ge3dMultMatrix (const float [4][4]);

void ge3d_print_cur_matrix ();
void ge3d_get_and_pop_matrix (matrix4D);
void ge3d_get_matrix (matrix4D);
void ge3d_pop_matrix ();

void ge3d_rotate_axis (char, float);
void ge3dRotate (const vector3D*, float);  /* (angle in radians!) */
void ge3d_translate (float, float, float);
void ge3dTranslate (const vector3D*);
void ge3d_scale (float, float, float, float);
void ge3dScale (const float*);

int ge3dTexturingSupport ();
int ge3dCreateTexture (int width, int height, const void* data, int /* ge3d_bitmapformat_t */, int* retflags);
void ge3dFreeTexture (int handle);
void ge3dDoTexturing (int toggle);
void ge3dApplyTexture (int handle);
void ge3dTextureRepeat (int s, int t);
void ge3dTextureMipmapping (int quality);  /* 0 to 5 */
int ge3dCurrentTextureMipmapping ();
void ge3dLoadTextureIdentity ();
void ge3dMultTextureMatrix (const float [4][4]);
void ge3dLoadTextureMatrix (const float [4][4]);
void ge3dGetTextureMatrix (matrix4D);
void ge3dTexturedPolygon (int nverts, const point3D*, const point2D*, int handle);

int ge3dRequestOverlay ();
void ge3dBitplanes (int);
void ge3dClearOverlay ();
void ge3dMapColori (int, short, short, short);
void ge3dMapColorRGB (int, const colorRGB*);
void ge3dColorIndex (int);

void ge3d_close ();


#else


void ge3d_openwindow ();
void ge3d_linkXwindow ();
void ge3d_init_ ();
void ge3dHint ();

void ge3d_clearscreen ();
void ge3d_swapbuffers ();

void ge3d_moveto ();
void ge3dMoveTo ();
void ge3d_lineto ();
void ge3dLineTo ();
void ge3d_line ();
void ge3dLine ();
void ge3d_wirecube ();
void ge3dPolyLines2D ();

void ge3dCube ();
void ge3dShadedPolygon ();

/* void ge3d_polygon (); */  /* macro */
void ge3dPolygon ();
/* void ge3d_polyhedron (); */  /* macro */
void ge3dPolyhedron ();
void ge3d_wirepolyhedron ();
void ge3dFaceSet ();
void ge3dLineSet ();
void ge3dLineSet2 ();
void ge3dPointSet ();
void ge3dPointSet2 ();

void ge3dSphere ();
void ge3dCylinder ();

void ge3d_setmode ();

void ge3d_setbackgcolor ();
void ge3dBackgroundColour ();
void ge3d_setfillcolor ();
void ge3dMaterial ();
void ge3dDefaultMaterial ();
void ge3dFillColor ();
void ge3d_setlinecolor ();
void ge3dLineColor ();
void ge3d_setlinestyle ();
void ge3d_setlinewidth ();
void ge3dAntialiasing ();
int ge3dAntialiasingSupport ();
void ge3dAlphaTest ();

void ge3d_text ();
void ge3dText ();

void ge3d_rect ();
void ge3d_rectf ();
void ge3dFilledRect ();
void ge3d_circle ();
void ge3d_circf ();
void ge3d_arc ();

void ge3dSetLightSource ();
void ge3dLightSource ();
void ge3dSpotLight ();
void ge3d_switchlight ();
void ge3dGlobalAmbient ();

void ge3d_transform_mc_wc ();
void ge3dTransformMcWc ();
void ge3d_transformvector_mc_wc ();
void ge3dTransformVectorMcWc ();

void ge3d_clearzbuffer ();
void ge3d_colormask ();

void ge3d_setcamera ();
void ge3d_ortho_cam ();
void ge3dCamera ();

void ge3d_push_matrix ();
void ge3dPushIdentity ();
void ge3dLoadIdentity ();
void ge3d_push_this_matrix ();
void ge3d_push_new_matrix ();
void ge3dMultMatrix ();

void ge3d_print_cur_matrix ();
void ge3d_get_and_pop_matrix ();
void ge3d_get_matrix ();
void ge3d_pop_matrix ();

void ge3d_rotate_axis ();
void ge3dRotate ();
void ge3d_translate ();
void ge3dTranslate ();
void ge3d_scale ();
void ge3dScale ();

int ge3dTexturingSupport ();
int ge3dCreateTexture ();
void ge3dFreeTexture ();
void ge3dDoTexturing ();
void ge3dApplyTexture ();
void ge3dTextureRepeat ();
void ge3dTextureMipmapping ();
int ge3dCurrentTextureMipmapping ();
void ge3dLoadTextureIdentity ();
void ge3dMultTextureMatrix ();
void ge3dLoadTextureMatrix ();
void ge3dGetTextureMatrix ();
void ge3dTexturedPolygon ();

int ge3dRequestOverlay ();
void ge3dBitplanes ();
void ge3dClearOverlay ();
void ge3dMapColori ();
void ge3dMapColorRGB ();
void ge3dColorIndex ();

void ge3d_close ();


#endif



#define ge3dWireCube(p, q)  ge3d_wirecube ((p)->x, (p)->y, (p)->z, (q)->x, (q)->y, (q)->z)
#define ge3dFillColor(c)  ge3d_setfillcolor ((c)->R, (c)->G, (c)->B)
#define ge3d_polygon(vl, nv, vi, nl, nn, ni, fn)  ge3dPolygon ((vl), (nv), (vi), (nl), (nn), (ni), (fn), 0, 0, 0)
#define ge3d_polyhedron(p, v, n, f)  ge3dPolyhedron ((p), (v), 0, (n), (f))

#ifdef __cplusplus
}
#endif



#endif