asg00.tar.gz
tarball, gunzip it, and compile the ray tracer with the
Makefile
provided:
gunzip asg00.tar.gz
tar xvf asg00.tar
cd asg00
make clean
make
./main model.txt > test.ppm
test.ppm
image with your
favorite image viewer (e.g., xv
), it should
look like the one here, but larger:
ray_t
object
with the following private data members:
double dis; // distance
vec_t pos; // position
vec_t dir; // direction
and public method:
void trace(model_t&,rgb_t<double>&,object_t*);
ray_t
class.
ray.h
and ray.cpp
).
main()
subroutine to "spawn a ray"
for each position and direction calculated and then
call this ray's trace
method to calculate
the resultant color at each given pixel.
ray_trace()
function from
main.cpp
.
model.txt
file.
trace()
routine into a public member function of the ray_t
class. What you need to watch out for are the stand-alone
function's argument and local variables' semantics,
i.e., how these variable contents change as the recursive ray
tracing algorithm proceeds. In the new object-oriented version,
clearly each ray maintains its own distance, position, and
direction. One tricky aspect of this assignment is how to
properly update these.
trace()
routine agian, each ray needs to spawn a reflection ray and
"bounce" that at the current surface point. Make sure that
you free up any allocated memory here—do NOT create a
memory leak!
tar.gz
archive of your asg##/ directory, including:
README
file containing
Makefile
.h
headers and .cpp
source)
make clean
before tar
)
handin
notes