#pragma once

#ifndef CUBE_H
#define CUBE_H

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>

class Cube
{
private:
	glm::vec3 Position;
	glm::vec3 scale;
	glm::vec3 rotation;
	glm::vec3 color;

	//const float CUBE_COLORS[24]{
	//	1.0f, 0.0f, 0.0f,
	//	0.0f, 1.0f, 0.0f,
	//	0.0f, 0.0f, 1.0f,
	//	1.0f, 1.0f, 0.0f,
	//	0.0f, 1.0f, 1.0f,
	//	1.0f, 0.0f, 1.0f,
	//	1.0f, 1.0f, 1.0f,
	//	0.0f, 0.0f, 0.0f
	//};

public:

	Cube(glm::vec3 position, glm::vec3 scale, glm::vec3 rotation, glm::vec3 color)
	{
		this->Position = position;
		this->scale = scale;
		this->rotation = rotation;
		this->color = color;
	}

	//void draw(unsigned int& modelLoc, unsigned int& VAO)
	//{
	//	glBindVertexArray(VAO);
	//	glm::mat4 model = getModelMatrix();
	//	glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));
	//	glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_INT, 0); // 36 indices for the cube
	//	glBindVertexArray(0);
	//}

	glm::mat4 getModelMatrix() const
	{
		glm::mat4 model = glm::mat4(1.0f);
		model = glm::translate(model, Position);
		model = glm::rotate(model, glm::radians(rotation.x), glm::vec3(1, 0, 0));
		model = glm::rotate(model, glm::radians(rotation.y), glm::vec3(0, 1, 0));
		model = glm::rotate(model, glm::radians(rotation.z), glm::vec3(0, 0, 1));
		model = glm::scale(model, scale);

		return model;
	}

	void setPosition(glm::vec3 position)
	{
		this->Position = position;
	}

	void setScale(glm::vec3 scale)
	{
		this->scale = scale;
	}

	void setRotation(glm::vec3 rotation)
	{
		this->rotation = rotation;
	}

	void setColor(glm::vec3 color)
	{
		this->color = color;
	}

	glm::vec3 getPosition() const
	{
		return Position;
	}

	glm::vec3 getScale() const
	{
		return scale;
	}

	glm::vec3 getRotation() const
	{
		return rotation;
	}

	glm::vec3 getColor() const
	{
		return color;
	}
};
#endif