Got the animator fades working
This commit is contained in:
@@ -12,13 +12,13 @@
|
||||
#include "BoardTypes.h"
|
||||
#include "Vector3D.h"
|
||||
|
||||
template <const V3D &BOARD_DIMS>
|
||||
template <const V3D<uint32_t> &BOARD_DIMS>
|
||||
class Board{
|
||||
public:
|
||||
Board() = default;
|
||||
~Board() = default;
|
||||
|
||||
constexpr const V3D &GetSize() const{return BOARD_DIMS;}
|
||||
constexpr const V3D<uint32_t> &GetSize() const{return BOARD_DIMS;}
|
||||
constexpr uint32_t GetNumberCubes() const{return BOARD_DIMS.x * BOARD_DIMS.y * BOARD_DIMS.z;}
|
||||
|
||||
constexpr uint32_t GetMaxDimension(){return std::max(std::max(BOARD_DIMS.x, BOARD_DIMS.y), BOARD_DIMS.z);}
|
||||
@@ -34,7 +34,7 @@ class Board{
|
||||
* @brief fill the entire board with the given color
|
||||
* @param color the color to fill the board with
|
||||
*/
|
||||
void FillColor(const V3D &color);
|
||||
void FillColor(const V3D<uint32_t> &color);
|
||||
|
||||
/**
|
||||
* @brief Set the color of the cube at the given position.
|
||||
@@ -43,7 +43,7 @@ class Board{
|
||||
* @param position the position of the cube.
|
||||
* @param color the color you want the cube to be
|
||||
*/
|
||||
void SetCubeColor(const V3D &position, const V3D &color);
|
||||
void SetCubeColor(const V3D<uint32_t> &position, const V3D<uint32_t> &color);
|
||||
|
||||
/**
|
||||
* @brief Set the occupation status of the cube at a given position
|
||||
@@ -52,7 +52,7 @@ class Board{
|
||||
* @post if the new occupation status of the cube is different than
|
||||
* the old occupation status, this will enable boardStateHasChanged.
|
||||
*/
|
||||
void SetCubeOccupation(const V3D &position, bool occupation);
|
||||
void SetCubeOccupation(const V3D<uint32_t> &position, bool occupation);
|
||||
|
||||
/**
|
||||
* @returns true if the board state has changed since this flag was last set to false
|
||||
@@ -69,18 +69,18 @@ class Board{
|
||||
* @brief Get a column along any axis read into the sliceBuffer
|
||||
* @param column .z specifies the normal direction of the plane (see PLANE_NORMAL), and
|
||||
* the x,y values specify the location of the column in that plane
|
||||
* to fill. IE To fill one stack at 0,2 I would say give V3D(0,2,PLANE_NORMAL::Z)
|
||||
* to fill. IE To fill one stack at 0,2 I would say give V3D<uint32_t>(0,2,PLANE_NORMAL::Z)
|
||||
* @param sliceBuffer an array of pointers to the cubes along that column
|
||||
* @returns the number of elements written into the slice buffer
|
||||
* @note That array is stored locally and will be overwritten everytime this function is called.
|
||||
* Also, any unused spots at the end of the array will be nullptrs
|
||||
* @warning allocate the size of the slice buffer using GetMaxDimension if you don't know what you're doing!
|
||||
*/
|
||||
uint32_t SliceBoard(const V3D &column, BOARD_TYPES::Cube ** sliceBuffer);
|
||||
uint32_t SliceBoard(const V3D<uint32_t> &column, BOARD_TYPES::Cube ** sliceBuffer);
|
||||
|
||||
void PrintEntireBoard() const;
|
||||
|
||||
void UpdateAllColors(const std::array<std::array<std::array<V3D, BOARD_DIMS.z>, BOARD_DIMS.y>, BOARD_DIMS.x>& colorFrame){
|
||||
void UpdateAllColors(const std::array<std::array<std::array<V3D<uint32_t>, BOARD_DIMS.z>, BOARD_DIMS.y>, BOARD_DIMS.x>& colorFrame){
|
||||
for(uint32_t x = 0; x < BOARD_DIMS.x; x++){
|
||||
for(uint32_t y = 0; y < BOARD_DIMS.y; y++){
|
||||
for(uint32_t z = 0; z < BOARD_DIMS.z; z++){
|
||||
@@ -106,7 +106,7 @@ class Board{
|
||||
bool boardStateHasChanged;
|
||||
};
|
||||
|
||||
template <const V3D &BOARD_DIMS>
|
||||
template <const V3D<uint32_t> &BOARD_DIMS>
|
||||
void Board<BOARD_DIMS>::ToStackString(String &stringBuffer) const{
|
||||
std::array<uint32_t, BOARD_DIMS.x * BOARD_DIMS.y> linearizedBoard;
|
||||
for(uint32_t x{0}; x < BOARD_DIMS.x; x++){
|
||||
@@ -126,8 +126,8 @@ void Board<BOARD_DIMS>::ToStackString(String &stringBuffer) const{
|
||||
}
|
||||
}
|
||||
|
||||
template <const V3D &BOARD_DIMS>
|
||||
void Board<BOARD_DIMS>::FillColor(const V3D &color){
|
||||
template <const V3D<uint32_t> &BOARD_DIMS>
|
||||
void Board<BOARD_DIMS>::FillColor(const V3D<uint32_t> &color){
|
||||
for(uint32_t x{0}; x < BOARD_DIMS.x; x++){
|
||||
for(uint32_t y{0}; y < BOARD_DIMS.y; y++){
|
||||
for(uint32_t z{0}; z < BOARD_DIMS.z; z++){
|
||||
@@ -137,23 +137,23 @@ void Board<BOARD_DIMS>::FillColor(const V3D &color){
|
||||
}
|
||||
}
|
||||
|
||||
template <const V3D &BOARD_DIMS>
|
||||
void Board<BOARD_DIMS>::SetCubeColor(const V3D &position, const V3D &color){
|
||||
template <const V3D<uint32_t> &BOARD_DIMS>
|
||||
void Board<BOARD_DIMS>::SetCubeColor(const V3D<uint32_t> &position, const V3D<uint32_t> &color){
|
||||
this->cubes[position.x][position.y][position.z].color = color;
|
||||
}
|
||||
|
||||
template <const V3D &BOARD_DIMS>
|
||||
void Board<BOARD_DIMS>::SetCubeOccupation(const V3D &position, bool occupation){
|
||||
template <const V3D<uint32_t> &BOARD_DIMS>
|
||||
void Board<BOARD_DIMS>::SetCubeOccupation(const V3D<uint32_t> &position, bool occupation){
|
||||
bool oldOccupation{this->cubes[position.x][position.y][position.z].isOccupied};
|
||||
this->cubes[position.x][position.y][position.z].isOccupied = occupation;
|
||||
if(occupation != oldOccupation) this->boardStateHasChanged = true;
|
||||
}
|
||||
|
||||
template <const V3D &BOARD_DIMS>
|
||||
uint32_t Board<BOARD_DIMS>::SliceBoard(const V3D &column, BOARD_TYPES::Cube ** sliceBuffer){
|
||||
template <const V3D<uint32_t> &BOARD_DIMS>
|
||||
uint32_t Board<BOARD_DIMS>::SliceBoard(const V3D<uint32_t> &column, BOARD_TYPES::Cube ** sliceBuffer){
|
||||
uint32_t columnLength{0};
|
||||
V3D indexIncrimentVector{};
|
||||
V3D indexVector{};
|
||||
V3D<uint32_t> indexIncrimentVector{};
|
||||
V3D<uint32_t> indexVector{};
|
||||
|
||||
switch(column.z){
|
||||
case BOARD_TYPES::PLANE_NORMAL::X:
|
||||
@@ -189,7 +189,7 @@ uint32_t Board<BOARD_DIMS>::SliceBoard(const V3D &column, BOARD_TYPES::Cube ** s
|
||||
return columnLength;
|
||||
}
|
||||
|
||||
template <const V3D &BOARD_DIMS>
|
||||
template <const V3D<uint32_t> &BOARD_DIMS>
|
||||
void Board<BOARD_DIMS>::PrintEntireBoard() const{
|
||||
for(uint32_t x = 0; x < BOARD_DIMS.x; x++){
|
||||
for(uint32_t y = 0; y < BOARD_DIMS.y; y++){
|
||||
|
||||
Reference in New Issue
Block a user