c163e83835ae00b51faf791a5d90844c586ca078
[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 /* Light object arrays and default values */
44 LightObject lightObjs[LIGHTS];
45
46 GLfloat defaultPosition[] = {0.0, 0.0, 0.0, 0.0};
47
48 GLfloat defaultAmbient[] = {0.0, 1.0, 0.0, 1.0};
49 GLfloat defaultDiffuse[] = {0.0, 1.0, 0.0, 1.0};
50 GLfloat defaultSpecular[] = {1.0, 0.0, 0.0, 1.0};
51 GLfloat defaultDirection[] = {0.0, 0.0, 0.0};
52
53 GLfloat defaultCutoff = 0;
54 GLfloat defaultExponent = 1;
55
56 /* Material types */
57 GLfloat materialAmbient[] = {0.2, 0.2, 0.2, 1.0};
58 GLfloat materialDiffuse[] = {1.0, 0.8, 0.0, 1.0};
59 GLfloat materialSpecular[] = {1.0, 1.0, 1.0, 1.0};
60
61 /* Light parameters */
62 GLfloat lightShine = 100.0;
63 GLfloat lightGlobalModel[] = {0.2,0.2,0.2,1};
64 GLfloat lightGlobalEmission[] = {0.0, 0.3, 0.3, 1.0};
65 GLfloat lightBallSize = 0.2;
66
67 // Directories containing models
68 char *dirDefault1 = "models-textures";
69 char *dirDefault2 = "/cslinux/examples/CITS2231/project-files/models-textures";
70
71 char dataDir[200];  // Stores the directory name for the meshes and textures.
72
73 int startx, starty;
74
75 /* Size of floor, from -n to n, floorSize must be divisible by squareSize */
76 int floorSize = 200;
77 float squareSize = 2;
78
79 /* Current camera x, y, z coords */
80 GLfloat camx = 0.0, camy = 0.0, camz = 0.0, keyrot = 0.0;
81 GLfloat factor = 1.0;
82
83 /* Length of axis lines */
84 GLfloat lineLength = 10;
85
86 /* Zoom and rotate tracking */
87 GLfloat zoom = 0.0, rotate = 0.0, camAngle = 40.0;
88 GLfloat zoomFactor = 0.2, camRotateFactor = 0.5, camAngleFactor = 0.5;
89 GLfloat leftrightFactor = 0.05, nearfarFactor = 0.1, bigsmallFactor = 0.6, updownFactor = 0.03, rotateFactor = 0.8, texscaleFactor = 0.2;
90
91 /* Beginning width, height */
92 int width = 700, height = 700;
93
94 /* Texture state tracking */
95 int currentGroundTexture = 0, currentMeshTexture = 0;

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