mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 04:51:49 +00:00
Blocks atlas is auto-assembling now
This commit is contained in:
parent
ea5c117652
commit
fb8d220cca
41 changed files with 622 additions and 75 deletions
44
src/graphics/Atlas.h
Normal file
44
src/graphics/Atlas.h
Normal 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_
|
||||
Loading…
Add table
Add a link
Reference in a new issue