-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgz.h
104 lines (86 loc) · 2.94 KB
/
gz.h
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
/*
* Gz.h - include file for the cs580 rendering library
*/
/*
* universal constants
*/
#define GZ_SUCCESS 0
#define GZ_FAILURE 1
/*
* name list tokens
*/
#define GZ_NULL_TOKEN 0 /* triangle vert attributes */
#define GZ_POSITION 1
#define GZ_NORMAL 2
#define GZ_TEXTURE_INDEX 3
#define GZ_AASHIFTX 44 /* antialiasing screen offset */
#define GZ_AASHIFTY 45 /* antialiasing screen offset */
#define GZ_AAWEIGHT 46
/* renderer-state default pixel color */
#define GZ_RGB_COLOR 99
#define GZ_INTERPOLATE 95 /* define interpolation mode */
#define GZ_DIRECTIONAL_LIGHT 79 /* directional light */
#define GZ_AMBIENT_LIGHT 78 /* ambient light type */
#define GZ_AMBIENT_COEFFICIENT 1001 /* Ka material property */
#define GZ_DIFFUSE_COEFFICIENT 1002 /* Kd material property */
#define GZ_SPECULAR_COEFFICIENT 1003 /* Ks material property */
#define GZ_DISTRIBUTION_COEFFICIENT 1004 /* specular power of material */
#define GZ_TEXTURE_MAP 1010 /* pointer to texture routine */
/*
* flags fields for value list attributes
*/
/* select interpolation mode of the shader (only one) */
#define GZ_FLAT 0 /* flat shading with GZ_RBG_COLOR */
#define GZ_COLOR 1 /* interpolate vertex color */
#define GZ_NORMALS 2 /* interpolate normals */
typedef int GzToken;
typedef void *GzPointer;
typedef float GzColor[3];
typedef short GzIntensity; /* 0 - 4095 in lower 12-bits */
typedef float GzCoord[3];
typedef float GzTextureIndex[2];
typedef float GzMatrix[4][4];
typedef int GzDepth; /* z is signed for clipping */
typedef int (*GzTexture)(float u, float v, GzColor color); /* pointer to texture sampling method */
/* u,v parameters [0,1] are defined tex_fun(float u, float v, GzColor color) */
/*
* Gz camera definition
*/
#ifndef GZCAMERA
#define GZCAMERA
typedef struct GzCamera
{
GzMatrix Xiw; /* xform from world to image space */
GzMatrix Xpi; /* perspective projection xform */
GzCoord position; /* position of image plane origin */
GzCoord lookat; /* position of look-at-point */
GzCoord worldup; /* world up-vector (almost screen up) */
float FOV; /* horizontal field of view */
} GzCamera;
#endif
#ifndef GZLIGHT
#define GZLIGHT
typedef struct GzLight
{
GzCoord direction; /* vector from surface to light */
GzColor color; /* light color intensity */
} GzLight;
#endif
#ifndef GZINPUT
#define GZINPUT
typedef struct GzInput
{
GzCoord rotation; /* object rotation */
GzCoord translation; /* object translation */
GzCoord scale; /* object scaling */
GzCamera camera; /* camera */
} GzInput;
#endif
#define RED 0 /* array indicies for color vector */
#define GREEN 1
#define BLUE 2
#define X 0 /* array indicies for position vector*/
#define Y 1
#define Z 2
#define U 0 /* array indicies for texture coords */
#define V 1