Code Overview for Assignment 3 (OpenGL)


This web page describes the code that is used for assignment 3. (Pretty similar to the code for assignment 2.) It contains:

Note:

FILE LIST:

Main Ray Tracing Code:

Shape Classes: Light Classes: Other Code: Return to top.


CLASS AND STRUCT LIST:
 
 
File Name Type Name Subclass Of
shape.h class Shape
group.[cpp/h] class ShapeListElement
group.[cpp/h] class Group Shape
rayFileInstance.[cpp/h] class RayFileInstance Shape
triangle.[cpp/h] class Triangle Shape
sphere.[cpp/h] class Sphere Shape
cone.[cpp/h] class Cone Shape
cylinder.[cpp/h] class Cylinder Shape
box.[cpp/h] class Box Shape
line.[cpp/h] class Line Shape
light.[cpp/h] class Light
pointLight.[cpp/h] class PointLight Light
directionalLight.[cpp/h] class DirectionalLight Light
spotLight.[cpp/h] class SpotLight Light
scene.[cpp/h] class Camera
scene.[cpp/h] class Vertex
scene.[cpp/h] class Material
scene.[cpp/h] class Texture
scene.[cpp/h] class RayFile
scene.[cpp/h] class Scene
geometry.[cpp/h] class Point2D
geometry.[cpp/h] class Point3D
geometry.[cpp/h] class Ray
geometry.[cpp/h] class Matrix
bmp.[cpp/h] struct Pixel
bmp.[cpp/h] struct Image
boundingBox.[cpp/h] class BoundingBox

Return to top.



FUNCTION LIST:
 
File Name Function Name
rayView.[cpp/h] void RayView(const char* fileName, int width, int height, int cplx)
rayView.[cpp/h] void Init(void)
rayView.[cpp/h] void Keyboard(unsigned char c, int x, int y)
rayView.[cpp/h] void SpecialKeys(int key, int x, int y)
rayView.[cpp/h] void DepressedMotion(int x, int y)
rayView.[cpp/h] void Motion(int x, int y)
rayView.[cpp/h] void Mouse(int button, int state, int x, int y)
rayView.[cpp/h] void DrawModeMenu(int entry)
rayView.[cpp/h] void MainMenu(int entry)
rayView.[cpp/h] void TakeSnapshot(char* fileName)
rayView.[cpp/h] void Draw(void)
rayView.[cpp/h] void Reshape(int width, int height)
main.cpp int main(int argc, char** argv)
geometry.[cpp/h] Matrix IdentityMatrix(void)
bmp.[cpp/h] Image* ImageNew(int width, int height)
bmp.[cpp/h] void ImageFree(Image** img)
bmp.[cpp/h] void ImageCopy(Image* src, Image* dst)
bmp.[cpp/h] int ImageIsValid(Image* img)
bmp.[cpp/h] Pixel* ImageGetPixel(Image* img, int x, int y)
bmp.[cpp/h] void ImageSetPixel(Image* img, int x, int y, Pixel* p)

Return to top.



CLASS AND STRUCT DESCRIPTION: Return to top.


MEMBERS AND METHODS LIST:
 
File Name Method/Member Name
Shape
shape.h virtual char* Shape::name(void)
shape.h virtual void Shape::write(int indent, FILE* fp=stdout)
shape.h virtual BoundingBox Shape::getBoundingBox(void)
shape.h virtual void Shape::draw(int cplx)
shape.h void Shape::free(void)
ShapeListElement
group.[cpp/h] ShapeListElement* ShapeListElement::next
group.[cpp/h] Shape* ShapeListElement::shape
group.[cpp/h] ShapeListElement::ShapeListElement(Shape* shape)
group.[cpp/h] void ShapeListElement::addShape(Shape* shape)
Group
group.[cpp/h] Matrix Group::localTransform
group.[cpp/h] ShapeListElement* Group::shapeList
group.[cpp/h] Group::Group(FILE* fp)
group.[cpp/h] Group::Group(Matrix localTransform)
group.[cpp/h] void Group::addShape(Shape* shape)
group.[cpp/h] char* Group::name(void)
group.[cpp/h] void Group::write(int indent, FILE* fp=stdout)
group.[cpp/h] BoundingBox Group::getBoundingBox(void)
group.[cpp/h] void Group::draw(int cplx)
group.[cpp/h] void Group::free(void)
RayFileInstance
rayFileInstance.[cpp/h] RayFileInstance::RayFileInstance(RayFile* rayFile)
rayFileInstance.[cpp/h] char* RayFileInstance::name(void)
rayFileInstance.[cpp/h] void RayFileInstance::write(int indent, FILE* fp=stdout)
rayFileInstance.[cpp/h] BoundingBox RayFileInstance::getBoundingBox(void)
rayFileInstance.[cpp/h] void RayFileInstance::draw(int cplx)
Triangle
triangle.[cpp/h] Vertex* Triangle::v[3]
triangle.[cpp/h] Material* Triangle::material
triangle.[cpp/h] Triangle::Triangle(Vertex* v1, Vertex* v2, Vertex* v3, Material* material)
triangle.[cpp/h] Triangle::Triangle(FILE* fp, int* materialIndex, Vertex* vList, int vSize)
triangle.[cpp/h] char* Triangle::name(void)
triangle.[cpp/h] void Triangle::write(int indent, FILE* fp=stdout)
triangle.[cpp/h] BoundingBox Triangle::getBoundingBox(void)
triangle.[cpp/h] void Triangle::draw(int cplx)
Sphere
sphere.[cpp/h] Point3D Sphere::center
sphere.[cpp/h] Flt Sphere::radius
sphere.[cpp/h] Material* Sphere::material
sphere.[cpp/h] Sphere::Sphere(Point3D center, Flt radius, Material* material)
sphere.[cpp/h] Sphere::Sphere(FILE* fp, int* materialIndex)
sphere.[cpp/h] char* Sphere::name(void)
sphere.[cpp/h] void Sphere::write(int indent, FILE* fp=stdout)
sphere.[cpp/h] BoundingBox Sphere::getBoundingBox(void)
sphere.[cpp/h] void Sphere::draw(int cplx)
Cone
cone.[cpp/h] Point3D Cone::center
cone.[cpp/h] Flt Cone::height
cone.[cpp/h] Flt Cone::radius
cone.[cpp/h] Material* Cone::material
cone.[cpp/h] Cone::Cone(Point3D center, Flt height, Flt radius, Material* material)
cone.[cpp/h] Cone::Cone(FILE* fp, int* materialIndex)
cone.[cpp/h] char* Cone::name(void)
cone.[cpp/h] void Cone::write(int indent, FILE* fp=stdout)
cone.[cpp/h] BoundingBox Cone::getBoundingBox(void)
cone.[cpp/h] void Cone::draw(int cplx)
Cylinder
cylinder.[cpp/h] Point3D Cylinder::center
cylinder.[cpp/h] Flt Cylinder::height
cylinder.[cpp/h] Flt Cylinder::radius
cylinder.[cpp/h] Material* Cylinder::material
cylinder.[cpp/h] Cylinder::Cylinder(Point3D center, Flt height, Flt radius, Material* material)
cylinder.[cpp/h] Cylinder::Cylinder(FILE* fp, int* materialIndex)
cylinder.[cpp/h] char* Cylinder::name(void)
cylinder.[cpp/h] void Cylinder::write(int indent, FILE* fp=stdout)
cylinder.[cpp/h] BoundingBox Cylinder::getBoundingBox(void)
cylinder.[cpp/h] void Cylinder::draw(int cplx)
Box
box.[cpp/h] Point3D Box::center
box.[cpp/h] Point3D Box::length
box.[cpp/h] Material* Box::material
box.[cpp/h] Box::Box(Point3D center, Point3D length, Material* material)
box.[cpp/h] Box::Box(FILE* fp, int* materialIndex)
box.[cpp/h] char* Box::name(void)
box.[cpp/h] void Box::write(int indent, FILE* fp=stdout)
box.[cpp/h] BoundingBox Box::getBoundingBox(void)
box.[cpp/h] void Box::draw(int cplx)
Line
line.[cpp/h] Point3D Line::start
line.[cpp/h] Point3D Line::end
line.[cpp/h] Material* Line::material
line.[cpp/h] Line::Line(Point3D start, Point3D end, Material* material)
line.[cpp/h] Line::Line(FILE* fp, int* materialIndex)
line.[cpp/h] Line::Line(Ray ray, Material* material)
line.[cpp/h] char* Line::name(void)
line.[cpp/h] void Line::write(int indent, FILE* fp=stdout)
line.[cpp/h] BoundingBox Line::getBoundingBox(void)
line.[cpp/h] void Line::draw(int cplx)
Light
light.h Point3D Light::color
light.h virtual int Light::read(FILE* fp)
light.h virtual void Light::write(FILE* fp=stdout)
light.h virtual void Light::draw(int lightNum)
PointLight
pointLight.[cpp/h] Point3D PointLight::location
pointLight.[cpp/h] Flt PointLight::constAtten
pointLight.[cpp/h] Flt PointLight::linearAtten
pointLight.[cpp/h] Flt PointLight::quadAtten
pointLight.[cpp/h] int PointLight::read(FILE* fp)
pointLight.[cpp/h] void PointLight::write(FILE* fp=stdout)
pointLight.[cpp/h] void PointLight::draw(int lightNum)
DirectionalLight
directionalLight.[cpp/h] Point3D DirectionalLight::direction
directionalLight.[cpp/h] int DirectionalLight::read(FILE* fp)
directionalLight.[cpp/h] void DirectionalLight::write(FILE* fp=stdout)
directionalLight.[cpp/h] void DirectionalLight::draw(int lightNum)
SpotLight
spotLight.[cpp/h] Point3D SpotLight::location
spotLight.[cpp/h] Point3D SpotLight::direction
spotLight.[cpp/h] Flt SpotLight::constAtten
spotLight.[cpp/h] Flt SpotLight::linearAtten
spotLight.[cpp/h] Flt SpotLight::quadAtten
spotLight.[cpp/h] Flt SpotLight::cutOffAngle
spotLight.[cpp/h] Flt SpotLight::dropOffRate
spotLight.[cpp/h] int SpotLight::read(FILE* fp)
spotLight.[cpp/h] void SpotLight::write(FILE* fp=stdout)
spotLight.[cpp/h] void SpotLight::draw(int lightNum)
Camera
scene.[cpp/h] Flt Camera::heightAngle
scene.[cpp/h] Flt Camera::aspectRatio
scene.[cpp/h] Point3D Camera::position
scene.[cpp/h] Point3D Camera::direction
scene.[cpp/h] Point3D Camera::up
scene.[cpp/h] Point3D Camera::right
scene.[cpp/h] int Camera::read(FILE* fp)
scene.[cpp/h] void Camera::write(FILE* fp=stdout)
scene.[cpp/h] void Camera::draw(void)
Vertex
scene.[cpp/h] int Vertex::index
scene.[cpp/h] Point3D Vertex::position
scene.[cpp/h] Point3D Vertex::normal
scene.[cpp/h] Point2D Vertex::texCoordinate
scene.[cpp/h] int Vertex::read(FILE* fp)
scene.[cpp/h] void Vertex::write(FILE* fp=stdout)
Material
scene.[cpp/h] int Material::index
scene.[cpp/h] Point3D Material::ambient
scene.[cpp/h] Point3D Material::diffuse
scene.[cpp/h] Point3D Material::specular
scene.[cpp/h] Point3D Material::emmisive
scene.[cpp/h] Flt Material::kspec
scene.[cpp/h] Flt Material::ktran
scene.[cpp/h] Flt Material::refind
scene.[cpp/h] Texture* Material::tex
scene.[cpp/h] char Material::foo[ ]
scene.[cpp/h] GLuint Material::handle
scene.[cpp/h] int Material::read(FILE* fp)
scene.[cpp/h] void Material::write(FILE* fp=stdout)
scene.[cpp/h] void Material::draw(void)
Texture
scene.[cpp/h] int Texture::index
scene.[cpp/h] char Texture::filename[ ]
scene.[cpp/h] Image* Texture::img
scene.[cpp/h] GLuint Texture::handle
scene.[cpp/h] int Texture::read(FILE* fp)
scene.[cpp/h] void Texture::write(FILE* fp=stdout)
scene.[cpp/h] void Texture::draw(void)
RayFile
scene.[cpp/h] int RayFile::index
scene.[cpp/h] char RayFile::filename[ ]
scene.[cpp/h] Scene* RayFile::scene
scene.[cpp/h] int RayFile::read(FILE* fp)
scene.[cpp/h] void RayFile::write(FILE* fp=stdout)
scene.[cpp/h] void RayFile::free(void)
Scene
scene.[cpp/h] Point3D Scene::ambient
scene.[cpp/h] Point3D Scene::background
scene.[cpp/h] Camera Scene::camera
scene.[cpp/h] Light** Scene::lights
scene.[cpp/h] int Scene::lightNum
scene.[cpp/h] Shape* Scene::shape
scene.[cpp/h] Scene::Scene(void)
scene.[cpp/h] void Scene::read(const char* filename)
scene.[cpp/h] void Scene::write(FILE* fp=stdout)
scene.[cpp/h] void Scene::draw(int cplx)
Point2D
geometry.[cpp/h] Point2D::Point2D(void)
geometry.[cpp/h] Point2D::Point2D(Flt x, Flt y)
geometry.[cpp/h] Flt& Point2D::operator[ ] (int index)
geometry.[cpp/h] void Point2D::print(void)
geometry.[cpp/h] void Point2D::printnl(void)
geometry.[cpp/h] Flt Point2D::dot(Point2D pt)
geometry.[cpp/h] Flt Point2D::length(void)
geometry.[cpp/h] Point2D Point2D::unit(void)
geometry.[cpp/h] Point2D Point2D::negate(void)
geometry.[cpp/h] Point2D Point2D::operator- (void)
geometry.[cpp/h] Point2D Point2D::scale(Flt scl)
geometry.[cpp/h] Point2D Point2D::operator* (Flt scale)
geometry.[cpp/h] Point2D Point2D::operator/ (Flt scale)
geometry.[cpp/h] Point2D Point2D::add(Point2D pt)
geometry.[cpp/h] Point2D Point2D::operator+ (Point2D pt)
geometry.[cpp/h] Point2D Point2D::subtract(Point2D pt)
geometry.[cpp/h] Point2D Point2D::operator- (Point2D pt)
geometry.[cpp/h] Point2D Point2D::mult(Point2D pt)
Point3D
geometry.[cpp/h] Point3D::Point3D(void)
geometry.[cpp/h] Point3D::Point3D(Flt x, Flt y, Flt z)
geometry.[cpp/h] Flt& Point3D::operator[ ] (int index)
geometry.[cpp/h] void Point3D::print(void)
geometry.[cpp/h] void Point3D::printnl(void)
geometry.[cpp/h] Flt Point3D::dot(Point3D pt)
geometry.[cpp/h] Flt Point3D::length(void)
geometry.[cpp/h] Point3D Point3D::unit(void)
geometry.[cpp/h] Point3D Point3D::negate(void)
geometry.[cpp/h] Point3D Point3D::operator- (void)
geometry.[cpp/h] Point3D Point3D::scale(Flt scl)
geometry.[cpp/h] Point3D Point3D::operator* (Flt scale)
geometry.[cpp/h] Point3D Point3D::operator/ (Flt scale)
geometry.[cpp/h] Point3D Point3D::add(Point3D pt)
geometry.[cpp/h] Point3D Point3D::operator+ (Point3D pt)
geometry.[cpp/h] Point3D Point3D::subtract(Point3D pt)
geometry.[cpp/h] Point3D Point3D::operator- (Point3D pt)
geometry.[cpp/h] Point3D Point3D::crossProduct(Point3D pt)
geometry.[cpp/h] Point3D Point3D::mult(Point3D pt)
Ray
geometry.[cpp/h] Point3D Ray::p
geometry.[cpp/h] Point3D Ray::d
geometry.[cpp/h] Ray::Ray(void)
geometry.[cpp/h] Ray::Ray(Point3D p,Point3D d)
geometry.[cpp/h] void Ray::print(void)
geometry.[cpp/h] void Ray::printnl(void)
geometry.[cpp/h] Ray Ray::translate(Point3D pt)
geometry.[cpp/h] Point3D Ray::operator( ) (Flt param)
geometry.[cpp/h] Point3D Ray::position(Flt param)
Matrix
geometry.[cpp/h] Flt& Matrix::operator( ) (int col,int row)
geometry.[cpp/h] Flt Matrix::det(void)
geometry.[cpp/h] void Matrix::print(void)
geometry.[cpp/h] void Matrix::printnl(void)
geometry.[cpp/h] Matrix Matrix::mult(Matrix m)
geometry.[cpp/h] Matrix Matrix::operator* (Matrix m)
geometry.[cpp/h] Matrix Matrix::transpose(void)
geometry.[cpp/h] Matrix Matrix::invert(void)
geometry.[cpp/h] Point3D Matrix::multPosition(Point3D position)
geometry.[cpp/h] Point3D Matrix::multDirection(Point3D direction)
geometry.[cpp/h] Point3D Matrix::multNormal(Point3D normal)
geometry.[cpp/h] Ray Matrix::mult(Ray ray)
geometry.[cpp/h] Ray Matrix::operator* (Ray ray)
BoundingBox
boundingBox.[cpp/h] Point3D BoundingBox::p[2]
boundingBox.[cpp/h] BoundingBox::BoundingBox(void)
boundingBox.[cpp/h] BoundingBox::BoundingBox(Point3D p1, Point3D p2)
boundingBox.[cpp/h] BoundingBox::BoundingBox(Point3D* pList, int listSize)
boundingBox.[cpp/h] BoundingBox BoundingBox::operator+ (BoundingBox b)
boundingBox.[cpp/h] BoundingBox BoundingBox::Transform(Matrix m)
boundingBox.[cpp/h] Flt BoundingBox::intersects(Ray ray)
Pixel
bmp.[cpp/h] unsigned char Pixel::r
bmp.[cpp/h] unsigned char Pixel::g
bmp.[cpp/h] unsigned char Pixel::b
Image
bmp.[cpp/h] int Image::width
bmp.[cpp/h] int Image::height
bmp.[cpp/h] Pixel* Image::pixels

Return to top.



FUNCTION DESCRIPTION:
  Return to top.


CLASS AND STRUCT MEMBERS AND METHODS DESCRIPTION:


Return to top.