Support setting individual pixels in vecr::renderer
This commit is contained in:
parent
c8a58d1de4
commit
472d095e2d
2 changed files with 13 additions and 0 deletions
|
|
@ -34,6 +34,8 @@ namespace psemek::vecr
|
||||||
|
|
||||||
void clear(gfx::color_rgba const & color = {0, 0, 0, 0});
|
void clear(gfx::color_rgba const & color = {0, 0, 0, 0});
|
||||||
|
|
||||||
|
void set_pixel(math::vector<std::size_t, 2> const & coords, gfx::color_rgba const & color);
|
||||||
|
|
||||||
void draw(primitive const & primitive);
|
void draw(primitive const & primitive);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,17 @@ namespace psemek::vecr
|
||||||
need_resolve_ = false;
|
need_resolve_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void renderer::set_pixel(math::vector<std::size_t, 2> const & coords, gfx::color_rgba const & color)
|
||||||
|
{
|
||||||
|
for (std::size_t ty = 0; ty < samples_; ++ty)
|
||||||
|
{
|
||||||
|
for (std::size_t tx = 0; tx < samples_; ++tx)
|
||||||
|
{
|
||||||
|
canvas_(coords[0] * samples_ + tx, coords[1] * samples_ + ty) = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void renderer::draw(primitive const & primitive)
|
void renderer::draw(primitive const & primitive)
|
||||||
{
|
{
|
||||||
float const aa = primitive.blur / 2.f;
|
float const aa = primitive.blur / 2.f;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue