Ray Tracer Common Project
Image rendering program based on the ray tracing technique.
Public Types | Public Member Functions | Protected Member Functions | List of all members
rt::Camera Class Reference

Render camera. More...

#include <camera.hpp>

Inheritance diagram for rt::Camera:
rt::Entity

Public Types

enum  RenderQuality { FastRender = 0, RenderLights = 1, RenderAmbientOcclusion = 2, FullRender = 3 }
 Render quality flags. More...
 

Public Member Functions

 Camera (const vector &position, const vector &target, const vector &up, double near=3.0)
 Main constructor. More...
 
const vectortarget () const
 The camera focus target.
 
void setTarget (const vector &target)
 set the camera focus target
 
virtual void render (image &img, int flags=FullRender) const
 Process a render. More...
 
- Public Member Functions inherited from rt::Entity
 Entity (Entity *parent=0)
 Default entity constructor. More...
 
 Entity (const vector &pos, Entity *parent=0)
 Make a new entity from its position and parent. More...
 
 Entity (double x, double y, double z, Entity *parent=0)
 Make a new entity from its position coordinates and parent. More...
 
virtual ~Entity ()=0
 Destructor. More...
 
void soil ()
 Make an entity dirty. More...
 
bool isDirty () const
 
virtual void update ()
 Update the global matrix of the entity and its children.
 
const matrixglobalMatrix () const
 The global matrix of the entity. More...
 
const matrixinvertedGlobalMatrix () const
 The invert of the global matrix of the entity. More...
 
vector globalPosition () const
 Global position of the entity. More...
 
const vectorposition () const
 Entity location.
 
const vectorrotation () const
 Entity rotation.
 
void setPosition (const vector &pos)
 Set the entity position. More...
 
void setRotation (const vector &rot)
 Set the entity rotation. More...
 
Entityparent () const
 The parent entity. More...
 
void setParent (Entity *)
 Set the parent entity. More...
 
Scenescene () const
 The scene of the entity.
 
void setScene (Scene *)
 Set the scene of the entity. More...
 
const std::unordered_set< Entity * > & children () const
 Entity children.
 
void addChild (Entity *)
 Add a child. More...
 
void removeChild (Entity *)
 Remove a child. More...
 
template<class T >
void queryAll (std::list< const T *> &list) const
 Get the list of a specific type of entity. More...
 

Protected Member Functions

ray project (int ix, int iy, int width, int height) const
 Build a new ray projected from a render target position. More...
 

Detailed Description

Render camera.

The camera is used to compute a render from a given point of view and direction.

Member Enumeration Documentation

◆ RenderQuality

Render quality flags.

Enumerator
FastRender 

Fast render all flags off.

RenderLights 

Use lights to process the render.

RenderAmbientOcclusion 

Compute ambiant occlusion.

FullRender 

All flags on.

Constructor & Destructor Documentation

◆ Camera()

rt::Camera::Camera ( const vector position,
const vector target,
const vector up,
double  near = 3.0 
)

Main constructor.

Parameters
positionThe position of the camera.
targetA target position. The camera will look to this point.
upAn up vector to set the camera rotation. The bottom-top line of the render will follow this vector.
render_targetAn image to write the render to.

Member Function Documentation

◆ project()

rt::ray rt::Camera::project ( int  ix,
int  iy,
int  width,
int  height 
) const
protected

Build a new ray projected from a render target position.

Parameters
ixx-axis position of the pixel (0 is left side).
iyy-axis position of the pixel (0 is top side).
widthSize width of the render image.
heightSize height of the render image.
Returns
A new ray well projected in the scene.

◆ render()

void rt::Camera::render ( image img,
int  flags = FullRender 
) const
virtual

Process a render.

Parameters
imgThe render target.
flagsRender quality flags (see Camera::RenderQuality).

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