nngn
|
Axis-aligned sprite rasterizer with texture sampling. More...
Public Member Functions | |
void | update_projection (nngn::uvec2 term_size, nngn::uvec2 window_size, const nngn::Graphics::Camera &c) |
void | rasterize (std::size_t vbo_n, const nngn::Vertex *vbo, std::size_t ebo_n, const std::uint32_t *ebo, std::size_t n_textures, const Texture *textures, FrameBuffer *framebuffer) const |
Private Member Functions | |
std::array< nngn::vec3, 4 > | to_clip (nngn::Vertex v0, nngn::Vertex v1) const |
Transforms world-space vertices into clip space. More... | |
nngn::vec2 | to_screen (nngn::vec3 v) const |
Transforms clip-space vertices into screen space. More... | |
Static Private Member Functions | |
static bool | clip (nngn::vec3 bl, nngn::vec3 tr) |
Checks whether a sprite lies entirely outside of the clip volume. More... | |
static std::size_t | clamp_floor (float max, float v) |
Clamps value between 0 and max , rounds toward -infinity . More... | |
static std::size_t | clamp_ceil (float max, float v) |
Clamps value between 0 and max , rounds toward +infinity . More... | |
static float | uv_coord (float p0, std::size_t p, float p1, float t0, float t1) |
Calculates texture coordinates for a given position in a sprite. More... | |
Private Attributes | |
nngn::vec3 | size = {} |
nngn::mat4 | proj = {} |
Axis-aligned sprite rasterizer with texture sampling.
|
staticprivate |
Clamps value between 0
and max
, rounds toward +infinity
.
|
staticprivate |
Clamps value between 0
and max
, rounds toward -infinity
.
|
staticprivate |
Checks whether a sprite lies entirely outside of the clip volume.
void anonymous_namespace{terminal.cpp}::Rasterizer::rasterize | ( | std::size_t | vbo_n, |
const nngn::Vertex * | vbo, | ||
std::size_t | ebo_n, | ||
const std::uint32_t * | ebo, | ||
std::size_t | n_textures, | ||
const Texture * | textures, | ||
FrameBuffer * | framebuffer | ||
) | const |
|
private |
Transforms world-space vertices into clip space.
|
private |
Transforms clip-space vertices into screen space.
void anonymous_namespace{terminal.cpp}::Rasterizer::update_projection | ( | nngn::uvec2 | term_size, |
nngn::uvec2 | window_size, | ||
const nngn::Graphics::Camera & | c | ||
) |
|
staticprivate |
Calculates texture coordinates for a given position in a sprite.
|
private |
|
private |