Color and depth buffer management.
More...
Color and depth buffer management.
◆ SRPColor
Holds RGBA8888 color data
◆ SRPFramebuffer
Holds RBGA8888 color buffer and depth buffer
◆ framebufferClear()
Clear a framebuffer: fill the color with black and depth with -1
- Parameters
-
◆ srpFramebufferDrawPixel()
| void srpFramebufferDrawPixel |
( |
const SRPFramebuffer * |
this, |
|
|
size_t |
x, |
|
|
size_t |
y, |
|
|
double |
depth, |
|
|
uint32_t |
color |
|
) |
| |
Draw a pixel in a framebuffer
- Parameters
-
| [in] | this | The pointer to SRPFramebuffer, as returned from srpNewFramebuffer |
| [in] | x,y | Position at which to draw the pixel. X-axis points from left to right, Y-axis - from top to bottom |
| [in] | depth | Depth value to assign to the pixel, assumed to be inside the [-1, 1] interval. If it is less than currently assigned depth buffer value to this pixel, nothing is drawn. |
| [in] | color | RBGA8888 color to draw. |
- Todo:
- This is not the job of the framebuffer to check this, this should be deleted after the primitive clipping implementation
◆ srpFramebufferNDCToScreenSpace()
| void srpFramebufferNDCToScreenSpace |
( |
const SRPFramebuffer * |
this, |
|
|
const double * |
NDC, |
|
|
double * |
SS |
|
) |
| |
Convert Normalized Device Coordinates to screen-space coordiantes
- Parameters
-
| [in] | this | The pointer to SRPFramebuffer, as returned from srpNewFramebuffer |
| [in] | NDC | Pointer to 3-element double array containing NDC position |
| [out] | SS | Pointer to 3-element double array that will contain SS position after the call. The z-component is the same as z-component of NDC coordinates. |
◆ srpFreeFramebuffer()
Free a framebuffer
- Parameters
-
◆ srpNewFramebuffer()
Create a framebuffer
- Parameters
-
| [in] | width | Width of a new framebuffer in pixels |
| [in] | height | Height of a new framebuffer in pixels |
- Returns
- A pointer to the created framebuffer