#ifndef BLOCK_SPRITE_HPP_
#define BLOCK_SPRITE_HPP_

#include <VoxelSprite/VoxelSprite.hpp>

/**
 * @brief Represents a block sprite - all layers and animation frames of a specific state.
 */
class BlockSprite
{
public:
    static constexpr int defaultFrameDuration = 125;

    struct Frame
    {
        VoxelSprite colorMap;
        VoxelSprite lightSpecMap;
        VoxelSprite biasMap;
        VoxelSprite refractMap;

        Frame();
    };

    std::vector<Frame> frames;
    VoxelSprite collisionMask;
    int frameDuration = defaultFrameDuration;

    /**
     * @brief Add a new frame and return a reference to it.
     */
    Frame& addFrame();

    /**
     * @brief Returns true if every voxel of every frame is opaque.
     */
    bool isFullyOpaque();

    /**
     * @brief Dump the block sprite to the specified directory.
     */
    void dumpToDir(std::string dirname);

    /**
     * @brief Read frames from the specified asset directory.
     */
    void readFromDir(std::string dirname);
};

#endif