fix: optimization: PVS-Studio warning V813
Passing large objects by const reference avoids unnecessary copying and enhances efficiency. Reported by: PVS-Studio Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
@@ -230,10 +230,12 @@ void WorldRenderer::renderBlockSelection() {
|
||||
: block->hitboxes;
|
||||
|
||||
lineBatch->lineWidth(2.0f);
|
||||
constexpr auto boxOffset = glm::vec3(0.02);
|
||||
constexpr auto boxColor = glm::vec4(0.f, 0.f, 0.f, 0.5f);
|
||||
for (auto& hitbox: hitboxes) {
|
||||
const glm::vec3 center = glm::vec3(pos) + hitbox.center();
|
||||
const glm::vec3 size = hitbox.size();
|
||||
lineBatch->box(center, size + glm::vec3(0.02), glm::vec4(0.f, 0.f, 0.f, 0.5f));
|
||||
lineBatch->box(center, size + boxOffset, boxColor);
|
||||
if (player->debug) {
|
||||
lineBatch->line(point, point+norm*0.5f, glm::vec4(1.0f, 0.0f, 1.0f, 1.0f));
|
||||
}
|
||||
@@ -340,12 +342,12 @@ void WorldRenderer::draw(
|
||||
ctx.setDepthTest(true);
|
||||
ctx.setCullFace(true);
|
||||
renderLevel(ctx, camera, settings, delta, pause);
|
||||
// Debug lines
|
||||
|
||||
if (hudVisible){
|
||||
renderLines(camera, linesShader, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
// Debug lines
|
||||
if (hudVisible && player->debug) {
|
||||
renderDebugLines(wctx, camera, linesShader);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user