mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
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:
parent
5b325ac2bc
commit
2c1103307f
42 changed files with 173 additions and 144 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue