9#include <unordered_map>
23 auto& e = entries_[entity];
25 e.scissor = {x, y, w, h};
29 auto& e = entries_[entity];
32 e.stencil_ref = refValue;
39 entries_[entity].stencil_depth =
static_cast<u16>(depth);
45 entries_[entity].stencil_depth =
static_cast<u16>(depth);
49 bool overflow =
false;
50 for (
auto& [entity, entry] : entries_) {
52 entry.stencil_ref += count;
53 if (entry.stencil_ref > 255) {
56 entry.scissor = {0, 0, 0, 0};
63 const auto it = entries_.find(entity.
id());
68 auto& e = entries_[entity];
71 e.stencil_ref = refValue;
77 auto& e = entries_[entity];
80 e.stencil_ref = refValue;
85 auto it = entries_.find(entity.
id());
86 if (it != entries_.end()) {
88 cmd.
scissor = it->second.scissor;
95 return entries_.count(entity) > 0;
99 auto it = entries_.find(entity);
100 return it != entries_.end() ? &it->second :
nullptr;
104 if (entries_.empty())
return false;
107 && (entry->scissor.w <= 0 || entry->scissor.h <= 0);
111 bool empty()
const {
return entries_.empty(); }
114 std::unordered_map<u32, Entry> entries_;
Core type definitions and utilities for ESEngine.
void setUIStencilMask(u32 entity, i32 depth)
bool isEmptyScissor(Entity entity) const
bool hasEntry(u32 entity) const
void setUIStencilTest(u32 entity, i32 depth)
bool reserveSpriteStencilReferences(i32 count)
const Entry * getEntry(u32 entity) const
void setStencilTestOutside(u32 entity, i32 refValue)
Drawn only where the mask is NOT — the hole, rather than the window.
void setStencilTest(u32 entity, i32 refValue)
void setScissor(u32 entity, i32 x, i32 y, i32 w, i32 h)
void applyTo(Entity entity, DrawCommand &cmd) const
void setStencilMask(u32 entity, i32 refValue)
bool isStencilMask(Entity entity) const
static constexpr u16 CMD_STATE_UI_STENCIL
std::int32_t i32
Signed 32-bit integer.
static constexpr u16 CMD_STATE_SCISSOR
std::uint32_t u32
Unsigned 32-bit integer.
static constexpr u16 CMD_STATE_STENCIL_OUT
static constexpr u16 CMD_STATE_STENCIL_WRITE
std::uint16_t u16
Unsigned 16-bit integer.
static constexpr u16 CMD_STATE_STENCIL_TEST
Entity identifier with packed index + generation.
constexpr u32 id() const
Returns the raw packed value for FFI serialization.