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
|
|
@ -49,19 +49,19 @@ struct Transform {
|
|||
|
||||
void refresh();
|
||||
|
||||
inline void setRot(glm::mat3 m) {
|
||||
inline void setRot(const glm::mat3 &m) {
|
||||
rot = m;
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
inline void setSize(glm::vec3 v) {
|
||||
inline void setSize(const glm::vec3 &v) {
|
||||
if (glm::distance2(displaySize, v) >= 0.00001f) {
|
||||
dirty = true;
|
||||
}
|
||||
size = v;
|
||||
}
|
||||
|
||||
inline void setPos(glm::vec3 v) {
|
||||
inline void setPos(const glm::vec3 &v) {
|
||||
if (glm::distance2(displayPos, v) >= 0.0001f) {
|
||||
dirty = true;
|
||||
}
|
||||
|
|
@ -212,15 +212,15 @@ public:
|
|||
/// @param ignore Ignored entity ID
|
||||
/// @return An optional structure containing entity, normal and distance
|
||||
std::optional<RaycastResult> rayCast(
|
||||
glm::vec3 start, glm::vec3 dir, float maxDistance, entityid_t ignore=-1);
|
||||
const glm::vec3 &start, const glm::vec3 &dir, float maxDistance, entityid_t ignore=-1);
|
||||
|
||||
void loadEntities(dynamic::Map_sptr map);
|
||||
void loadEntity(const dynamic::Map_sptr& map);
|
||||
void loadEntity(const dynamic::Map_sptr& map, Entity entity);
|
||||
void loadEntity(const dynamic::Map_sptr& map, const Entity &entity);
|
||||
void onSave(const Entity& entity);
|
||||
bool hasBlockingInside(AABB aabb);
|
||||
std::vector<Entity> getAllInside(AABB aabb);
|
||||
std::vector<Entity> getAllInRadius(glm::vec3 center, float radius);
|
||||
std::vector<Entity> getAllInside(const AABB &aabb);
|
||||
std::vector<Entity> getAllInRadius(const glm::vec3 ¢er, float radius);
|
||||
void despawn(entityid_t id);
|
||||
dynamic::Value serialize(const Entity& entity);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue