(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 typedef struct {
38     GLfloat x, y, z;    // Amount of rotation on axis
39 } transform;
40
41 typedef struct {
42     int id;
43     GLfloat scale;
44 } texturedat;
45
46 typedef struct {
47     int mesh;           // Mesh index number
48     texturedat texture; // Texture index number
49     GLfloat x,y,z;      // Scene position
50     GLfloat scale[3];   // Scale vector
51     transform rotation; // Rotation transformation
52 } SceneObject;
53
54 // Menu enum
55 enum menu {
56   // Main menu
57   M_ROTATE_MOVE_CAMERA,
58   M_POSITION_SCALE,
59   M_ROTATION_TEXTURE_SCALE,
60   M_EXIT,
61
62   // Material submenu
63   M_MATERIAL_ALL_RGB,
64   M_MATERIAL_AMBIENT_RGB,
65   M_MATERIAL_DIFFUSE_RGB,
66   M_MATERIAL_SPECULAR_RGB,
67   M_MATERIAL_ALL_ADSS,
68   M_MATERIAL_RED_ADSS,
69   M_MATERIAL_GREEN_ADSS,
70   M_MATERIAL_BLUE_ADSS,
71
72   // Light submenu
73   M_LIGHT_MOVE_LIGHT_1,
74   M_LIGHT_RGBALL_LIGHT_1,
75   M_LIGHT_MOVE_LIGHT_2,
76   M_LIGHT_RGBALL_LIGHT_2
77 };
78
79 // Manipulation states
80 enum manipulateStates {
81   STATE_CAMERA_ROTATE_MOVE,
82   STATE_OBJECT_POSITION_SCALE,
83   STATE_OBJECT_ROTATION_TEXTURE_SCALE
84 };
85
86 #endif  /* TYPES_H */

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