Manages RGBA8 color pixels and Z-buffer for software rasterization.
More...
#include <SoftwareFramebuffer.hpp>
|
| | SoftwareFramebuffer ()=default |
| | Constructs an empty framebuffer.
|
| | SoftwareFramebuffer (uint32_t width, uint32_t height) |
| | Constructs a framebuffer with specific pixel dimensions.
|
| void | resize (uint32_t width, uint32_t height) |
| | Resizes color and depth buffers.
|
| void | clearColor (RgbaColor color) noexcept |
| | Clears color buffer to specified RGBA color.
|
| void | clearDepth (float depth=1.0F) noexcept |
| | Clears depth buffer to specified value.
|
| void | clear (RgbaColor color, float depth=1.0F) noexcept |
| | Clears both color and depth buffers.
|
| bool | testAndSetPixel (uint32_t pixel_x, uint32_t pixel_y, float depth, RgbaColor color) noexcept |
| | Tests depth and writes pixel if closer than current depth.
|
| bool | blendAdditivePixel (uint32_t pixel_x, uint32_t pixel_y, float depth, RgbaColor color) noexcept |
| | Performs depth-tested additive alpha blending into the color buffer without writing depth.
|
| float | getDepth (uint32_t pixel_x, uint32_t pixel_y) const noexcept |
| | Reads depth value at pixel.
|
| uint32_t | width () const noexcept |
| uint32_t | height () const noexcept |
| std::span< const uint8_t > | colorBytes () const noexcept |
| const std::vector< uint8_t > & | colorBuffer () const noexcept |
| const std::vector< float > & | depthBuffer () const noexcept |
Manages RGBA8 color pixels and Z-buffer for software rasterization.
◆ SoftwareFramebuffer() [1/2]
| correlation::render3d::SoftwareFramebuffer::SoftwareFramebuffer |
( |
| ) |
|
|
default |
Constructs an empty framebuffer.
◆ SoftwareFramebuffer() [2/2]
| correlation::render3d::SoftwareFramebuffer::SoftwareFramebuffer |
( |
uint32_t | width, |
|
|
uint32_t | height ) |
|
inline |
Constructs a framebuffer with specific pixel dimensions.
- Parameters
-
| width | Viewport pixel width. |
| height | Viewport pixel height. |
◆ blendAdditivePixel()
| bool correlation::render3d::SoftwareFramebuffer::blendAdditivePixel |
( |
uint32_t | pixel_x, |
|
|
uint32_t | pixel_y, |
|
|
float | depth, |
|
|
RgbaColor | color ) |
|
inlinenoexcept |
Performs depth-tested additive alpha blending into the color buffer without writing depth.
- Parameters
-
| pixel_x | X pixel coordinate. |
| pixel_y | Y pixel coordinate. |
| depth | Fragment depth value. |
| color | Fragment RGBA color (alpha channel modulates additive brightness). |
- Returns
- True if fragment passed depth test and was blended.
◆ clear()
| void correlation::render3d::SoftwareFramebuffer::clear |
( |
RgbaColor | color, |
|
|
float | depth = 1.0F ) |
|
inlinenoexcept |
Clears both color and depth buffers.
- Parameters
-
| color | Background fill color. |
| depth | Clear depth value. |
◆ clearColor()
| void correlation::render3d::SoftwareFramebuffer::clearColor |
( |
RgbaColor | color | ) |
|
|
inlinenoexcept |
Clears color buffer to specified RGBA color.
- Parameters
-
◆ clearDepth()
| void correlation::render3d::SoftwareFramebuffer::clearDepth |
( |
float | depth = 1.0F | ) |
|
|
inlinenoexcept |
Clears depth buffer to specified value.
- Parameters
-
| depth | Depth value (default 1.0F). |
◆ colorBuffer()
| const std::vector< uint8_t > & correlation::render3d::SoftwareFramebuffer::colorBuffer |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ colorBytes()
| std::span< const uint8_t > correlation::render3d::SoftwareFramebuffer::colorBytes |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ depthBuffer()
| const std::vector< float > & correlation::render3d::SoftwareFramebuffer::depthBuffer |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ getDepth()
| float correlation::render3d::SoftwareFramebuffer::getDepth |
( |
uint32_t | pixel_x, |
|
|
uint32_t | pixel_y ) const |
|
inlinenodiscardnoexcept |
Reads depth value at pixel.
- Parameters
-
| pixel_x | X pixel coordinate. |
| pixel_y | Y pixel coordinate. |
- Returns
- Depth buffer value.
◆ height()
| uint32_t correlation::render3d::SoftwareFramebuffer::height |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ resize()
| void correlation::render3d::SoftwareFramebuffer::resize |
( |
uint32_t | width, |
|
|
uint32_t | height ) |
|
inline |
Resizes color and depth buffers.
- Parameters
-
| width | New pixel width. |
| height | New pixel height. |
◆ testAndSetPixel()
| bool correlation::render3d::SoftwareFramebuffer::testAndSetPixel |
( |
uint32_t | pixel_x, |
|
|
uint32_t | pixel_y, |
|
|
float | depth, |
|
|
RgbaColor | color ) |
|
inlinenoexcept |
Tests depth and writes pixel if closer than current depth.
- Parameters
-
| pixel_x | X pixel coordinate. |
| pixel_y | Y pixel coordinate. |
| depth | Fragment depth value. |
| color | Fragment RGBA color. |
- Returns
- True if fragment passed depth test and was written.
◆ width()
| uint32_t correlation::render3d::SoftwareFramebuffer::width |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ color_buffer_
| std::vector<uint8_t> correlation::render3d::SoftwareFramebuffer::color_buffer_ |
|
private |
◆ depth_buffer_
| std::vector<float> correlation::render3d::SoftwareFramebuffer::depth_buffer_ |
|
private |
◆ height_
| uint32_t correlation::render3d::SoftwareFramebuffer::height_ {0} |
|
private |
◆ width_
| uint32_t correlation::render3d::SoftwareFramebuffer::width_ {0} |
|
private |
The documentation for this class was generated from the following file: