From 5a1ab063b76038d9a355a89514d2c9b5e197020b Mon Sep 17 00:00:00 2001 From: Faerbit Date: Sat, 25 Apr 2015 23:27:12 +0200 Subject: [PATCH] Removing last mutex. --- game/entity.cc | 35 ----------------------------------- game/entity.hh | 5 ----- 2 files changed, 40 deletions(-) diff --git a/game/entity.cc b/game/entity.cc index 72d759e..20a92d8 100644 --- a/game/entity.cc +++ b/game/entity.cc @@ -10,36 +10,6 @@ Entity::Entity(glm::vec3 position, glm::mat4 rotation) { this->rotation = rotation; } -Entity::Entity(const Entity &other) { - std::lock_guard lock(other.mutex); - position = other.position; - rotation = other.rotation; -} - -Entity::Entity(Entity &&other) { - std::lock_guard lock(other.mutex); - position = std::move(other.position); - rotation = std::move(other.rotation); -} - -Entity& Entity::operator= (const Entity &other) { - std::lock(mutex, other.mutex); - std::lock_guard self_lock(mutex, std::adopt_lock); - std::lock_guard other_lock(other.mutex, std::adopt_lock); - position = other.position; - rotation = other.rotation; - return *this; -} - -Entity& Entity::operator= (Entity &&other) { - std::lock(mutex, other.mutex); - std::lock_guard self_lock(mutex, std::adopt_lock); - std::lock_guard other_lock(other.mutex, std::adopt_lock); - position = std::move(other.position); - rotation = std::move(other.rotation); - return *this; -} - Entity::Entity(){ } @@ -47,28 +17,23 @@ Entity::~Entity(){ } glm::vec3 Entity::getPosition() { - std::lock_guard lock(mutex); return position; } glm::mat4 Entity::getRotation() { - std::lock_guard lock(mutex); return rotation; } void Entity::setPosition(glm::vec3 position) { - std::lock_guard lock(mutex); this->position = position; } void Entity::setRotation(glm::vec3 rotation) { - std::lock_guard lock(mutex); this->rotation = glm::rotate(rotation.x, glm::vec3(1.0f, 0.0f, 0.0f)) * glm::rotate(rotation.y, glm::vec3(0.0f, 1.0f, 0.0f)) * glm::rotate(rotation.z, glm::vec3(0.0f, 0.0f, 1.0f)); } void Entity::setRotation(glm::mat4 rotation) { - std::lock_guard lock(mutex); this->rotation = rotation; } diff --git a/game/entity.hh b/game/entity.hh index 6d99231..60b9a05 100644 --- a/game/entity.hh +++ b/game/entity.hh @@ -8,10 +8,6 @@ class Entity { public: Entity(glm::vec3 position, glm::vec3 rotation); Entity(glm::vec3 position, glm::mat4 rotation); - Entity(const Entity &other); - Entity(Entity &&other); - Entity& operator= (const Entity& other); - Entity& operator= (Entity &&other); Entity(); ~Entity(); void setPosition(glm::vec3 positon); @@ -22,7 +18,6 @@ class Entity { private: glm::vec3 position; glm::mat4 rotation; - mutable std::mutex mutex; }; #endif