Path Tracer
Public Member Functions | Static Public Attributes | List of all members
Picture Class Reference

Stores radiance for every pixel. More...

#include <Picture.h>

Public Member Functions

 Picture ()
 Default constructor. More...
 
 Picture (unsigned int width, unsigned int height, double renderTime=-1)
 Main constructor. More...
 
 Picture (const Picture &picture)
 Copy constructor. More...
 
 ~Picture ()
 Destructor. More...
 
unsigned int getWidth () const
 Getter for the width. More...
 
unsigned int getHeight () const
 Getter for the height. More...
 
double getRenderTime () const
 Getter for the render time. More...
 
std::vector< std::vector< DoubleVec3D > > getPixels () const
 Getter for the pixels. More...
 
void addValuePix (unsigned int x, unsigned int y, DoubleVec3D value)
 Adds a value to a pixel. More...
 
void setValuePix (unsigned int x, unsigned int y, DoubleVec3D value)
 Sets a pixel value. More...
 
void setRenderTime (double renderTime)
 Setter for the render time. More...
 
void export2File (double middleGrey, std::string fileName, unsigned int movingAverage=0) const
 Writes this as a picture file. More...
 
void printAll () const
 Prints the whole page. More...
 
void modify ()
 Interactive modification of this picture. More...
 

Static Public Attributes

static constexpr unsigned int MAX_COLOUR_VALUE = 255
 The maximum value that will be used to write a colour in a file. More...
 

Detailed Description

Stores radiance for every pixel.

Constructor & Destructor Documentation

◆ Picture() [1/3]

Picture::Picture ( )

Default constructor.

By default, width and height are both set to 500.

◆ Picture() [2/3]

Picture::Picture ( unsigned int  width,
unsigned int  height,
double  renderTime = -1 
)

Main constructor.

All pixels are set to (0, 0, 0).

Parameters
widthThe picture width.
heightThe picture height.
renderTimeThe time in seconds it took to compute this picture.

◆ Picture() [3/3]

Picture::Picture ( const Picture picture)

Copy constructor.

Parameters
pictureThe picture that will be copied.

◆ ~Picture()

Picture::~Picture ( )

Destructor.

Member Function Documentation

◆ addValuePix()

void Picture::addValuePix ( unsigned int  x,
unsigned int  y,
DoubleVec3D  value 
)

Adds a value to a pixel.

Parameters
xThe x coordinate of the pixel.
yThe y coordinate of the pixel.
valueThe value that will be added to that pixel.

◆ export2File()

void Picture::export2File ( double  middleGrey,
std::string  fileName,
unsigned int  movingAverage = 0 
) const

Writes this as a picture file.

Uses the CImg library.

Parameters
middleGreyThe middle-grey value that will be used for the toneMapping() function.
fileNameThe path to the file where we want to write this picture. If it is "-", it will give a very nice bugged result. This could be easily fixed, but it is very fun and purely nondestructive.
movingAverageThe size of the moving average (see getColourMovingAverage()).
See also
toneMapping(), getColourMovingAverage()

◆ getHeight()

unsigned int Picture::getHeight ( ) const

Getter for the height.

Returns
The camera height.

◆ getPixels()

Picture::getPixels ( ) const

Getter for the pixels.

Returns
A std::vector of std::vector that contains the radiance at each pixel.

◆ getRenderTime()

double Picture::getRenderTime ( ) const

Getter for the render time.

Returns
The time it took to compute this picture.

◆ getWidth()

unsigned int Picture::getWidth ( ) const

Getter for the width.

Returns
The camera width.

◆ modify()

void Picture::modify ( )

Interactive modification of this picture.

This is a page on its own. It allows the user to write the picture under different names, different middle-grey values and different moving average size.

See also
writeToFile(), toneMapping(), getColourMovingAverage()

◆ printAll()

void Picture::printAll ( ) const

Prints the whole page.

Clears the page, prints the header, information and the available commands.

See also
clearScreenPrintHeader()

◆ setRenderTime()

void Picture::setRenderTime ( double  renderTime)

Setter for the render time.

This method can be used if the time was not set when the picture was instanciated (which is very likely to happen).

Parameters
renderTimeThe new time this picture took to be computed.

◆ setValuePix()

void Picture::setValuePix ( unsigned int  x,
unsigned int  y,
DoubleVec3D  value 
)

Sets a pixel value.

Parameters
xThe x coordinate of the pixel.
yThe y coordinate of the pixel.
valueThe value to which that pixel will be set.

Member Data Documentation

◆ MAX_COLOUR_VALUE

static constexpr unsigned int Picture::MAX_COLOUR_VALUE = 255
staticconstexpr

The maximum value that will be used to write a colour in a file.

See also
toneMapping()

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