41 lines
1019 B
C++
41 lines
1019 B
C++
#pragma once
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
#include <iostream>
|
|
|
|
#include "Entity.h"
|
|
|
|
#include "PartitionedCube.h"
|
|
|
|
// Colors according to https://ruwix.com/the-rubiks-cube/japanese-western-color-schemes/
|
|
class Cube : public Entity
|
|
{
|
|
private:
|
|
PartitionedCube* _children[3][3][3];
|
|
|
|
void _FindAxisChildren(const glm::ivec3& axis, int index, std::vector<glm::ivec3>& result) const;
|
|
|
|
public:
|
|
Cube();
|
|
virtual ~Cube();
|
|
|
|
const int ChildPartitionsCount = 27;
|
|
PartitionedCube** Children() { return &(_children[0][0][0]); }
|
|
|
|
void TransformData(const glm::ivec3& axis, int index, int turns);
|
|
void TransformAnimation(const glm::ivec3& axis, int index, float angle, 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 UndoTransformTemp();
|
|
|
|
static constexpr Color SideColor[6] = {
|
|
Color::ORANGE(),
|
|
Color::RED(),
|
|
Color::YELLOW(),
|
|
Color::WHITE(),
|
|
Color::GREEN(),
|
|
Color::BLUE()
|
|
};
|
|
};
|