(no commit message)
[atyndall/cits2231.git] / globals.c
1 /**
2  * Global Variables File
3  * Contains all of the project's global variables
4  * @author Ashley Tyndall (20915779), Jenna de la Harpe (20367932)
5  */
6
7 #include "types.h"
8 #include "globals.h"
9
10 mesh* meshes[NMESH];   // An array of pointers to the meshes - see getMesh
11 texture* textures[NTEXTURE];   // An array of texture pointers - see getTexture
12
13 // Menu arrays
14 const char *textureMenuEntries[NTEXTURE] = {
15   "1 Plain", "2 Rust", "3 Concrete", "4 Carpet", "5 Beach Sand",
16   "6 Rocky", "7 Brick", "8 Water", "9 Paper", "10 Marble",
17   "11 Wood", "12 Scales", "13 Fur", "14 Denim", "15 Hessian",
18   "16 Orange Peel", "17 Ice Crystals", "18 Grass", "19 Corrugated Iron", "20 Styrofoam",
19   "21 Bubble Wrap", "22 Leather", "23 Camouflage", "24 Asphalt", "25 Scratched Ice",
20   "26 Rattan", "27 Snow", "28 Dry Mud", "29 Old Concrete", "30 Leopard Skin"
21 };
22
23 const char *objectMenuEntries[NMESH] = {
24   "1 Thin Dinosaur","2 Big Dog","3 Saddle Dinosaur", "4 Dragon", "5 Cleopatra",
25   "6 Bone I", "7 Bone II", "8 Rabbit", "9 Long Dragon", "10 Buddha",
26   "11 Sitting Rabbit", "12 Frog", "13 Cow", "14 Monster", "15 Sea Horse",
27   "16 Head", "17 Pelican", "18 Horse", "19 Kneeling Angel", "20 Porsche I",
28   "21 Truck", "22 Statue of Liberty", "23 Sitting Angel", "24 Metal Part", "25 Car",
29   "26 Apatosaurus", "27 Airliner", "28 Motorbike", "29 Dolphin", "30 Spaceman",
30   "31 Winnie the Pooh", "32 Shark", "33 Crocodile", "34 Toddler", "35 Fat Dinosaur",
31   "36 Chihuahua", "37 Sabre-toothed Tiger", "38 Lioness", "39 Fish", "40 Horse (head down)",
32   "41 Horse (head up)", "42 Skull", "43 Fighter Jet I", "44 Toad", "45 Convertible",
33   "46 Porsche II", "47 Hare", "48 Vintage Car", "49 Fighter Jet II", "50 Winged Monkey",
34   "51 Chef", "52 Parasaurolophus", "53 Rooster", "54 T-rex"
35 };
36
37 SceneObject sceneObjs[MAXOBJECTS];  // An array with details of the objects in a scene
38 int nObjects = 0;                   // How many objects there are in the scene currently.
39 int curObject = -1;                 // The scene object that is currently selected, (-1 is no object)
40 int buttonSelected = -1;                 // Either GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON or -1 (no button)
41 int manipulateState = STATE_CAMERA_ROTATE_MOVE; // See manipulateStates enum
42
43 // Directories containing models
44 char *dirDefault1 = "models-textures";
45 char *dirDefault2 = "/cslinux/examples/CITS2231/project-files/models-textures";
46
47 char dataDir[200];  // Stores the directory name for the meshes and textures.
48
49 int startx, starty;
50
51 /* Size of floor, from -n to n, floorSize must be divisible by squareSize */
52 int floorSize = 200;
53 float squareSize = 2;
54
55 /* Current camera x, y, z coords */
56 GLfloat camx = 0.0, camy = 0.0, camz = 0.0, keyrot = 0.0;
57 GLfloat factor = 1.0;
58
59 /* Length of axis lines */
60 GLfloat lineLength = 10;
61
62 /* Light 0 parameters */
63 GLfloat diffuse0[]={1.0, 0.0, 0.0, 1.0};
64 GLfloat ambient0[]={1.0, 0.0, 0.0, 1.0};
65 GLfloat specular0[]={1.0, 0.0, 0.0, 1.0};
66 GLfloat direction0[] = {0.0, 0.0, 0.0};
67
68 GLfloat lightPosition0[4];
69
70 float lightAngle0 = 0.0, lightHeight0 = 5;
71 int lightMoving0 = 0, lightStartX0, lightStartY0;
72
73 /* Light 1 parameters */
74 GLfloat diffuse1[]={0.0, 1.0, 0.0, 1.0};
75 GLfloat ambient1[]={0.0, 1.0, 0.0, 1.0};
76 GLfloat specular1[]={0.0, 1.0, 0.0, 1.0};
77 GLfloat direction1[] = {0.0, 0.0, 0.0};
78
79 GLfloat lightPosition1[4];
80
81 float lightAngle1 = 360.0, lightHeight1 = 5;
82 int lightMoving1 = 0, lightStartX1, lightStartY1;
83
84 /* Material types */
85 GLfloat ambient[] = {0.2, 0.2, 0.2, 1.0};
86 GLfloat diffuse[] = {1.0, 0.8, 0.0, 1.0};
87 GLfloat specular[] = {1.0, 1.0, 1.0, 1.0};
88 GLfloat shine = 100.0;
89 GLfloat glightmodel[] = {0.2,0.2,0.2,1};
90 GLfloat emission[] = {0.0, 0.3, 0.3, 1.0};
91
92 /* Zoom and rotate tracking */
93 GLfloat zoom = 0.0, rotate = 0.0, camAngle = 40.0;
94 GLfloat zoomFactor = 0.2, rotateFactor = 0.5, camAngleFactor = 0.5;
95 GLfloat leftrightFactor = 0.5, nearfarFactor = 0.5, bigsmallFactor = 0.05, updownFactor = 0.5;
96
97 /* Beginning width, height */
98 int width = 500, height = 500;
99
100 /* Texture state tracking */
101 int currentGroundTexture = 0, currentMeshTexture = 0;

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