(no commit message)
[atyndall/cits2231.git] / types.h
1 /**
2  * Type definition file
3  * @author Ashley Tyndall (20915779), Jenna de la Harpe (20367932)
4  */
5
6 #include <GL/gl.h>
7 #include <GL/glut.h>
8
9 #ifndef TYPES_H
10 #define TYPES_H
11
12 // Type definitions for vertex-coordinates, normals, texture-coordinates,
13 // and triangles (via the indices of 3 vertices).
14 typedef GLfloat vertex[3];
15 typedef GLfloat normal[3];
16 typedef GLfloat texCoord[2];
17 typedef GLint vertexIndex;
18 typedef vertexIndex triangle[3];
19
20 // A type for a mesh
21 typedef struct {
22     int nVertices;           //  The number of vertices in the mesh
23     vertex* vertices;        //  Array with coordinates of vertices
24     normal* normals;         //  Array with normals of vertices
25     texCoord* texCoords;     //  Array with texture-coordinates of vertices
26     int nTriangles;          //  The number of triangles in the mesh
27     triangle* triangles;     //  Array of trangles via 3 indices into "vertices"
28 } mesh;
29
30 // A type for a 2D texture, with height and width in pixels
31 typedef struct {
32     int height;
33     int width;
34     GLubyte *rgbData;   // Array of bytes with the colour data for the texture
35 } texture;
36
37 // A type for point data
38 typedef struct {
39     GLfloat x, y, z;    // Amount of rotation on axis
40 } point;
41
42 // A type for texture id/scale data
43 typedef struct {
44     int id;
45     GLfloat scale;
46 } texturedat;
47
48 // A type to maintain the state of an object in the scene
49 typedef struct {
50     int mesh;             // Mesh index number
51     texturedat texture;   // Texture index number
52     GLfloat x,y,z;        // Scene position
53     GLfloat scale[3];     // Scale vector
54     point rotation;       // Rotation transformation
55 } SceneObject;
56
57 // A type to maintain the state of a light in the scene
58 typedef struct {
59     GLfloat position[4];  // Light position
60     GLfloat ambient[4];   // Ambient parameter
61     GLfloat diffuse[4];   // Diffuse parameter
62     GLfloat specular[4];  // Specular parameter
63     GLfloat direction[3]; // Direction parameter
64     GLfloat cutoff;       // Cutoff of light
65     char exponent;        // Light exponent value, 0 - 128
66 } LightObject;
67
68 // Menu enum
69 enum menu {
70   // Main menu
71   M_ROTATE_MOVE_CAMERA,
72   M_POSITION_SCALE,
73   M_ROTATION_TEXTURE_SCALE,
74   M_EXIT,
75
76   // Material submenu
77   M_MATERIAL_ALL_RGB,
78   M_MATERIAL_AMBIENT_RGB,
79   M_MATERIAL_DIFFUSE_RGB,
80   M_MATERIAL_SPECULAR_RGB,
81   M_MATERIAL_ALL_ADSS,
82   M_MATERIAL_RED_ADSS,
83   M_MATERIAL_GREEN_ADSS,
84   M_MATERIAL_BLUE_ADSS,
85
86   // Light submenu
87   M_LIGHT_MOVE_LIGHT_1,
88   M_LIGHT_RGBALL_LIGHT_1,
89   M_LIGHT_MOVE_LIGHT_2,
90   M_LIGHT_RGBALL_LIGHT_2
91 };
92
93 // Manipulation states
94 enum manipulateStates {
95   STATE_CAMERA_ROTATE_MOVE,
96   STATE_OBJECT_POSITION_SCALE,
97   STATE_OBJECT_ROTATION_TEXTURE_SCALE,
98   STATE_LIGHT_1_MOVE,
99   STATE_LIGHT_2_MOVE,
100 };
101
102 #endif  /* TYPES_H */

UCC git Repository :: git.ucc.asn.au