Removing last mutex.
This commit is contained in:
parent
a173e1b9eb
commit
5a1ab063b7
@ -10,36 +10,6 @@ Entity::Entity(glm::vec3 position, glm::mat4 rotation) {
|
||||
this->rotation = rotation;
|
||||
}
|
||||
|
||||
Entity::Entity(const Entity &other) {
|
||||
std::lock_guard<std::mutex> lock(other.mutex);
|
||||
position = other.position;
|
||||
rotation = other.rotation;
|
||||
}
|
||||
|
||||
Entity::Entity(Entity &&other) {
|
||||
std::lock_guard<std::mutex> 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<std::mutex> self_lock(mutex, std::adopt_lock);
|
||||
std::lock_guard<std::mutex> 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<std::mutex> self_lock(mutex, std::adopt_lock);
|
||||
std::lock_guard<std::mutex> 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<std::mutex> lock(mutex);
|
||||
return position;
|
||||
}
|
||||
|
||||
glm::mat4 Entity::getRotation() {
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
return rotation;
|
||||
}
|
||||
|
||||
void Entity::setPosition(glm::vec3 position) {
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
this->position = position;
|
||||
}
|
||||
|
||||
void Entity::setRotation(glm::vec3 rotation) {
|
||||
std::lock_guard<std::mutex> 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<std::mutex> lock(mutex);
|
||||
this->rotation = rotation;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user