fix blocks selection with semi-transparent blocks

This commit is contained in:
MihailRis 2024-11-16 09:30:02 +03:00
parent b28bcf052b
commit 171cbb48d0
2 changed files with 12 additions and 2 deletions

View File

@ -210,12 +210,15 @@ void ChunksRenderer::drawChunks(
visibleChunks += drawChunk(indices[i].index, camera, shader, culling);
}
//}
drawSortedMeshes(camera, shader);
}
void ChunksRenderer::drawSortedMeshes(const Camera& camera, Shader& shader) {
timeutil::ScopeLogTimer log(444);
const auto& atlas = assets.require<Atlas>("blocks");
atlas.getTexture()->bind();
std::vector<const SortingMeshEntry*> entries;
const auto& chunks = level.chunks->getChunks();

View File

@ -164,10 +164,18 @@ void WorldRenderer::renderLevel(
particles->render(camera, delta * !pause);
auto& shader = assets.require<Shader>("main");
auto& linesShader = assets.require<Shader>("lines");
setupWorldShader(shader, camera, settings, fogFactor);
chunks->drawChunks(camera, shader);
if (hudVisible) {
renderLines(camera, linesShader, ctx);
}
shader.use();
chunks->drawSortedMeshes(camera, shader);
if (!pause) {
scripting::on_frontend_render();
}
@ -326,7 +334,6 @@ void WorldRenderer::draw(
ctx, camera, *lineBatch, linesShader, showChunkBorders
);
}
renderLines(camera, linesShader, ctx);
if (player->currentCamera == player->fpCamera) {
renderHands(camera, delta * !pause);
}