Computer_Science
 Home | People | Curriculum | Projects | Resources | Media

Computer Graphics

CMSC 212

Haverford College

Fall 2003

Lab 5

Wednesday, November 19

Rendering of Polygon Meshes with Textures

This project generalizes work from the previous lab assignment, and should not be started until the previous one is completed successfully (see instructor a more precise definition of "successfully"). In fact, many of the labs build on each other, so proper programming organization and documentation are essential throughout the course. You may want to return to the previous lab and reorganize it so it is simpler to extend.

Extend the previous lab assignment to that the faces of the polygon-mesh are rendered with a surface texture -- it is your choice on how to generate the texture, but please indicate in the source which method is chosen. Some options:

The general format of the universe.ent file is (again) given here:

camera                  //string
e.x e.y e.z
l.x l.y l.z             //9 doubles
up.x up.y up.z
projection type         //string(parallel || perspective || frustum)
//if parallel:
xmin xmax
ymin ymax               //6 doubles
zmin zmax
//if projection:
width
height                  //3 doubles
distance from camera
//if frustum
xmin xmax
ymin ymax               //3 doubles
zmin zmax
num of objects          //int
for each object, a filename (.ent)

The format of a polygon-mesh text file is given here (.ent):

polygon-mesh            //string
number of faces         //int
//for each face:
ambient  a.r a.g a.b a.alpha	// string, then 4 doubles, each 0 <= x <= 1
diffuse  d.r d.g d.b d.aplha	// string, then 4 doubles, each 0 <= x <= 1
specular s.r s.g s.b s.alpha	// string, then 4 doubles, each 0 <= x <= 1
emissive e.r e.g e.b e.alpha	// string, then 4 doubles, each 0 <= x <= 1
number of vertices      //int
//for each vertex:
x y z                   //3 doubles

The format of a point-light-source (.ent) is given here:

point-light-source		// string
l.x l.y l.z			// location
ambient  a.r a.g a.b a.alpha	// string, then 4 doubles, each 0 <= x <= 1
diffuse  d.r d.g d.b d.aplha	// string, then 4 doubles, each 0 <= x <= 1
specular s.r s.g s.b s.alpha	// string, then 4 doubles, each 0 <= x <= 1

Extra and optional: The format of a spotlight (.ent) is given here:

spotlight			// string
l.x l.y l.z			// position of spotlight (3 doubles)
d.x d.y d.z			// direction of spotlight (3 doubles)
cutoff ang			// string, then double for angle
exponent exp			// string, then double
ambient  a.r a.g a.b a.alpha	// string, then 4 doubles, each 0 <= x <= 1
diffuse  d.r d.g d.b d.aplha	// string, then 4 doubles, each 0 <= x <= 1
specular s.r s.g s.b s.alpha	// string, then 4 doubles, each 0 <= x <= 1

Sample scene files are available at the path /Network/Servers/moe.cs.haverford.edu/Users/jd/courses/212/examples:

Some things to consider before final submission of the lab:


Links for CS212 -- Other CS212 Assignments: 0 1 2 3 4 5 6 7

Haverford College Page maintained by John Dougherty, David Wonnacott, and Rachel Heaton.
Computer Science Department, Haverford College.