#pragma once

#include "object.h"
#include "mesh.h"
#include "physics.h"

#include <BulletCollision/CollisionShapes/btCollisionShape.h>

namespace kek {

class GameObject: public RotateableObject {

protected:
	std::vector<Mesh *> meshes;

public:
	PhysicsObjectData *physics;

	GameObject();

	virtual ~GameObject();

	// Adds a mesh to the GameObject. The GameObject takes ownership of the Mesh, so don't use Meshes in multiple GameObjects
	void addMesh(Mesh *mesh);

	void draw(Shader *shader);

	void addPhysics(btCollisionShape *shape, float mass, int collisionFlags = 0);

	virtual void rotate(float angle, glm::vec3 axis) { rotateTo(glm::rotate(getRotation(), angle, axis)); };

	virtual void rotateTo(glm::quat rotation);

	virtual void lookAt(glm::vec3 direction) { rotateTo(glm::quatLookAt(glm::normalize(direction), glm::vec3(0,1,0))); };

	virtual glm::quat getRotation();

	virtual void translate(glm::vec3 delta) { moveTo(getPosition() + delta); };

	virtual void moveTo(glm::vec3 position);

	virtual glm::vec3 getPosition();

};

}
