Render::Raytracer Class Reference

#include <Raytracer.hh>

Inheritance diagram for Render::Raytracer:

Inheritance graph
[legend]
Collaboration diagram for Render::Raytracer:

Collaboration graph
[legend]

List of all members.


Detailed Description

Basic raytracer.

Definition at line 48 of file Raytracer.hh.


Public Member Functions

 Raytracer (const World::Scene &Scene, const Bool Antialiasing=true, const Int MaxDepth=5)
void Render (Graphics::Drawable &Img)

Private Member Functions

void TraceLights (const Math::Vector &ColPoint, const Math::Vector &Normal, const Ray &Reflect, World::Color &Diffuse, World::Color &Specular)
Bool Trace (const Ray &R, World::Color &C, const Int Depth, const Double CurIdx)

Private Attributes

const World::SceneScene
const Bool Antialiasing
const Int MaxDepth
std::vector< Double > RefractiveStack
Int ShadowRays
Int ReflectedRays
Int RefractedRays

Static Private Attributes

static const Int AASize = 2

Constructor & Destructor Documentation

Render::Raytracer::Raytracer ( const World::Scene Scene,
const Bool  Antialiasing = true,
const Int  MaxDepth = 5 
)

Initialize renderer

Parameters:
Scene scene to be rendered
Antialiasing Is antialiasing enabled?
MaxDepth How much should be recurr

Definition at line 25 of file Raytracer.cc.


Member Function Documentation

void Render::Raytracer::TraceLights ( const Math::Vector ColPoint,
const Math::Vector Normal,
const Ray Reflect,
World::Color Diffuse,
World::Color Specular 
) [inline, private]

Check all lights positions. Check if we are shadowed from the light or no. Calculate diffuse and specular coefficients.

Parameters:
ColPoint Collision point
Normal Normal at collision point
Reflect Reflect direction vector
Diffuse Object relevant parameters
Specular Object relevant parameters

Definition at line 38 of file Raytracer.cc.

References World::ColLib::Black(), World::Scene::Collide(), Render::Ray::Direction(), Math::Vector::Dot(), World::Light::GetColor(), World::PointLight::GetPosition(), World::Scene::Iterator< T >::Next(), Render::Ray::RayFromPoints(), Scene, and ShadowRays.

Referenced by Trace().

Here is the call graph for this function:

Here is the caller graph for this function:

Bool Render::Raytracer::Trace ( const Ray R,
World::Color C,
const Int  Depth,
const Double  CurIdx 
) [private]

Trace a ray. Check collisions, create recursively shadow rays, reflected rays and refracted rays.

If we won't hit anything we must place a background color on the resulting image, but this color shouldn't be added into rays calculations. Therefore we mark if we hit anything.

Returns:
true if ray hit object, false if it was directed to the background.

Definition at line 94 of file Raytracer.cc.

References World::ColLib::Black(), World::Scene::Collide(), World::Object::ColorAt(), World::Scene::GetAtmosphere(), Render::Ray::GetPoint(), World::Object::GetProperty(), MaxDepth, World::Object::NormalAt(), Render::Ray::Reflect(), ReflectedRays, Render::Ray::Refract(), RefractedRays, Scene, and TraceLights().

Referenced by Render().

Here is the call graph for this function:

Here is the caller graph for this function:

void Render::Raytracer::Render ( Graphics::Drawable Img  )  [virtual]

Renders scene into Image buffer

Parameters:
Img Drawable object (Screen or Image)

Implements Render::Renderer.

Definition at line 183 of file Raytracer.cc.

References AASize, Antialiasing, World::Camera::View::At(), World::Scene::GetAtmosphere(), World::Scene::GetBackground(), World::Scene::GetCamera(), Graphics::Drawable::GetHeight(), Graphics::Drawable::GetWidth(), Graphics::Drawable::PutPixel(), ReflectedRays, RefractedRays, Scene, ShadowRays, and Trace().

Referenced by Testcases::Render().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Scene to be rendered

Definition at line 50 of file Raytracer.hh.

Referenced by Render(), Trace(), and TraceLights().

const Bool Render::Raytracer::Antialiasing [private]

Anti-aliasing

Definition at line 53 of file Raytracer.hh.

Referenced by Render().

const Int Render::Raytracer::AASize = 2 [static, private]

Antialiasing setting: number of pixels creating one picture-pixel

Square of number of rays used for calculating a single pixel on the screen

Definition at line 57 of file Raytracer.hh.

Referenced by Render().

const Int Render::Raytracer::MaxDepth [private]

Max depth to recur during rendering

Definition at line 60 of file Raytracer.hh.

Referenced by Trace().

Statistics

Definition at line 63 of file Raytracer.hh.

Referenced by Render(), and TraceLights().

Statistics

Definition at line 64 of file Raytracer.hh.

Referenced by Render(), and Trace().

Statistics

Definition at line 65 of file Raytracer.hh.

Referenced by Render(), and Trace().

std::vector<Double> Render::Raytracer::RefractiveStack [private]

Stack of refractive indices of materials we have entered.

Definition at line 71 of file Raytracer.hh.


The documentation for this class was generated from the following files:

Generated on Wed Mar 12 00:35:57 2008 for blaRAY by  doxygen 1.5.5