#include "object.h" namespace kek { void Object::translateX(float delta) { translate(glm::vec3(delta, 0, 0)); } void Object::translateY(float delta) { translate(glm::vec3(0, delta, 0)); } void Object::translateZ(float delta) { translate(glm::vec3(0, 0, delta)); } DefaultObject::DefaultObject() { this->position = glm::vec3(0.0f, 0.0f, 0.0f); } void DefaultObject::translate(glm::vec3 delta) { position += delta; } void DefaultObject::moveTo(glm::vec3 position) { //this->position = glm::vec3(position.x, position.y, position.z); this->position.x = position.x; this->position.y = position.y; this->position.z = position.z; } glm::vec3 DefaultObject::getPosition() { return this->position; } void RotateableObject::lookAtPos(glm::vec3 position) { lookAt(position - this->getPosition()); } DefaultRotateableObject::DefaultRotateableObject() { this->rotation = glm::quat(0.0f, 0.0f, 1.0f, 0.0f); } void DefaultRotateableObject::rotate(float angle, glm::vec3 axis) { this->rotation = glm::rotate(rotation, glm::radians(angle), axis); } void DefaultRotateableObject::lookAt(glm::vec3 direction) { this->rotation = glm::quatLookAt(glm::normalize(direction), glm::vec3(0.0f, 1.0f, 0.0f)); } glm::quat DefaultRotateableObject::getRotation() { return this->rotation; } }