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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user