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:
Vyacheslav Ivanov
2024-08-02 05:35:55 +03:00
committed by Pugemon
parent 5b325ac2bc
commit 2c1103307f
42 changed files with 173 additions and 144 deletions
+9 -5
View File
@@ -37,7 +37,10 @@ class ModelBatch {
static inline glm::vec3 SUN_VECTOR {0.411934f, 0.863868f, -0.279161f};
inline void vertex(
glm::vec3 pos, glm::vec2 uv, glm::vec4 light, glm::vec3 tint
const glm::vec3& pos,
const glm::vec2& uv,
const glm::vec4& light,
const glm::vec3& tint
) {
float* buffer = this->buffer.get();
buffer[index++] = pos.x;
@@ -64,8 +67,8 @@ class ModelBatch {
void draw(const model::Mesh& mesh,
const glm::mat4& matrix,
const glm::mat3& rotation,
glm::vec3 tint,
const glm::mat3& rotation,
const glm::vec3& tint,
const texture_names_map* varTextures);
void setTexture(const std::string& name,
const texture_names_map* varTextures);
@@ -84,8 +87,9 @@ public:
ModelBatch(size_t capacity, Assets* assets, Chunks* chunks);
~ModelBatch();
void draw(glm::mat4 matrix,
glm::vec3 tint,
void draw(
const glm::mat4& matrix,
const glm::vec3& tint,
const model::Model* model,
const texture_names_map* varTextures);
void render();