mirror of
https://github.com/Relintai/godot_voxel.git
synced 2024-11-19 02:47:18 +01:00
53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
#ifndef VOXEL_LIBRARY_H
|
|
#define VOXEL_LIBRARY_H
|
|
|
|
#include "voxel.h"
|
|
#include <core/resource.h>
|
|
|
|
class VoxelLibrary : public Resource {
|
|
GDCLASS(VoxelLibrary, Resource)
|
|
|
|
public:
|
|
static const unsigned int MAX_VOXEL_TYPES = 256; // Required limit because voxel types are stored in 8 bits
|
|
static const unsigned int ITEMS_PER_PAGE = 256; //TODO fix saving items that are not on the currently active page
|
|
|
|
VoxelLibrary();
|
|
~VoxelLibrary();
|
|
|
|
int get_atlas_size() const { return _atlas_size; }
|
|
void set_atlas_size(int s);
|
|
|
|
Ref<Voxel> create_voxel(int id, String name);
|
|
|
|
void add_voxel(Ref<Voxel> voxel);
|
|
void set_voxel(int id, Ref<Voxel> voxel);
|
|
Ref<Voxel> get_voxel(int id);
|
|
void remove_voxel(int id);
|
|
|
|
int get_voxel_count() const;
|
|
|
|
void load_default();
|
|
|
|
int get_voxel_editor_count();
|
|
void set_voxel_editor_count(int value);
|
|
|
|
int get_voxel_editor_page();
|
|
void set_voxel_editor_page(int value);
|
|
|
|
_FORCE_INLINE_ bool has_voxel(int id) const { return _voxel_types[id].is_valid(); }
|
|
_FORCE_INLINE_ const Voxel &get_voxel_const(int id) const { return **_voxel_types[id]; }
|
|
|
|
protected:
|
|
void _validate_property(PropertyInfo &property) const;
|
|
static void _bind_methods();
|
|
|
|
private:
|
|
int _voxel_editor_count;
|
|
int _voxel_editor_page;
|
|
|
|
Ref<Voxel> _voxel_types[MAX_VOXEL_TYPES];
|
|
int _atlas_size;
|
|
};
|
|
|
|
#endif // VOXEL_LIBRARY_H
|