X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=globals.c;h=c7c5e719f68464983e6d6d8ceed268df80d15bc7;hp=a95bfbd9d1c6ac464e26688e1d8c0f90aac364a9;hb=fe551bcf4f464576a9e1e76acc83ba24d0bfe63c;hpb=f369e5b4fb935813043425ddde66098775615261;ds=sidebyside diff --git a/globals.c b/globals.c index a95bfbd..c7c5e71 100644 --- a/globals.c +++ b/globals.c @@ -35,7 +35,10 @@ const char *objectMenuEntries[NMESH] = { }; SceneObject sceneObjs[MAXOBJECTS]; // An array with details of the objects in a scene -int nObjects=0; // How many objects there are in the scene currently. +int nObjects = 0; // How many objects there are in the scene currently. +int curObject = -1; // The scene object that is currently selected, (-1 is no object) +int buttonSelected = -1; // Either GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON or -1 (no button) +int manipulateState = STATE_CAMERA_ROTATE_MOVE; // See manipulateStates enum // Directories containing models char *dirDefault1 = "models-textures"; @@ -43,35 +46,56 @@ char *dirDefault2 = "/cslinux/examples/CITS2231/project-files/models-textures"; char dataDir[200]; // Stores the directory name for the meshes and textures. -GLfloat lightColor[] = {1.0, 1.0, 1.0, 1.0}; // White light -GLfloat lightPosition[4]; +int startx, starty; -int moving, startx, starty; -int lightMoving = 0, lightStartX, lightStartY; +/* Size of floor, from -n to n, floorSize must be divisible by squareSize */ +int floorSize = 200; +float squareSize = 2; -/* Time varying or user-controled variables. */ -float jump = 0.0; -float lightAngle = 0.0, lightHeight = 5; -GLfloat angle = -150; /* in degrees */ -GLfloat angle2 = 30; /* in degrees */ +/* Current camera x, y, z coords */ +GLfloat camx = 0.0, camy = 0.0, camz = 0.0, keyrot = 0.0; +GLfloat factor = 1.0; -/* Near and far parameters */ -GLfloat near = -20; -GLfloat far = 20; +/* Length of axis lines */ +GLfloat lineLength = 10; -/* Zoom factor for mouse movements */ -GLfloat zoomFactor = 1.0; +/* Light 0 parameters */ +GLfloat diffuse0[]={1.0, 0.0, 0.0, 1.0}; +GLfloat ambient0[]={1.0, 0.0, 0.0, 1.0}; +GLfloat specular0[]={1.0, 0.0, 0.0, 1.0}; +GLfloat direction0[] = {0.0, 0.0, 0.0}; -/* Recursion level for floor drawing */ -int drawFloorRecurse = 5; +GLfloat lightPosition0[4]; -/* Size of floor, from -n to n */ -int floorSize = 200; +float lightAngle0 = 0.0, lightHeight0 = 5; +int lightMoving0 = 0, lightStartX0, lightStartY0; -/* Light 0 parameters */ -GLfloat diffuse0[] = {1.0, 1.0, 1.0, 1.0}; -GLfloat ambient0[] = {0.0, 0.0, 0.0, 1.0}; -GLfloat specular0[] = {1.0, 1.0, 1.0, 1.0}; -GLfloat emission0[] = {0.0, 0.0, 0.0, 0.0}; -GLfloat light0_pos[] ={1.0, 1.0, 0,0, 1.0}; -GLfloat glightmodel[] = {0.2,0.2,0.2,1}; \ No newline at end of file +/* Light 1 parameters */ +GLfloat diffuse1[]={0.0, 1.0, 0.0, 1.0}; +GLfloat ambient1[]={0.0, 1.0, 0.0, 1.0}; +GLfloat specular1[]={0.0, 1.0, 0.0, 1.0}; +GLfloat direction1[] = {0.0, 0.0, 0.0}; + +GLfloat lightPosition1[4]; + +float lightAngle1 = 360.0, lightHeight1 = 5; +int lightMoving1 = 0, lightStartX1, lightStartY1; + +/* Material types */ +GLfloat ambient[] = {0.2, 0.2, 0.2, 1.0}; +GLfloat diffuse[] = {1.0, 0.8, 0.0, 1.0}; +GLfloat specular[] = {1.0, 1.0, 1.0, 1.0}; +GLfloat shine = 100.0; +GLfloat glightmodel[] = {0.2,0.2,0.2,1}; +GLfloat emission[] = {0.0, 0.3, 0.3, 1.0}; + +/* Zoom and rotate tracking */ +GLfloat zoom = 0.0, rotate = 0.0, camAngle = 40.0; +GLfloat zoomFactor = 0.2, rotateFactor = 0.5, camAngleFactor = 0.5; +GLfloat leftrightFactor = 0.5, nearfarFactor = 0.5, bigsmallFactor = 0.6, updownFactor = 0.5; + +/* Beginning width, height */ +int width = 500, height = 500; + +/* Texture state tracking */ +int currentGroundTexture = 0, currentMeshTexture = 0; \ No newline at end of file