Ray Tracing, Version 3.0
Day #5
|
Goal: Ray trace a scene where
|
Ray Tracing Tools:
Add the following methods to class GLdoublePoint and thoroughly test each:
GLdoublePoint set(Ray3D r, double t);
which returns the point given by ray r at time t.GLdoubleVector operator - (GLdoublePoint secondPoint) ;
which returns the vector going from this point to second point.
Add to class GLdoubleVector and thoroughly test :
GLdoubleVector multiplyByMatrixTranspose( Matrix_4x4 M);
which returns the product of the transpose of M postmultiplied by this vectorGLdoubleVector operator + (GLdoubleVector other);
which returns the sum of this vector and other vector
Add to class Object:
//data
bool isMaterial; which is false if only using emissive color, true otherwise.and change the constructor to initialize isMaterial to true.
Add these new classes and thoroughly test:
class Light
{
public:
//methods:
Constructor, which initializes values//data:
Color3 ambient, diffuse, specular;
GLdoublePoint pos; //position of light
}
class Material
{
public:
//methods:
Constructor, which initializes values
void set(Material source);//data:
Color3 ambient, diffuse, specular, emissive;
float specularExponent;
}
Test Files:
These test files are available, which show the red and blue spheres, now lighted, from various positions:
lookingfront.scn
lookingback.scn
lookingright.scn
lookingdown.scn
All files are located in /classes/cs3114/Advanced_Graphics/files directory