Ray Tracing, Version 2.0
| Goal: Ray trace a scene where
|
Directory:
Scene Tools:
Suggestion:
Add a class, Scene, which is defined in /classes/cs3114/RayTracing/Projects/scene_tools.h
The header file for the class has been started for you. Just implement the methods, according to the pre- and post-conditions. (Some of the methods you have previously implemented, local to your driver program.) Be sure to test the methods before using them. The methods include:
- readScene -- first version is found in /classes/cs3114/RayTracing/Projects/scene_tools.cpp. Feel free to copy and paste, or write your own.
- shadePixel
- rayTracer
- getFirstHit
- shader
- setup
Ray Tracing Tools:
Suggestion: Add the following classes to ray_tracing_tools:
Class Data MethodsPrimitive string prim_type
Color3 color
Matrix_4x4 M
Method Precondition Postcondition Primitive( )
M has been set to Identity Matrix
Ray inverseTransform(Ray the_ray) the "inverse transform" of the_ray has been returned
Sphere none
Method Precondition Postcondition bool hit(size_t whichone, Ray itRay, Intersection &inter)
whichone is the index of the primitive (on the list of primitives),
itRay is the inverse transformed ray to be tested
if the object[whichone] has been hit by itRay, then inter contains the record of the intersection and true has been returned; otherwise false has been returned.
HitInfo GLdouble hit_time
int which_obj
Point generic_hit_point
Method Precondition Postcondition HitInfo( )
hit_time has been initialized to -1.0 and which_obj has been initialized to -1
Intersection GLdouble num_hits
vector<HitInfo> hit
Method Precondition Postcondition Intersection( )
num_hits has been initialized to 0
set(Intersection source) the data has been set to the values in source's data fields
Test Scene: /classes/cs3114/RayTracing/Projects/Scenes/red_sphere.scn
- this should produce the same image as version 1.x
Driver Program:
Makefile:
Be sure to change your makefile to account for scene_tools.h and scene_tools.cpp.
Working Directory:
Make a subdirectory v2.0 in your Working Directory. When you have version 2.0 working correctly, copy all files pertaining to it, including the makefile, to that directory and don't touch it!
Submit:
|