Ray Tracing, Version 1.5
Day #3
|
Goal: Ray trace a scene where
|
Ray Tracing Tools:
Add the following methods to class Object and thoroughly test each:
void scale(GLdouble scale_x, GLdouble scale_y, GLdouble scale_z); which changes the object's current transformation matrix to indicate the primitive has been scaled by (scale_x, scale_y, scale_z).
void rotate(GLdouble degrees, GLdouble x, GLdouble y, GLdouble z); which changes the object's current transformation matrix to indicate the primitive has been rotated CCW through an angle of "degrees" about the axis given by <x, y, z>.
Add the following methods to class GLdoubleVector and thoroughly test each:
GLdoubleVector cross(GLdoubleVector other); which returns the cross product of this vector with other vector.
void normalize(); which normalizes this vector (makes it have unit length.)
Driver Program:
Copy your driver program rt_1.cpp to rt_1.5.cpp. Instead of the two spheres defined in the program, define these spheres (inside the function defineSpheres):
- a green sphere that has been translated by (-5.0, 0.0, -2.0) and then rotated 45 degrees with respect to the z-axis
- a green sphere that has been translated by (5.0, 0.0, -2.0) and then rotated 45 degrees with respect to the z-axis
- a yellow sphere that has been scaled by (5.0, 1.0, 1.0), then translated by (0.0, 0.0, -2.0), and then rotated by 45 degrees with respect to the z-axis
Begin Working On Version 2.0:
Then we will need to put in informations about the camera:
- position
- look at point
- theta
- distance to the near plane