add 'emission' argument to gfx.blockwraps.wrap

This commit is contained in:
MihailRis 2025-12-21 00:28:41 +03:00
parent dfdc7ebf6b
commit 4d950c974e
3 changed files with 13 additions and 6 deletions

View file

@ -57,7 +57,9 @@ void BlockWrapsRenderer::draw(BlockWrapper& wrapper, const Texture* texture) {
glm::vec4 light(1, 1, 1, 0);
if (wrapper.emission < 1.0f) {
light = Lightmap::extractNormalized(chunks.getLight(wrapper.position));
light = wrapper.emission + (1.0f - light);
light.r += wrapper.emission;
light.g += wrapper.emission;
light.b += wrapper.emission;
}
switch (wrapper.modelType) {
case BlockModelType::BLOCK:
@ -150,11 +152,13 @@ void BlockWrapsRenderer::draw(const DrawContext& pctx, const Player& player) {
}
u64id_t BlockWrapsRenderer::add(
const glm::ivec3& position, const std::string& texture
const glm::ivec3& position, const std::string& texture, float emission
) {
u64id_t id = nextWrapper++;
wrappers[id] = std::make_unique<BlockWrapper>(BlockWrapper {
position, {texture, texture, texture, texture, texture, texture}});
position,
{texture, texture, texture, texture, texture, texture},
emission});
return id;
}