fix: optimization: PVS-Studio warning V821

Creating variables in a more localized scope can enhance performance and make the code easier to understand.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
Vyacheslav Ivanov 2024-08-02 02:43:52 +03:00 • committed by Pugemon
parent e9a5f18bc3
commit 6b3146f98a
No known key found for this signature in database
GPG key ID: 472FA343B3CC3287
4 changed files with 5 additions and 5 deletions

View file

@ -243,13 +243,13 @@ void WorldRenderer::renderBlockSelection() {
void WorldRenderer::renderLines(
Camera* camera, Shader* linesShader, const DrawContext& pctx
) {
auto ctx = pctx.sub(lineBatch.get());
linesShader->use();
linesShader->uniformMatrix("u_projview", camera->getProjView());
if (player->selection.vox.id != BLOCK_VOID) {
renderBlockSelection();
}
if (player->debug && showEntitiesDebug) {
auto ctx = pctx.sub(lineBatch.get());
level->entities->renderDebug(*lineBatch, *frustumCulling, ctx);
}
}