mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
update 'overlay-texture' block property behaviour
This commit is contained in:
parent
4f377b2056
commit
9b5c693027
8 changed files with 44 additions and 16 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "assets/Assets.hpp"
|
||||
#include "assets/assets_util.hpp"
|
||||
#include "content/Content.hpp"
|
||||
#include "engine.hpp"
|
||||
#include "frontend/LevelFrontend.hpp"
|
||||
|
|
@ -461,12 +462,14 @@ void WorldRenderer::renderBlockOverlay(const DrawContext& wctx, const Assets& as
|
|||
if (def.overlayTexture.empty()) {
|
||||
return;
|
||||
}
|
||||
auto textureRegion = util::get_texture_region(
|
||||
assets, def.overlayTexture, "blocks:notfound"
|
||||
);
|
||||
DrawContext ctx = wctx.sub();
|
||||
ctx.setDepthTest(false);
|
||||
ctx.setCullFace(false);
|
||||
|
||||
auto& shader = assets.require<Shader>("ui3d");
|
||||
auto& atlas = assets.require<Atlas>("blocks");
|
||||
shader.use();
|
||||
batch3d->begin();
|
||||
shader.uniformMatrix("u_projview", glm::mat4(1.0f));
|
||||
|
|
@ -479,14 +482,14 @@ void WorldRenderer::renderBlockOverlay(const DrawContext& wctx, const Assets& as
|
|||
glm::min(1.0f, Lightmap::extract(light, 2) / 15.0f + s),
|
||||
1.0f
|
||||
);
|
||||
batch3d->texture(atlas.getTexture());
|
||||
batch3d->texture(textureRegion.texture);
|
||||
batch3d->sprite(
|
||||
glm::vec3(),
|
||||
glm::vec3(0, 1, 0),
|
||||
glm::vec3(1, 0, 0),
|
||||
2,
|
||||
2,
|
||||
atlas.get(def.overlayTexture),
|
||||
textureRegion.region,
|
||||
tint
|
||||
);
|
||||
batch3d->flush();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue