mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 14:01:49 +00:00
src/graphics moved to src/graphics/core
This commit is contained in:
parent
ba762584a7
commit
b56408a202
63 changed files with 156 additions and 147 deletions
48
src/graphics/core/Atlas.h
Normal file
48
src/graphics/core/Atlas.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#ifndef GRAPHICS_CORE_ATLAS_H_
|
||||
#define GRAPHICS_CORE_ATLAS_H_
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include "UVRegion.h"
|
||||
#include "../../typedefs.h"
|
||||
|
||||
class ImageData;
|
||||
class Texture;
|
||||
|
||||
class Atlas {
|
||||
std::unique_ptr<Texture> texture;
|
||||
std::unique_ptr<ImageData> image;
|
||||
std::unordered_map<std::string, UVRegion> regions;
|
||||
public:
|
||||
Atlas(ImageData* image, std::unordered_map<std::string, UVRegion> regions);
|
||||
~Atlas();
|
||||
|
||||
bool has(const std::string& name) const;
|
||||
const UVRegion& get(const 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;
|
||||
std::set<std::string> names;
|
||||
public:
|
||||
AtlasBuilder() {}
|
||||
void add(std::string name, ImageData* image);
|
||||
bool has(const std::string& name) const;
|
||||
const std::set<std::string>& getNames() { return names; };
|
||||
|
||||
Atlas* build(uint extrusion, uint maxResolution=8192);
|
||||
};
|
||||
|
||||
#endif // GRAPHICS_CORE_ATLAS_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue