#pragma once

#include "../world/position.h"

/// Math utils
namespace geometry {
    enum class Face {
        Right, Left, Up, Down, Forward, Backward
    };
    const chunk_pos g_face_offsets[6] = {
        chunk_pos(1,0,0), chunk_pos(-1,0,0),
        chunk_pos(0,1,0), chunk_pos(0,-1,0),
        chunk_pos(0,0,1), chunk_pos(0,0,-1),
    };

    enum class Faces {
        None = 0,
        Right = 1,
        Left = 2,
        Up = 4,
        Down = 8,
        Forward = 16,
        Backward = 32,
        All = 63
    };
    inline Faces operator|(Faces a, Faces b) {
        return static_cast<Faces>(static_cast<int>(a) | static_cast<int>(b));
    }
    inline Faces operator&(Faces a, Faces b) {
        return static_cast<Faces>(static_cast<int>(a) & static_cast<int>(b));
    }
    inline Faces operator&(bool a, Faces b) {
        return (a ? Faces::All : Faces::None) & b;
    }
    inline bool operator&&(Faces a, Faces b) {
        return static_cast<int>(a) & static_cast<int>(b);
    }
}
