Animation.cpp File Reference


Detailed Description

The main file of our animation.

Author:
Saarland University, Jonas Eckhardt, Simon Wegener

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

ObjectAddObject (char *fileName, Scene &scene, bool useAcc=true, const Object::PrimitiveFactory &factory=Object::TriangleFactory())
ObjectAddSphere (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 Documentation

#define USE_KDTREE   1

Definition at line 518 of file Animation.cpp.

Referenced by main().


Function Documentation

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

Object * AddSphere ( Sphere sphere,
Scene scene,
bool  useAcc = true 
)

Adds the sphere to the scene and returns an object containing the sphere.

Parameters:
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.
Returns:
A pointer to the created object.

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.

Parameters:
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.

Parameters:
argc The number of arguments.
argv The arguments.
USAGE: ./Animation fromFrame toFrame ResX ResY [-super (stratified|random|regular|poisson)]

This function rendes our animation from Frame fromFrame to frame toFrame and produces images with dimension (ResX x ResY).

Parameters:
argc The number of arguments.
argv The arguments.
USAGE: ./MicroTrace [ResX=320 ResY=256]

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.

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.

Parameters:
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.

Parameters:
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

Parameters:
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.

Parameters:
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.

Parameters:
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).

Parameters:
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.
Supersampling works as follows: For each pixel of the resulting image there will be shout more than one ray in a slightly different position (the SampleGenerator gives these positions) and these results will be interpolated.

Definition at line 206 of file Animation.cpp.

References Timer::GetTime(), PerspectiveCamera::InitRay(), ColorRGBA::normalize(), Scene::RayTrace(), and Scene::timer.

Referenced by main().

Vector3D rotateVec ( Vector3D  vec,
float  rotAngle 
)

Rotates the vector by rotAngle and returns the new one.

Parameters:
vec The vector whose position should be rotated.
rotAngle The angle.
Returns:
The rotated vector.

Definition at line 502 of file Animation.cpp.

References Vector3D::x(), Vector3D::y(), and Vector3D::z().

Referenced by main().


Generated on Thu Jan 31 21:48:49 2008 for RayTracer by  doxygen 1.5.4