#include <Raytracer.hh>


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::Scene & | Scene |
| const Bool | Antialiasing |
| const Int | MaxDepth |
| std::vector< Double > | RefractiveStack |
| Int | ShadowRays |
| Int | ReflectedRays |
| Int | RefractedRays |
Static Private Attributes | |
| static const Int | AASize = 2 |
| Render::Raytracer::Raytracer | ( | const World::Scene & | Scene, | |
| const Bool | Antialiasing = true, |
|||
| const Int | MaxDepth = 5 | |||
| ) |
Initialize renderer
| Scene | scene to be rendered | |
| Antialiasing | Is antialiasing enabled? | |
| MaxDepth | How much should be recurr |
Definition at line 25 of file Raytracer.cc.
| 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.
| 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().


| 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.
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().


| void Render::Raytracer::Render | ( | Graphics::Drawable & | Img | ) | [virtual] |
Renders scene into Image buffer
| 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().


const World::Scene& Render::Raytracer::Scene [private] |
Scene to be rendered
Definition at line 50 of file Raytracer.hh.
Referenced by Render(), Trace(), and TraceLights().
const Bool Render::Raytracer::Antialiasing [private] |
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().
Int Render::Raytracer::ShadowRays [private] |
Int Render::Raytracer::ReflectedRays [private] |
Int Render::Raytracer::RefractedRays [private] |
std::vector<Double> Render::Raytracer::RefractiveStack [private] |
Stack of refractive indices of materials we have entered.
Definition at line 71 of file Raytracer.hh.
1.5.5