
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An assignment for a computer science course, cmsc 740, in the spring 2002 semester. The assignment involves extending a 2d maze into a 3d environment by extruding the walls, setting up the 3d viewing matrices, implementing rotations and translations for the viewer, adding a light source, and creating a 2d overview of the maze. Students are expected to use opengl for implementation.
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Due: 12:30pm Thursday, March 14, 2002
This assignment involves extending your code for Assignment 1 from 2D to 3D. (a) Extrude the maze from 2D to 3D, with the height of each wall being 60 units and thickness 2 units. Thus each line of the 2D maze should correspond to four vertical rectangles forming the four sides of a cuboid. For example, if a wall is from (1, 10) to (10, 10) the four rectangles representing this wall in 3D will have the following extents: (i) (0, 9 , 0) to (11, 9 , 60), (ii) (11, 9 , 0) to (11, 11 , 60), (iii) (0, 11 , 0) to (11, 11 , 60), and (iv) (0, 9 , 0) to (0, 11 , 60). Remember to orient the rectangles correctly and with appropriate normals for correct illumination. (3)
(b) Set up the 3D modelview and projection matrices. Set up the field of view to 60 o, aspect ra- tio 1 , near clipping plane at 1 and far clipping plane at 800. Set the initial viewpoint at (75, 75 , 50), looking at (75, 100 , 50) with the up vector along (0, 0 , 1). Render the 3D maze with these viewing parameters. (5)
(c) Implement rotations of the viewer on the arrow keys. Use the up/down arrow keys to allow the viewer to look up or down by 5 o^ for each key press. Also implement the left/right viewing on the left/right arrow keys, 30 o^ for each key press. Implement translation of the viewer using the space-bar, 50 units forward for each key press. Here forward is defined as the horizontal component of the direction the user is looking at. Reuse the 2D collision detection code from Assignment 1 to prevent Gump from moving through walls. (5)
(d) Implement a light source on Gump’s head pointed in the direction of viewing (sort of like the miner’s helmet light). The values of the light and wall colors in the demo are given below. Feel free to change them. Just make sure that you don’t have the scene overly dark or bright. (5)
GLfloat wall_ambient[] = { 0.3, 0.3, 0.1, 1.0}; GLfloat wall_diffuse[] = { 0.27, 0.51, 0.70, 1.0}; GLfloat light_ambient[] = { 0.7, 0.7, 0.7, 1.}; GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1};
(e) Finding your way around in a 3D version of the maze is difficult. To help in navigation create a small 2D (128 × 128) overview of the maze (your assignment 1) in the top-right corner of the display window to guide the actions of Gump. This 2D display should float above the 3D geometry being drawn. (2)
Special Note: Refer to the demo version of our sample implementation of this game to resolve any ambiguities that might have remained in the above description.