texture_packer/merge_texture.h

48 lines
959 B
C
Raw Normal View History

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"
#include "core/ustring.h"
#include "core/vector.h"
2019-10-21 18:33:12 +02:00
#include "scene/resources/texture.h"
#include <vector>
#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();
void merge();
String test();
2019-10-20 21:19:00 +02:00
MergeTexture();
~MergeTexture();
protected:
static void _bind_methods();
private:
2019-10-21 12:18:31 +02:00
bool _keep_original_atlases;
2019-10-21 18:33:12 +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