#include <framebuffer.h>
Public Types | |
| enum | Format { RGB_FLOAT_32 } |
Public Member Functions | |
| Framebuffer (int width, int height, Format format) | |
| ~Framebuffer () | |
| int | GetWidth () const |
| int | GetHeight () const |
| int | GetPixels () const |
| int | GetSizeInMemory () const |
| Returns the size (in bytes) of the framebuffer in memory. | |
| sheep::Real | GetPixelWidth () const |
| Returns the dimensions of a pixel. | |
| sheep::Real | GetPixelHeight () const |
| sheep::Point2 | ConvertToNDC (int x, int y) const |
| void | ConvertFromNDC (const sheep::Point2 &p, int *x, int *y) const |
| Converts from NDC to pixel coordinates. | |
| void | Clear (Color3 color=Color3(0.0)) |
| Clears the framebuffer with a given color. | |
| Color3 | GetPixel (int x, int y) const |
| void | SetPixel (int x, int y, const Color3 &color) |
| void | PlotLine (int x1, int y1, int x2, int y2, const Color3 &color) |
| void | Normalize () |
| Maps pixel values to the [0..1] interval. | |
| void | CorrectGamma (sheep::Real target_gamma) |
| bool | WriteToDisk (const std::string &filename) const |
| Returns true if success, false otherwise. | |
Private Attributes | |
| int | m_width |
| int | m_height |
| Dimensions of the framebuffer, in pixels. | |
| int | m_pixels |
| Total number of pixels, which is equal to m_width * m_height. | |
| Format | m_format |
| Format of the framebuffer. | |
| union { | |
| pixel_rgb_float_32 * m_rgb_float_32 | |
| } | m_bits |
| sheep::Real | m_inv_width |
| m_inv_width = 1.0 / m_width. | |
| sheep::Real | m_inv_height |
| m_inv_height = 1.0 / m_height. | |
| sheep::Real | m_half_inv_width |
| m_half_inv_width = 1.0 / (2.0 * m_width). | |
| sheep::Real | m_half_inv_height |
| m_half_inv_height = 1.0 / (2.0 * m_height). | |
|
|
Definition at line 40 of file framebuffer.h. |
|
||||||||||||||||
|
Definition at line 34 of file framebuffer.cpp. References m_bits, m_format, m_half_inv_height, m_half_inv_width, m_inv_height, m_inv_width, m_pixels, and RGB_FLOAT_32. |
|
|
Definition at line 58 of file framebuffer.cpp. References m_bits, m_format, and RGB_FLOAT_32. |
|
|
Clears the framebuffer with a given color.
Definition at line 82 of file framebuffer.cpp. References toxic::Color3::m_b, toxic::Framebuffer::pixel_rgb_float_32::m_b, m_bits, m_format, toxic::Color3::m_g, toxic::Framebuffer::pixel_rgb_float_32::m_g, m_pixels, toxic::Color3::m_r, toxic::Framebuffer::pixel_rgb_float_32::m_r, and RGB_FLOAT_32. Referenced by main(). |
|
||||||||||||||||
|
Converts from NDC to pixel coordinates.
Definition at line 159 of file framebuffer.h. Referenced by line(). |
|
||||||||||||
|
Converts from pixel coordinates to NDC (see file renderer/camera.h). Returns NDC of the center of the pixel located at (x, y). Definition at line 149 of file framebuffer.h. Referenced by toxic::Renderer::render_pixel_supersampling(), and toxic::Renderer::render_pixel_whitted(). |
|
|
Definition at line 200 of file framebuffer.cpp. References toxic::Framebuffer::pixel_rgb_float_32::m_b, m_bits, m_format, toxic::Framebuffer::pixel_rgb_float_32::m_g, m_pixels, toxic::Framebuffer::pixel_rgb_float_32::m_r, and RGB_FLOAT_32. Referenced by main(). |
|
|
Definition at line 129 of file framebuffer.h. Referenced by toxic::SceneBuilder::pinholecamera_builder(), toxic::Renderer::ResetRenderArea(), toxic::Renderer::SetRenderArea(), and toxic::SceneBuilder::thinlenscamera_builder(). |
|
||||||||||||
|
Definition at line 170 of file framebuffer.h. |
|
|
Definition at line 144 of file framebuffer.h. Referenced by toxic::Renderer::render_pixel_supersampling(), and toxic::Renderer::render_pixel_whitted(). |
|
|
Definition at line 134 of file framebuffer.h. |
|
|
Returns the dimensions of a pixel.
Definition at line 139 of file framebuffer.h. Referenced by toxic::Renderer::render_pixel_supersampling(), and toxic::Renderer::render_pixel_whitted(). |
|
|
Returns the size (in bytes) of the framebuffer in memory.
Definition at line 68 of file framebuffer.cpp. References m_format, m_pixels, and RGB_FLOAT_32. Referenced by main(). |
|
|
Definition at line 124 of file framebuffer.h. Referenced by toxic::SceneBuilder::pinholecamera_builder(), toxic::Renderer::ResetRenderArea(), toxic::Renderer::Restart(), toxic::Renderer::SetRenderArea(), and toxic::SceneBuilder::thinlenscamera_builder(). |
|
|
Maps pixel values to the [0..1] interval.
Definition at line 145 of file framebuffer.cpp. References toxic::Framebuffer::pixel_rgb_float_32::m_b, m_bits, m_format, toxic::Framebuffer::pixel_rgb_float_32::m_g, m_pixels, toxic::Framebuffer::pixel_rgb_float_32::m_r, max(), and RGB_FLOAT_32. |
|
||||||||||||||||||||||||
|
Definition at line 99 of file framebuffer.cpp. References SetPixel(). Referenced by line(). |
|
||||||||||||||||
|
Definition at line 188 of file framebuffer.h. Referenced by PlotLine(), toxic::Renderer::render_pixel_supersampling(), and toxic::Renderer::render_pixel_whitted(). |
|
|
Returns true if success, false otherwise.
Definition at line 233 of file framebuffer.cpp. References convert_float32_to_uint8(), toxic::Framebuffer::pixel_rgb_float_32::m_b, m_bits, m_format, toxic::Framebuffer::pixel_rgb_float_32::m_g, m_pixels, toxic::Framebuffer::pixel_rgb_float_32::m_r, and RGB_FLOAT_32. Referenced by main(). |
|
|
Referenced by Clear(), CorrectGamma(), Framebuffer(), Normalize(), WriteToDisk(), and ~Framebuffer(). |
|
|
Format of the framebuffer.
Definition at line 85 of file framebuffer.h. Referenced by Clear(), CorrectGamma(), Framebuffer(), GetSizeInMemory(), Normalize(), WriteToDisk(), and ~Framebuffer(). |
|
|
m_half_inv_height = 1.0 / (2.0 * m_height).
Definition at line 98 of file framebuffer.h. Referenced by Framebuffer(). |
|
|
m_half_inv_width = 1.0 / (2.0 * m_width).
Definition at line 97 of file framebuffer.h. Referenced by Framebuffer(). |
|
|
Dimensions of the framebuffer, in pixels.
Definition at line 83 of file framebuffer.h. |
|
|
m_inv_height = 1.0 / m_height.
Definition at line 96 of file framebuffer.h. Referenced by Framebuffer(). |
|
|
m_inv_width = 1.0 / m_width.
Definition at line 95 of file framebuffer.h. Referenced by Framebuffer(). |
|
|
Total number of pixels, which is equal to m_width * m_height.
Definition at line 84 of file framebuffer.h. Referenced by Clear(), CorrectGamma(), Framebuffer(), GetSizeInMemory(), Normalize(), and WriteToDisk(). |
|
|
Definition at line 92 of file framebuffer.h. |
|
|
Definition at line 83 of file framebuffer.h. |
1.3.6