2019-10-20 21:19:00 +02:00
|
|
|
#ifndef MERGE_TEXTURE_H
|
|
|
|
#define MERGE_TEXTURE_H
|
|
|
|
|
2019-10-21 18:33:12 +02:00
|
|
|
#include "core/image.h"
|
|
|
|
#include "core/reference.h"
|
2019-10-20 21:46:36 +02:00
|
|
|
#include "core/ustring.h"
|
2019-10-21 00:06:09 +02:00
|
|
|
#include "core/vector.h"
|
2019-10-21 18:33:12 +02:00
|
|
|
#include "scene/resources/texture.h"
|
|
|
|
#include <vector>
|
2019-10-20 21:46:36 +02:00
|
|
|
|
|
|
|
#include "rectpack2D/pack.h"
|
2019-10-20 21:19:00 +02:00
|
|
|
|
2019-10-21 18:33:12 +02:00
|
|
|
//Rename to TexturePacker
|
|
|
|
class MergeTexture : public Reference {
|
|
|
|
GDCLASS(MergeTexture, Reference);
|
2019-10-20 21:19:00 +02:00
|
|
|
|
|
|
|
public:
|
2019-10-21 18:33:12 +02:00
|
|
|
Ref<AtlasTexture> add_texture(Ref<Texture> texture);
|
|
|
|
Ref<AtlasTexture> get_texture(int index);
|
|
|
|
Ref<Texture> get_original_texture(int index);
|
|
|
|
void remove_texture_index(int index);
|
|
|
|
void remove_texture(Ref<Texture> texture);
|
2019-10-21 12:18:31 +02:00
|
|
|
int get_texture_count();
|
2019-10-21 18:33:12 +02:00
|
|
|
|
2019-10-21 20:57:39 +02:00
|
|
|
Ref<ImageTexture> get_generated_texture(int index);
|
|
|
|
int get_generated_texture_count();
|
|
|
|
|
2019-10-21 00:06:09 +02:00
|
|
|
void merge();
|
|
|
|
|
2019-10-20 22:13:45 +02:00
|
|
|
String test();
|
2019-10-20 21:19:00 +02:00
|
|
|
|
|
|
|
MergeTexture();
|
|
|
|
~MergeTexture();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
2019-10-21 00:06:09 +02:00
|
|
|
|
|
|
|
private:
|
2019-10-21 12:18:31 +02:00
|
|
|
bool _keep_original_atlases;
|
2019-10-21 18:33:12 +02:00
|
|
|
|
2019-10-21 00:06:09 +02:00
|
|
|
std::vector<bin> _bins;
|
2019-10-21 18:33:12 +02:00
|
|
|
|
|
|
|
Vector<rect_xywhf *> _rects;
|
|
|
|
Vector<Ref<ImageTexture> > _generated_textures;
|
2019-10-20 21:19:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|