Revert "fix: optimization: Various PVS-Studio warnings"
This commit is contained in:
@@ -186,7 +186,7 @@ void Entities::loadEntity(const dynamic::Map_sptr& map) {
|
||||
spawn(def, {}, nullptr, map, uid);
|
||||
}
|
||||
|
||||
void Entities::loadEntity(const dynamic::Map_sptr& map, const Entity &entity) {
|
||||
void Entities::loadEntity(const dynamic::Map_sptr& map, Entity entity) {
|
||||
auto& transform = entity.getTransform();
|
||||
auto& body = entity.getRigidbody();
|
||||
auto& skeleton = entity.getSkeleton();
|
||||
@@ -228,7 +228,7 @@ void Entities::loadEntity(const dynamic::Map_sptr& map, const Entity &entity) {
|
||||
}
|
||||
|
||||
std::optional<Entities::RaycastResult> Entities::rayCast(
|
||||
const glm::vec3 &start, const glm::vec3 &dir, float maxDistance, entityid_t ignore
|
||||
glm::vec3 start, glm::vec3 dir, float maxDistance, entityid_t ignore
|
||||
) {
|
||||
Ray ray(start, dir);
|
||||
auto view = registry.view<EntityId, Transform, Rigidbody>();
|
||||
@@ -547,7 +547,7 @@ bool Entities::hasBlockingInside(AABB aabb) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<Entity> Entities::getAllInside(const AABB &aabb) {
|
||||
std::vector<Entity> Entities::getAllInside(AABB aabb) {
|
||||
std::vector<Entity> collected;
|
||||
auto view = registry.view<Transform>();
|
||||
for (auto [entity, transform] : view.each()) {
|
||||
@@ -564,7 +564,7 @@ std::vector<Entity> Entities::getAllInside(const AABB &aabb) {
|
||||
return collected;
|
||||
}
|
||||
|
||||
std::vector<Entity> Entities::getAllInRadius(const glm::vec3 ¢er, float radius) {
|
||||
std::vector<Entity> Entities::getAllInRadius(glm::vec3 center, float radius) {
|
||||
std::vector<Entity> collected;
|
||||
auto view = registry.view<Transform>();
|
||||
for (auto [entity, transform] : view.each()) {
|
||||
|
||||
@@ -49,19 +49,19 @@ struct Transform {
|
||||
|
||||
void refresh();
|
||||
|
||||
inline void setRot(const glm::mat3 &m) {
|
||||
inline void setRot(glm::mat3 m) {
|
||||
rot = m;
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
inline void setSize(const glm::vec3 &v) {
|
||||
inline void setSize(glm::vec3 v) {
|
||||
if (glm::distance2(displaySize, v) >= 0.00001f) {
|
||||
dirty = true;
|
||||
}
|
||||
size = v;
|
||||
}
|
||||
|
||||
inline void setPos(const glm::vec3 &v) {
|
||||
inline void setPos(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(
|
||||
const glm::vec3 &start, const glm::vec3 &dir, float maxDistance, entityid_t ignore=-1);
|
||||
glm::vec3 start, 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, const Entity &entity);
|
||||
void loadEntity(const dynamic::Map_sptr& map, Entity entity);
|
||||
void onSave(const Entity& entity);
|
||||
bool hasBlockingInside(AABB aabb);
|
||||
std::vector<Entity> getAllInside(const AABB &aabb);
|
||||
std::vector<Entity> getAllInRadius(const glm::vec3 ¢er, float radius);
|
||||
std::vector<Entity> getAllInside(AABB aabb);
|
||||
std::vector<Entity> getAllInRadius(glm::vec3 center, float radius);
|
||||
void despawn(entityid_t id);
|
||||
dynamic::Value serialize(const Entity& entity);
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ void Player::postUpdate() {
|
||||
glm::mat4(1.0f), glm::radians(cam.y), glm::vec3(1, 0, 0));
|
||||
}
|
||||
|
||||
void Player::teleport(const glm::vec3 &position) {
|
||||
void Player::teleport(glm::vec3 position) {
|
||||
this->position = position;
|
||||
if (auto hitbox = getHitbox()) {
|
||||
hitbox->position = position;
|
||||
@@ -239,7 +239,7 @@ std::shared_ptr<Inventory> Player::getInventory() const {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
void Player::setSpawnPoint(const glm::vec3 &spawnpoint) {
|
||||
void Player::setSpawnPoint(glm::vec3 spawnpoint) {
|
||||
this->spawnpoint = spawnpoint;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
std::shared_ptr<Inventory> inv, entityid_t eid);
|
||||
~Player();
|
||||
|
||||
void teleport(const glm::vec3 &position);
|
||||
void teleport(glm::vec3 position);
|
||||
void updateEntity();
|
||||
void updateInput(PlayerInput& input, float delta);
|
||||
void updateSelectedEntity();
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
|
||||
Hitbox* getHitbox();
|
||||
|
||||
void setSpawnPoint(const glm::vec3 &spawnpoint);
|
||||
void setSpawnPoint(glm::vec3 point);
|
||||
glm::vec3 getSpawnPoint() const;
|
||||
|
||||
std::unique_ptr<dynamic::Map> serialize() const override;
|
||||
|
||||
@@ -68,8 +68,8 @@ SkeletonConfig::SkeletonConfig(const std::string& name, std::unique_ptr<Bone> ro
|
||||
size_t SkeletonConfig::update(
|
||||
size_t index,
|
||||
Skeleton& skeleton,
|
||||
Bone* node,
|
||||
const glm::mat4& matrix) const
|
||||
Bone* node,
|
||||
glm::mat4 matrix) const
|
||||
{
|
||||
auto boneMatrix = skeleton.pose.matrices[index];
|
||||
auto boneOffset = node->getOffset();
|
||||
@@ -85,7 +85,7 @@ size_t SkeletonConfig::update(
|
||||
return count;
|
||||
}
|
||||
|
||||
void SkeletonConfig::update(Skeleton& skeleton, const glm::mat4& matrix) const {
|
||||
void SkeletonConfig::update(Skeleton& skeleton, glm::mat4 matrix) const {
|
||||
update(0, skeleton, root.get(), matrix);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,12 +103,12 @@ namespace rigging {
|
||||
size_t index,
|
||||
Skeleton& skeleton,
|
||||
Bone* node,
|
||||
const glm::mat4& matrix) const;
|
||||
glm::mat4 matrix) const;
|
||||
public:
|
||||
SkeletonConfig(const std::string& name, std::unique_ptr<Bone> root,
|
||||
size_t nodesCount);
|
||||
|
||||
void update(Skeleton& skeleton, const glm::mat4& matrix) const;
|
||||
void update(Skeleton& skeleton, glm::mat4 matrix) const;
|
||||
void render(
|
||||
Assets* assets,
|
||||
ModelBatch& batch,
|
||||
|
||||
Reference in New Issue
Block a user