CPSC 102-001 Computer Science II
(Advanced C Programming)

Fall 2010
09:05-09:55MW Daniel 415
Assignment 3

Objectives:
To implement a simple ray caster
Due date:
10/04/10

What to hand in:
A tar.gz archive of your asg3/ directory, including:
  1. A README file containing
    1. Course id--section no
    2. Name
    3. Assignment description
    4. Brief solution description (e.g., program design, description of algorithm, etc., however appropriate).
    5. Lessons learned, identified interesting features of your program
    6. Any special usage instructions
  2. Makefile
  3. source code (.h headers and .c source)
  4. object code (do a make clean before tar)
How to hand in:
See handin notes

Description:
  1. Using the object_find_closest() function tested in lab5, implement a simple (one-hit) ray tracer (known as a ray caster) to process the model file given below.

  2. See the notes (pp.20-23 in particular).

  3. Sample input:
    camera cam1
    {
       pixeldim 640 480
       worlddim 8   6
       viewpoint 4 3 6
    }
    
    material green
    {
       ambient 0 5 0
    }
    
    material yellow
    {
       ambient  5 4 0
       diffuse  4 4 0
      specular  1 1 1
    }
    
    plane leftwall
    {
       material green
       normal 3 0 1
       point  0 0 0
    }
    
    plane rightwall
    {
       material yellow
       normal -3 0 1
       point   8 0 0
    }
    
    material gray
    {
       ambient 2 2 2
    }
    
    plane floor
    {
       material gray
       normal 0 1 0
       point  0 -0.2 0
    }
    		
  4. Sample output:

  5. Changing the left and right wall normals' z-components to 0.1, i.e.,
    plane leftwall
    {
       material green
       normal 3 0 0.1
       point  0 0 0
    }
    
    plane rightwall
    {
       material yellow
       normal -3 0 0.1
       point   8 0 0
    }
    		
    and re-running the code produces the image below: