- As a matter of notation, all colors are specified by a 3D array where the first coordinate specifies the red color, the second specifies the green color, and the third specifies the blue color.
- Flt is a typedef for double. This can be changed in the code but should not be.
Main Ray Tracing code:
ray.[cpp/h]
: Code responsible for casting rays, calling intersection methods, computing colors, etc.Shape Classes:
shape.h
: Abstract base class that all shapes must implement.group.[cpp/h]
: Shape subclass describing a scene-graph.rayFileInstance.[cpp/h]
: Shape subclass describing the scene graph specified in a.ray
file.triangle.[cpp/h]
: Shape subclass describing a triangle.sphere.[cpp/h]
: Shape subclass describing a sphere.cone.[cpp/h]
Shape subclass describing a cone.cylinder.[cpp/h]
: Shape subclass describing a cylinder.box.[cpp/h]
: Shape subclass describing a box.- .
line.[cpp/h]
: Shape subclass describing a line segmentLight Classes:
light.h
: Abstract base class that all lights must implement.pointLight.[cpp/h]
: Light subclass describing a point light.directionalLight.[cpp/h]
: Light subclass describing a directional light.spotLight.[cpp/h]
: Light subclass describing a spot light.Other Code:
main.cpp
: Parses apart the command line arguments and invokes the ray tracer.scene.[cpp/h]
: Classes that store environmental information, textures, materials, rayFiles, etc.geometry.[cpp/h]
: Most of the code for the geometric manipulation you will need (matrix multiplication, vector addition, etc.).boundingBox.[cpp/h]
: Defines bounding boxes.bmp.[cpp/h]
: Code responsible for reading and writing BMP files.
File Name Type Name Subclass Of shape.h
class Shape - shape.h
struct IntersectionInfo - 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.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 - boundingBox.[cpp/h]
class BoundingBox - bmp.[cpp/h]
struct Pixel - bmp.[cpp/h]
struct Image -
Return to top.
File Name Function Name ray.[cpp/h] Image* RayTrace(const char* fileName, int width, int height, int rLimit, float cLimit) ray.[cpp/h] Point3D GetColor(Scene scene, Ray ray, IntersectionInfo iInfo, int rDepth, float cLimit) 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.
Return to top.
- Shape: This abstract class is used to describe all shapes that are ray-tracable.
- IntersectionInfo: This structure is used to store intersection information
- ShapeListElement: This class is used to store a linked list of shapes
- Group: This subclass of Shape represents a single node of the scene-graph
- RayFileInstance: This subclass of Shape is used to point to an instance of a scene-graph that is read out of a .ray file
- Triangle: This subclass of Shape represents a triangle
- Sphere: This subclass of Shape represents a sphere
- Cone: This subclass of Shape represents a cone
- Cylinder: This subclass of Shape represents a cylinder
- Box: This subclass of Shape represents a box
- Line: This subclass of Shape represents a line segment
- Light: This abstract is used to describe all the different lights within the scene
- PointLight: This subclass of Light is used to describe a point-light
- DirectionalLight: This subclass of Light is used to describe a directional-light
- SpotLight: This subclass of Light is used to describe a spot-light
- Camera: This class is used to describe the location and orientation of the camera in the scene
- Vertex: This class represents a vertex, it stores the vertex position, normal, and texture coordinate
- Material: This class is used to store material information about a Shape
- Texture: For Shapes that support texture-mapping this class stores the Image corresponding to the texture
- RayFile: This class stores the instance of a scene-graph that is read out of a .ray file
- Scene: This class is used to store all the information read out from a .ray file
- Point2D: This class represents a 2D vector
- Point3D: This class represents a 3D vector
- Ray: This class represents a directed ray
- Matrix: This class represents a 4x4 matrix, used to describe local transformations
- BoundingBox: This class is used to describe the bounding box of a Shape.
- Pixel: This stores the red, green, and blue components of a pixel
- Image: This describes a 2D array of pixels which store an image
shape.h
):
shape.h
):
group.[cpp/h]
):
group.[cpp/h]
):
rayFileInstance.[cpp/h]
):
triangle.[cpp/h]
)
sphere.[cpp/h]
):
cone.[cpp/h]
):
cylinder.[cpp/h]
):
box.[cpp/h]
):
line.[cpp/h]
):
light.h
)
pointLight.[cpp/h]
):
directionalLight.[cpp/h]
):
spotLight.[cpp/h]
):
scene.[cpp/h]
):
scene.[cpp/h]
):
scene.[cpp/h]
):
scene.[cpp/h]
):
scene.[cpp/h]
)
scene.[cpp/h]
):
geometry.[cpp/h]
):
geometry.[cpp/h]
):
geometry.[cpp/h]
):
geometry.[cpp/h]
):
boundingBox.[cpp/h]
):
bmp.[cpp/h]
):
bmp.[cpp/h]
):
Return to top.
Image* RayTrace(const char*
fileName, int width, int height, int rLimit, float
cLimit)
This function is the meat of the ray-tracer. It reads in a .ray
file
with the specified file-name and returns the ray-traced image. The width
and height specify the size of the Image. The ray-tracer
is recursive and will stop if either the depth exceeds rLimit or
the color contribution is smaller than cLimit.
.ray
file name, the destination file name, the width, the height, etc. and invokes the RayTrace(...) command. It then writes out the image to
the specified destination file.
Return to top.