Blocks atlas is auto-assembling now

This commit is contained in:
MihailRis
2023-11-22 01:53:48 +03:00
parent ea5c117652
commit fb8d220cca
41 changed files with 622 additions and 75 deletions
+44
View File
@@ -0,0 +1,44 @@
#ifndef GRAPHICS_ATLAS_H_
#define GRAPHICS_ATLAS_H_
#include <string>
#include <memory>
#include <vector>
#include <unordered_map>
#include "UVRegion.h"
#include "../typedefs.h"
class ImageData;
class Texture;
class Atlas {
Texture* texture;
ImageData* image;
std::unordered_map<std::string, UVRegion> regions;
public:
Atlas(ImageData* image, std::unordered_map<std::string, UVRegion> regions);
~Atlas();
bool has(std::string name) const;
const UVRegion& get(std::string name) const;
Texture* getTexture() const;
ImageData* getImage() const;
};
struct atlasentry {
std::string name;
std::shared_ptr<ImageData> image;
};
class AtlasBuilder {
std::vector<atlasentry> entries;
public:
AtlasBuilder() {}
void add(std::string name, ImageData* image);
Atlas* build(uint extrusion);
};
#endif // GRAPHICS_ATLAS_H_