44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <glm.hpp>
|
|
|
|
#include "PartitionedCube.h"
|
|
|
|
// Colors according to https://ruwix.com/the-rubiks-cube/japanese-western-color-schemes/
|
|
class Cube
|
|
{
|
|
private:
|
|
glm::mat4 _transform;
|
|
|
|
PartitionedCube* _children[3][3][3];
|
|
|
|
void _TransformData(const glm::ivec3& axis, int index, const glm::mat3& transform);
|
|
|
|
void _FindAxisChildren(const glm::ivec3& axis, int index, std::vector<glm::ivec3>& result) const;
|
|
|
|
public:
|
|
Cube();
|
|
~Cube();
|
|
|
|
void Update(double deltaTime);
|
|
|
|
const int ChildPartitionsCount = 27;
|
|
PartitionedCube** Children() { return &(_children[0][0][0]); }
|
|
|
|
const glm::mat4& Transform() const { return _transform; }
|
|
|
|
void TransformAnimation(const glm::ivec3& axis, int index, const glm::mat3& transform, float duration);
|
|
void Transform(const glm::ivec3& axis, int index, const glm::mat3& transform);
|
|
void TransformTemp(const glm::ivec3& axis, int index, const glm::mat3& transform);
|
|
void Transform(glm::mat4 transform);
|
|
|
|
static constexpr Color SideColor[6] = {
|
|
Color::ORANGE(),
|
|
Color::RED(),
|
|
Color::YELLOW(),
|
|
Color::WHITE(),
|
|
Color::GREEN(),
|
|
Color::BLUE()
|
|
};
|
|
};
|