Definition in file Animation.cpp.
#include <sstream>
#include <iostream>
#include "Image.h"
#include "Object.h"
#include "Scene.h"
#include "Sphere.h"
#include "PerspectiveCamera.h"
#include "CylindricCamera.h"
#include "DepthOfFieldCamera.h"
#include "PointLight.h"
#include "QuadAreaLight.h"
#include "Texture2D.h"
#include "FlatShader.h"
#include "DebugShader.h"
#include "EdgeShader.h"
#include "FlatTransparentShader.h"
#include "MirrorShader.h"
#include "EyeLightShader.h"
#include "PhongShader.h"
#include "CloudShader.h"
#include "PlasmaShader.h"
#include "MarbleShader.h"
#include "BumpMappedDebugShader.h"
#include "BumpMappedPhongShader.h"
#include "BumpMappedMarblePhongShader.h"
#include "TransparentShader.h"
#include "UniAxialCrystalShader.h"
#include "MixShader.h"
#include "MapShader.h"
#include "WoodShader.h"
#include "BumpMappedWoodPhongShader.h"
#include "GoldShader.h"
#include "SilverShader.h"
#include "SteelShader.h"
#include "CopperShader.h"
#include "SampleGenerator.h"
#include "RegularSampleGenerator.h"
#include "RandomSampleGenerator.h"
#include "StratifiedSampleGenerator.h"
#include "PoissonDiskSampleGenerator.h"
Go to the source code of this file.
Namespaces | |
namespace | std |
Defines | |
#define | USE_KDTREE 1 |
Functions | |
Object * | AddObject (char *fileName, Scene &scene, bool useAcc=true, const Object::PrimitiveFactory &factory=Object::TriangleFactory()) |
Object * | AddSphere (Sphere *sphere, Scene &scene, bool useAcc=true) |
Adds the sphere to the scene and returns an object containing the sphere. | |
void | RenderFrame (Scene *scene, string prefix, Vector3D pos, Vector3D dir, float angle, int resX, int resY) |
The standard (and fastest) rendering function. | |
void | RenderSupersampledFrame (Scene *scene, string prefix, Vector3D pos, Vector3D dir, float angle, int resX, int resY, const SampleGenerator &sampler=SampleGenerator(), int sampleCount=1) |
Extended rendering function that produces smoother edges. (Supersampling). | |
void | RenderDepthOfFieldFrame (Scene *scene, string prefix, Vector3D pos, Vector3D dir, float angle, int resX, int resY, float lensRadius, float focalDistance, const SampleGenerator &sampler=SampleGenerator(), int sampleCount=1) |
Implementation of depth of field. | |
void | RenderLinearFramePath (Scene *scene, string prefix, Vector3D pos, Vector3D dir, float angle, int resX, int resY, Vector3D path, int times) |
Render a couple of frames on a linear camera path given by a direction vector. | |
void | RenderStereoFrame (Scene *scene, string prefix, Vector3D pos, Vector3D dir, float angle, int resX, int resY, float distance=0.01f) |
Renders a stereo (red/green) image. | |
void | moveSphere (Sphere *sphere, float deltaRadius, float rotAngle, Vector3D posOffset) |
moves a sphere by changing its radius, rotating it around the y-Axis and adding an offset to the resulting position. | |
Vector3D | rotateVec (Vector3D vec, float rotAngle) |
Rotates the vector by rotAngle and returns the new one. | |
void | hideSphere (Sphere *sphere) |
Hides a sphere by setting its radius to 0. | |
int | main (int argc, char **argv) |
The main function of our RayTracer-Animation. |
#define USE_KDTREE 1 |
Object* AddObject | ( | char * | fileName, | |
Scene & | scene, | |||
bool | useAcc = true , |
|||
const Object::PrimitiveFactory & | factory = Object::TriangleFactory() | |||
) |
Definition at line 97 of file Animation.cpp.
References Scene::AddObject(), Object::BuildAccelStructure(), Object::ParseOBJ(), and Object::setColor().
Referenced by main().
Adds the sphere to the scene and returns an object containing the sphere.
sphere | The sphere to be added to the scene. | |
scene | The scene where the created object is added. | |
useAcc | States whether an acceleration structure (KDTree in our case) will be used to store the sphere. |
Definition at line 117 of file Animation.cpp.
References Object::Add(), Scene::AddObject(), Object::BuildAccelStructure(), and Object::setColor().
Referenced by main().
void hideSphere | ( | Sphere * | sphere | ) |
Hides a sphere by setting its radius to 0.
sphere | The sphere that should be hidden. |
Definition at line 513 of file Animation.cpp.
References Sphere::SetRadius().
int main | ( | int | argc, | |
char ** | argv | |||
) |
The main function of our RayTracer-Animation.
The main function of our "testing" RayTracer.
argc | The number of arguments. | |
argv | The arguments. |
This function rendes our animation from Frame fromFrame to frame toFrame and produces images with dimension (ResX x ResY).
argc | The number of arguments. | |
argv | The arguments. |
This function rendes our testing stuff and produces an image with dimension (ResX x ResY).
Definition at line 531 of file Animation.cpp.
References Scene::AddLight(), AddObject(), AddSphere(), Scene::castShadows, PointLight::changeIllumination(), Texture::LINEAR, moveSphere(), RenderFrame(), RenderSupersampledFrame(), Texture::REPEAT, rotateVec(), Scene::setBgColor(), Texture::setInterpolationMode(), QuadAreaLight::SetNumberOfRays(), Object::setShader(), Object::setVisible(), Texture::setWrapMode(), Timer::Tick(), Scene::timer, and USE_KDTREE.
moves a sphere by changing its radius, rotating it around the y-Axis and adding an offset to the resulting position.
sphere | The sphere to be moved. | |
deltaRadius | The value the radius should be changed with. | |
rotAngle | The sphere will be rotated around the y-Axis with this angle. | |
posOffset. | After having rotated the sphere this offset is added to the position of the sphere. |
Definition at line 487 of file Animation.cpp.
References Sphere::ChangeRadius(), Sphere::GetPosition(), Sphere::SetPosition(), Vector3D::x(), Vector3D::y(), and Vector3D::z().
Referenced by main().
void RenderDepthOfFieldFrame | ( | Scene * | scene, | |
string | prefix, | |||
Vector3D | pos, | |||
Vector3D | dir, | |||
float | angle, | |||
int | resX, | |||
int | resY, | |||
float | lensRadius, | |||
float | focalDistance, | |||
const SampleGenerator & | sampler = SampleGenerator() , |
|||
int | sampleCount = 1 | |||
) |
Implementation of depth of field.
scene | The scene object that will be rendered. | |
prefix | The prefix is used for naming the result. (i.e. prefix == "test" => test1.png, test2.png, ...) | |
pos | The position of the camera. | |
dir | The direction vector of the camera. | |
angle | The opening angle of the camera. | |
resX | The resolution in x direction. | |
resY | The resolution in y direction. | |
lensRadius | ... | |
focalDistance | ... | |
sampler | The SampleGenerator that is used to produce samples. | |
sampleCount | The number of rays(samples) that will be shout for one pixel in the image. |
Definition at line 287 of file Animation.cpp.
References Timer::GetTime(), DepthOfFieldCamera::InitRay(), ColorRGBA::normalize(), Scene::RayTrace(), and Scene::timer.
Referenced by main().
void RenderFrame | ( | Scene * | scene, | |
string | prefix, | |||
Vector3D | pos, | |||
Vector3D | dir, | |||
float | angle, | |||
int | resX, | |||
int | resY | |||
) |
The standard (and fastest) rendering function.
render functions
scene | The scene object that will be rendered. | |
prefix | The prefix is used for naming the result. (i.e. prefix == "test" => test1.png, test2.png, ...) | |
pos | The position of the camera. | |
dir | The direction vector of the camera. | |
angle | The opening angle of the camera. | |
resX | The resolution in x direction. | |
resY | The resolution in y direction. |
Definition at line 144 of file Animation.cpp.
References Timer::GetTime(), PerspectiveCamera::InitRay(), ColorRGBA::normalize(), Scene::RayTrace(), and Scene::timer.
Referenced by main().
void RenderLinearFramePath | ( | Scene * | scene, | |
string | prefix, | |||
Vector3D | pos, | |||
Vector3D | dir, | |||
float | angle, | |||
int | resX, | |||
int | resY, | |||
Vector3D | path, | |||
int | times | |||
) |
Render a couple of frames on a linear camera path given by a direction vector.
scene | The scene object that will be rendered. | |
prefix | The prefix is used for naming the result. (i.e. prefix == "test" => test1.png, test2.png, ...) | |
pos | The position of the camera. | |
dir | The direction vector of the camera. | |
angle | The opening angle of the camera. | |
resX | The resolution in x direction. | |
resY | The resolution in y direction. | |
path | The path of the camera. | |
times | The number of frames that will be rendered on that path. |
Definition at line 365 of file Animation.cpp.
References Timer::GetTime(), ColorRGBA::normalize(), Scene::RayTrace(), Image::setPixel(), Timer::Tick(), Scene::timer, and Image::WritePNG().
void RenderStereoFrame | ( | Scene * | scene, | |
string | prefix, | |||
Vector3D | pos, | |||
Vector3D | dir, | |||
float | angle, | |||
int | resX, | |||
int | resY, | |||
float | distance = 0.01f | |||
) |
Renders a stereo (red/green) image.
scene | The scene object that will be rendered. | |
prefix | The prefix is used for naming the result. (i.e. prefix == "test" => test1.png, test2.png, ...) | |
pos | The position of the camera. | |
dir | The direction vector of the camera. | |
angle | The opening angle of the camera. | |
resX | The resolution in x direction. | |
resY | The resolution in y direction. | |
distance | The distance between the two images. |
Definition at line 428 of file Animation.cpp.
References ColorRGBA::average(), Timer::GetTime(), ColorRGBA::green(), PerspectiveCamera::InitRay(), ColorRGBA::normalize(), Scene::RayTrace(), ColorRGBA::red(), and Scene::timer.
void RenderSupersampledFrame | ( | Scene * | scene, | |
string | prefix, | |||
Vector3D | pos, | |||
Vector3D | dir, | |||
float | angle, | |||
int | resX, | |||
int | resY, | |||
const SampleGenerator & | sampler = SampleGenerator() , |
|||
int | sampleCount = 1 | |||
) |
Extended rendering function that produces smoother edges. (Supersampling).
scene | The scene object that will be rendered. | |
prefix | The prefix is used for naming the result. (i.e. prefix == "test" => test1.png, test2.png, ...) | |
pos | The position of the camera. | |
dir | The direction vector of the camera. | |
angle | The opening angle of the camera. | |
resX | The resolution in x direction. | |
resY | The resolution in y direction. | |
sampler | The SampleGenerator that is used to produce samples. | |
sampleCount | The number of rays(samples) that will be shout for one pixel in the image. |
Definition at line 206 of file Animation.cpp.
References Timer::GetTime(), PerspectiveCamera::InitRay(), ColorRGBA::normalize(), Scene::RayTrace(), and Scene::timer.
Referenced by main().
Rotates the vector by rotAngle and returns the new one.
vec | The vector whose position should be rotated. | |
rotAngle | The angle. |
Definition at line 502 of file Animation.cpp.
References Vector3D::x(), Vector3D::y(), and Vector3D::z().
Referenced by main().