for ( int z = -floorSize; z < floorSize; z++ ) {
glColor3f( 1.0, 1.0, 1.0 );
- glNormal3i( 0, 1, 0 );
+ glNormal3i( 1, 1, 0 );
glTexCoord2f( 1.0, 1.0 );
glVertex3f ( (x+1)*squareSize, 0.0, (z+1)*squareSize );
- glNormal3i( 0, 1, 0 );
+ glNormal3i( 1, 1, 0 );
glTexCoord2f( 1.0, 0.0 );
glVertex3f ( (x+1)*squareSize, 0.0, z*squareSize );
- glNormal3i( 0, 1, 0 );
+ glNormal3i( 1, 1, 0 );
glTexCoord2f( 0.0, 0.0 );
glVertex3f ( x*squareSize, 0.0, z*squareSize );
- glNormal3i( 0, 1, 0 );
+ glNormal3i( 1, 1, 0 );
glTexCoord2f( 0.0, 1.0 );
glVertex3f ( x*squareSize, 0.0, (z+1)*squareSize );
}
glDisable(GL_LIGHTING);
for ( int i = 0; i < LIGHTS; i++ ) {
- glDisable(GL_LIGHT0 + i);
+ glDisable( GL_LIGHT0 + i );
- glLightfv(GL_LIGHT0 + i, GL_POSITION, lightObjs[i].position);
- glLightfv(GL_LIGHT0 + i, GL_AMBIENT, lightObjs[i].ambient);
- glLightfv(GL_LIGHT0 + i, GL_DIFFUSE, lightObjs[i].diffuse);
- glLightfv(GL_LIGHT0 + i, GL_SPECULAR, lightObjs[i].specular);
- glLightfv(GL_LIGHT0 + i, GL_SPOT_DIRECTION, lightObjs[i].direction);
+ glLightfv( GL_LIGHT0 + i, GL_POSITION, lightObjs[i].position );
+ glLightfv( GL_LIGHT0 + i, GL_AMBIENT, lightObjs[i].ambient );
+ glLightfv( GL_LIGHT0 + i, GL_DIFFUSE, lightObjs[i].diffuse );
+ glLightfv( GL_LIGHT0 + i, GL_SPECULAR, lightObjs[i].specular );
+ glLightfv( GL_LIGHT0 + i, GL_SPOT_DIRECTION, lightObjs[i].direction );
- glLightf(GL_LIGHT0 + i, GL_SPOT_CUTOFF, lightObjs[i].cutoff);
- glLighti(GL_LIGHT0 + i, GL_SPOT_EXPONENT, (int)lightObjs[i].exponent );
+ glLightf ( GL_LIGHT0 + i, GL_SPOT_CUTOFF, lightObjs[i].cutoff );
+ glLighti ( GL_LIGHT0 + i, GL_SPOT_EXPONENT, lightObjs[i].exponent );
- glEnable(GL_LIGHT0 + i);
+ glEnable ( GL_LIGHT0 + i );
// Draw light ball for light
glPushMatrix();
lightObjs[1].position[3] = 0.0;
/* Initial floor texture */
- currentGroundTexture = 5;
+ // **NOTE: Commented out while testing lighting
+ //currentGroundTexture = 5;
}
\ No newline at end of file
}\r
}\r
\r
-/**\r
- * Keybord event handler\r
- * w/s increase/decrease the z\r
- * a/d increase/decrease the x\r
- * q/e increase/decrease the y\r
- * z/x increase/decrease the angle\r
- * @param key Key pressed\r
- * @param x x co-ordinate of mouse\r
- * @param y y co-ordinate of mouse\r
- */\r
-void keyboard(unsigned char key, int x, int y) {\r
- switch(key) {\r
- case 'w':\r
- case 'W':\r
- camz -= factor;\r
- break;\r
- case 'a':\r
- case 'A':\r
- camx -= factor;\r
- break;\r
- case 's':\r
- case 'S':\r
- camz += factor;\r
- break;\r
- case 'd':\r
- case 'D':\r
- camx += factor;\r
- break;\r
- case 'q':\r
- case 'Q':\r
- camy += factor;\r
- break;\r
- case 'e':\r
- case 'E':\r
- camy -= factor;\r
- break;\r
- case 'z':\r
- case 'Z':\r
- keyrot += factor;\r
- break;\r
- case 'x':\r
- case 'X':\r
- keyrot -= factor;\r
- break;\r
- case '=':\r
- case '+':\r
- factor += 0.1;\r
- printf("Factor of change is now %f\n", factor);\r
- break;\r
- case '-':\r
- case '_':\r
- factor -= 0.1;\r
- printf("Factor of change is now %f\n", factor);\r
- break;\r
-\r
- }\r
- printf("Camera is now at (%f, %f, %f), angle %f\n", camx, camy, camz, keyrot);\r
- glutPostRedisplay();\r
-}\r
-\r
/**\r
* Called when motion event occurs\r
* @param x Mouse x position\r
glEnable(GL_DEPTH_TEST); // Enables Depth Testing\r
glDepthFunc(GL_LEQUAL); // the type\r
glEnable(GL_CULL_FACE);\r
- glLineWidth(2.0);\r
+ glLineWidth(1.0);\r
\r
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);\r
\r
glutReshapeFunc(windowReshape);\r
glutDisplayFunc(display);\r
glutMouseFunc(mouse);\r
- glutKeyboardFunc(keyboard);\r
glutMotionFunc(motion);\r
\r
makeMenu();\r