Ray Tracer Common Project
Image rendering program based on the ray tracing technique.
Classes | Typedefs | Functions
rt Namespace Reference

Classes

class  bitmap
 Load an image from the file system. More...
 
class  Camera
 Render camera. More...
 
class  color
 RGBA color representation. More...
 
class  DayNightMaterial
 
class  element
 Geometric surface element unit. More...
 
class  Entity
 Basic space entity. More...
 
class  euclidian
 Localised vector class. More...
 
class  FunnyTexture
 3D texture based on patterns More...
 
class  GeneratedMap
 Some basic texture projections. More...
 
class  Geometry
 Geometric entity. More...
 
class  hit
 The result of a collistion between a Geometry and an euclidian. More...
 
class  image
 Image surface. More...
 
class  ImageTexture
 Image texture. More...
 
class  Light
 Light source class representation. More...
 
class  Material
 Object material. More...
 
class  matrix
 4x4 matrix More...
 
class  Mesh
 
class  Object
 Visibles objects in a scene. More...
 
class  OmniLight
 Omnidirectional light source. More...
 
class  photon
 Light photon class. More...
 
class  Plan
 Geometric plan. More...
 
class  ray
 Light ray. More...
 
class  Scene
 Complete scene. More...
 
class  screen
 Graphical window. More...
 
class  Sphere
 Geometric sphere. More...
 
class  Texture
 Material texture. More...
 
class  TexturedMaterial
 Textured object material. More...
 
class  TextureMap
 Surface element to Texture map. More...
 
struct  vector
 3D vector More...
 
class  video_ostream
 

Typedefs

typedef SDL_Rect rect
 Rectangle. More...
 
typedef std::int8_t int8
 
typedef std::int16_t int16
 
typedef std::int32_t int32
 
typedef std::int64_t int64
 
typedef std::uint8_t uint8
 
typedef std::uint16_t uint16
 
typedef std::uint32_t uint32
 
typedef std::uint64_t uint64
 

Functions

std::ostream & operator<< (std::ostream &out, const color &c)
 
color operator* (double f, const color &c)
 Same as color::operator*(double).
 
euclidian operator* (const matrix &m, const euclidian &e)
 Matrix multiplication with an euclidian. More...
 
rt::matrix operator+ (const rt::matrix &m1, const rt::matrix &m2)
 
rt::matrix operator- (const rt::matrix &m1, const rt::matrix &m2)
 
rt::matrix operator* (const rt::matrix &m1, const rt::matrix &m2)
 
rt::vector operator* (const rt::vector &vector, const rt::matrix &matrix)
 
rt::vector operator* (const rt::matrix &matrix, const rt::vector &vector)
 
rt::matrix operator- (const rt::matrix &matrix)
 
rt::matrix operator* (double factor, const rt::matrix &matrix)
 
rt::matrix operator* (const rt::matrix &matrix, double factor)
 
vector operator* (const double &a, const vector &v)
 
vector operator* (const vector &v, const double &a)
 
std::ostream & operator<< (std::ostream &stream, const vector &v)
 
std::ostream & operator<< (std::ostream &stream, const Mesh &mesh)
 
photon operator* (const color &c, const photon &p)
 Make a color absorb a photon. More...
 
photon operator* (double f, const photon &p)
 Multiply the photon energy (right operator). More...
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Typedef Documentation

◆ rect

typedef SDL_Rect rt::rect

Rectangle.

The rect class just renames the SDL_Rect structure. It provides signed short x and y for the upper-left corner's coordinates, and unsigned short w and h for width and height.

Function Documentation

◆ operator*() [1/5]

photon rt::operator* ( const color c,
const photon p 
)

Make a color absorb a photon.

Parameters
cThe color absorbing.
pA photon.
Returns
A new photon.

◆ operator*() [2/5]

photon rt::operator* ( double  f,
const photon p 
)

Multiply the photon energy (right operator).

Parameters
fEnergy factor.
pThe photon.
Returns
A new photon.

◆ operator*() [3/5]

euclidian rt::operator* ( const matrix m,
const euclidian e 
)
inline

Matrix multiplication with an euclidian.

Parameters
ma 4x4 transformation matrix.
ean euclidian.

This operator is very usefull to map an euclidian in a new space reference.

 euclidian e(vector(0.0, 0.0, 0.0), vector(0.0, 1.0, 0.0));
 matrix m;
 m.translate(vector(1.0, 5.0, -2.0)); // translation
 m.rotate(45, 1.0, 0.0, 0.0); // 45° rotation along x-axis

 euclidian local_e = m*e; // map e into m referential.

The multiplication is defined for a matrix \(M\) and euclidian \(E\) as follow:

\begin{eqnarray*} (M\times E)_{origin} &=& M\times E_{origin} \\ (M\times E)_{direction} &=& M\times(E_{origin}+E_{direction}) - (M\times E)_{origin} \end{eqnarray*}

◆ operator*() [4/5]

vector rt::operator* ( const double &  x,
const vector v 
)

Left multiplication with a scalar \(x \times (a,b,c) = (xa,xb,xc)\)

◆ operator*() [5/5]

vector rt::operator* ( const vector v,
const double &  x 
)

Righ multiplication with a scalar \((a,b,c) \times x = (ax,bx,cx)\)