Ray Tracing, Version 3.2
Day #7
|
Goal: Ray trace a scene where
|
Ray Tracing Tools:
Add this new class: Cube. Like all the other object classes, it will have one method: hit. Be sure to test it before entrusting it to your ray tracer. If you would like to have separate classes for cone and cylinder, you may add these. Be sure to calculate the appropriate generic hit normal for each type of object.
ReadScene:
As you add each new generic object to your ray tracer, the readScene method needs to be updated to reflect this.
Test Files:
cube.scn
All files are located in /classes/cs3114/Advanced_Graphics/files directory
Optional:
The ray tracing process should speed up if we use the concept of extents, and the generic cube makes an ideal extent for our other generic objects. In the hit method for each object, first test the inverse transformed ray against the generic cube. If it misses the cube, no further testing is necessary. If it hit the cube, then test it with the generic object. You may not notice much of a speed up yet, but it should be more apparent as our tracer becomes more complex.