mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-12 10:15:12 +01:00
Bit more work on the bindings.
This commit is contained in:
parent
c4432b4c2b
commit
7075da44eb
@ -32,6 +32,8 @@ void VoxelmanLibrary::set_clutter_material(Ref<Material> mat) {
|
||||
Ref<VoxelSurface> VoxelmanLibrary::get_voxel_surface(int index) const {
|
||||
return Ref<VoxelSurface>();
|
||||
}
|
||||
void VoxelmanLibrary::add_voxel_surface(Ref<VoxelSurface> value) {
|
||||
}
|
||||
void VoxelmanLibrary::set_voxel_surface(int index, Ref<VoxelSurface> value) {
|
||||
}
|
||||
void VoxelmanLibrary::remove_surface(int index) {
|
||||
@ -46,6 +48,8 @@ void VoxelmanLibrary::clear_surfaces() {
|
||||
Ref<VoxelSurface> VoxelmanLibrary::get_liquid_voxel_surface(int index) const {
|
||||
return Ref<VoxelSurface>();
|
||||
}
|
||||
void VoxelmanLibrary::add_liquid_voxel_surface(Ref<VoxelSurface> value) {
|
||||
}
|
||||
void VoxelmanLibrary::set_liquid_voxel_surface(int index, Ref<VoxelSurface> value) {
|
||||
}
|
||||
void VoxelmanLibrary::remove_liquid_surface(int index) {
|
||||
|
@ -27,12 +27,14 @@ public:
|
||||
void set_clutter_material(Ref<Material> mat);
|
||||
|
||||
virtual Ref<VoxelSurface> get_voxel_surface(int index) const;
|
||||
virtual void add_voxel_surface(Ref<VoxelSurface> value);
|
||||
virtual void set_voxel_surface(int index, Ref<VoxelSurface> value);
|
||||
virtual void remove_surface(int index);
|
||||
virtual int get_num_surfaces();
|
||||
virtual void clear_surfaces();
|
||||
|
||||
virtual Ref<VoxelSurface> get_liquid_voxel_surface(int index) const;
|
||||
virtual void add_liquid_voxel_surface(Ref<VoxelSurface> value);
|
||||
virtual void set_liquid_voxel_surface(int index, Ref<VoxelSurface> value);
|
||||
virtual void remove_liquid_surface(int index);
|
||||
virtual int get_liquid_num_surfaces();
|
||||
|
@ -42,6 +42,15 @@ Ref<VoxelSurface> VoxelmanLibraryMerger::get_voxel_surface(int index) const {
|
||||
return _voxel_surfaces[index];
|
||||
}
|
||||
|
||||
void VoxelmanLibraryMerger::add_voxel_surface(Ref<VoxelSurface> value) {
|
||||
ERR_FAIL_COND(!value.is_valid());
|
||||
|
||||
value->set_library(Ref<VoxelmanLibraryMerger>(this));
|
||||
value->set_id(_voxel_surfaces.size());
|
||||
|
||||
_voxel_surfaces.push_back(value);
|
||||
}
|
||||
|
||||
void VoxelmanLibraryMerger::set_voxel_surface(int index, Ref<VoxelSurface> value) {
|
||||
ERR_FAIL_COND(index < 0);
|
||||
|
||||
@ -121,6 +130,15 @@ Ref<VoxelSurface> VoxelmanLibraryMerger::get_liquid_voxel_surface(int index) con
|
||||
return _liquid_surfaces[index];
|
||||
}
|
||||
|
||||
void VoxelmanLibraryMerger::add_liquid_voxel_surface(Ref<VoxelSurface> value) {
|
||||
ERR_FAIL_COND(!value.is_valid());
|
||||
|
||||
value->set_library(Ref<VoxelmanLibraryMerger>(this));
|
||||
value->set_id(_liquid_surfaces.size());
|
||||
|
||||
_liquid_surfaces.push_back(value);
|
||||
}
|
||||
|
||||
void VoxelmanLibraryMerger::set_liquid_voxel_surface(int index, Ref<VoxelSurface> value) {
|
||||
ERR_FAIL_COND(index < 0);
|
||||
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
void set_margin(const int margin);
|
||||
|
||||
Ref<VoxelSurface> get_voxel_surface(int index) const;
|
||||
void add_voxel_surface(Ref<VoxelSurface> value);
|
||||
void set_voxel_surface(int index, Ref<VoxelSurface> value);
|
||||
void remove_surface(int index);
|
||||
int get_num_surfaces();
|
||||
@ -41,6 +42,7 @@ public:
|
||||
void set_voxel_surfaces(const Vector<Variant> &surfaces);
|
||||
|
||||
Ref<VoxelSurface> get_liquid_voxel_surface(int index) const;
|
||||
void add_liquid_voxel_surface(Ref<VoxelSurface> value);
|
||||
void set_liquid_voxel_surface(int index, Ref<VoxelSurface> value);
|
||||
void remove_liquid_surface(int index);
|
||||
int get_liquid_num_surfaces();
|
||||
|
@ -25,6 +25,15 @@ Ref<VoxelSurface> VoxelmanLibrarySimple::get_voxel_surface(int index) const {
|
||||
return _voxel_surfaces[index];
|
||||
}
|
||||
|
||||
void VoxelmanLibrarySimple::add_voxel_surface(Ref<VoxelSurface> value) {
|
||||
ERR_FAIL_COND(!value.is_valid());
|
||||
|
||||
value->set_library(Ref<VoxelmanLibrarySimple>(this));
|
||||
value->set_id(_voxel_surfaces.size());
|
||||
|
||||
_voxel_surfaces.push_back(value);
|
||||
}
|
||||
|
||||
void VoxelmanLibrarySimple::set_voxel_surface(int index, Ref<VoxelSurface> value) {
|
||||
ERR_FAIL_COND(index < 0);
|
||||
|
||||
@ -85,6 +94,15 @@ Ref<VoxelSurface> VoxelmanLibrarySimple::get_liquid_voxel_surface(int index) con
|
||||
return _liquid_surfaces[index];
|
||||
}
|
||||
|
||||
void VoxelmanLibrarySimple::add_liquid_voxel_surface(Ref<VoxelSurface> value) {
|
||||
ERR_FAIL_COND(!value.is_valid());
|
||||
|
||||
value->set_library(Ref<VoxelmanLibrarySimple>(this));
|
||||
value->set_id(_liquid_surfaces.size());
|
||||
|
||||
_liquid_surfaces.push_back(value);
|
||||
}
|
||||
|
||||
void VoxelmanLibrarySimple::set_liquid_voxel_surface(int index, Ref<VoxelSurface> value) {
|
||||
ERR_FAIL_COND(index < 0);
|
||||
|
||||
@ -183,7 +201,6 @@ VoxelmanLibrarySimple::~VoxelmanLibrarySimple() {
|
||||
_liquid_surfaces.clear();
|
||||
}
|
||||
|
||||
|
||||
void VoxelmanLibrarySimple::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_atlas_columns"), &VoxelmanLibrarySimple::get_atlas_columns);
|
||||
ClassDB::bind_method(D_METHOD("set_atlas_columns", "value"), &VoxelmanLibrarySimple::set_atlas_columns);
|
||||
|
@ -23,6 +23,7 @@ public:
|
||||
void set_atlas_rows(int s);
|
||||
|
||||
Ref<VoxelSurface> get_voxel_surface(int index) const;
|
||||
void add_voxel_surface(Ref<VoxelSurface> value);
|
||||
void set_voxel_surface(int index, Ref<VoxelSurface> value);
|
||||
void remove_surface(int index);
|
||||
int get_num_surfaces();
|
||||
@ -32,6 +33,7 @@ public:
|
||||
void set_voxel_surfaces(const Vector<Variant> &surfaces);
|
||||
|
||||
Ref<VoxelSurface> get_liquid_voxel_surface(int index) const;
|
||||
void add_liquid_voxel_surface(Ref<VoxelSurface> value);
|
||||
void set_liquid_voxel_surface(int index, Ref<VoxelSurface> value);
|
||||
void remove_liquid_surface(int index);
|
||||
int get_liquid_num_surfaces();
|
||||
|
@ -115,17 +115,33 @@ void Biome::generate_stack_bind(Node *chunk, int x, int z, bool spawn_mobs) {
|
||||
}
|
||||
|
||||
void Biome::setup() {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup")) {
|
||||
call("_setup");
|
||||
}
|
||||
}
|
||||
|
||||
void Biome::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup_library")) {
|
||||
call("_setup_library", library);
|
||||
}
|
||||
}
|
||||
|
||||
void Biome::_setup_library(Ref<VoxelmanLibrary> library) {
|
||||
for (int i = 0; i < _data->get_voxel_surface_count(); ++i) {
|
||||
Ref<VoxelSurface> s = _data->get_voxel_surface(i);
|
||||
|
||||
if (s.is_valid()) {
|
||||
library->add_voxel_surface(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Biome::Biome() {
|
||||
|
||||
}
|
||||
@ -144,6 +160,8 @@ void Biome::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup"), &Biome::setup);
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &Biome::setup_library);
|
||||
ClassDB::bind_method(D_METHOD("_setup_library", "library"), &Biome::_setup_library);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &Biome::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_stack", "chunk", "x", "z", "spawn_mobs"), &Biome::generate_stack_bind);
|
||||
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
|
||||
void setup();
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
Biome();
|
||||
~Biome();
|
||||
|
@ -200,17 +200,33 @@ int Dungeon::get_entity_data_count() const {
|
||||
}
|
||||
|
||||
void Dungeon::setup() {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup")) {
|
||||
call("_setup");
|
||||
}
|
||||
}
|
||||
|
||||
void Dungeon::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup_library")) {
|
||||
call("_setup_library", library);
|
||||
}
|
||||
}
|
||||
|
||||
void Dungeon::_setup_library(Ref<VoxelmanLibrary> library) {
|
||||
for (int i = 0; i < _data->get_voxel_surface_count(); ++i) {
|
||||
Ref<VoxelSurface> s = _data->get_voxel_surface(i);
|
||||
|
||||
if (s.is_valid()) {
|
||||
library->add_voxel_surface(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Dungeon::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
|
||||
@ -264,6 +280,8 @@ void Dungeon::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup"), &Dungeon::setup);
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &Dungeon::setup_library);
|
||||
ClassDB::bind_method(D_METHOD("_setup_library", "library"), &Dungeon::_setup_library);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &Dungeon::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_structure", "structure", "spawn_mobs"), &Dungeon::generate_structure);
|
||||
|
||||
|
@ -95,6 +95,8 @@ public:
|
||||
|
||||
void setup();
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
void generate_chunk_bind(Node *chunk, bool spawn_mobs);
|
||||
void generate_structure(Ref<VoxelStructure> structure, bool spawn_mobs);
|
||||
|
@ -128,17 +128,33 @@ int DungeonRoom::get_entity_data_count() const {
|
||||
}
|
||||
|
||||
void DungeonRoom::setup() {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup")) {
|
||||
call("_setup");
|
||||
}
|
||||
}
|
||||
|
||||
void DungeonRoom::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup_library")) {
|
||||
call("_setup_library", library);
|
||||
}
|
||||
}
|
||||
|
||||
void DungeonRoom::_setup_library(Ref<VoxelmanLibrary> library) {
|
||||
for (int i = 0; i < _data->get_voxel_surface_count(); ++i) {
|
||||
Ref<VoxelSurface> s = _data->get_voxel_surface(i);
|
||||
|
||||
if (s.is_valid()) {
|
||||
library->add_voxel_surface(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DungeonRoom::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
|
||||
@ -182,6 +198,8 @@ void DungeonRoom::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup"), &DungeonRoom::setup);
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &DungeonRoom::setup_library);
|
||||
ClassDB::bind_method(D_METHOD("_setup_library", "library"), &DungeonRoom::_setup_library);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &DungeonRoom::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_room", "structure", "spawn_mobs"), &DungeonRoom::generate_room);
|
||||
|
||||
|
@ -72,6 +72,8 @@ public:
|
||||
|
||||
void setup();
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
void generate_chunk_bind(Node *chunk, bool spawn_mobs);
|
||||
void generate_room(Ref<VoxelStructure> structure, bool spawn_mobs);
|
||||
|
@ -77,17 +77,33 @@ int Planet::get_dungeon_count() const {
|
||||
}
|
||||
|
||||
void Planet::setup() {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup")) {
|
||||
call("_setup");
|
||||
}
|
||||
}
|
||||
|
||||
void Planet::setup_library(Ref<VoxelmanLibrary> library) {
|
||||
if (!_data.is_valid())
|
||||
return;
|
||||
|
||||
if (has_method("_setup_library")) {
|
||||
call("_setup_library", library);
|
||||
}
|
||||
}
|
||||
|
||||
void Planet::_setup_library(Ref<VoxelmanLibrary> library) {
|
||||
for (int i = 0; i < _data->get_voxel_surface_count(); ++i) {
|
||||
Ref<VoxelSurface> s = _data->get_voxel_surface(i);
|
||||
|
||||
if (s.is_valid()) {
|
||||
library->add_voxel_surface(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Planet::generate_chunk(VoxelChunk *chunk, bool spawn_mobs) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
|
||||
|
||||
@ -123,6 +139,7 @@ void Planet::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Planet::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("setup"), &Planet::setup);
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &Planet::setup_library);
|
||||
ClassDB::bind_method(D_METHOD("_setup_library", "library"), &Planet::_setup_library);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_seed"), &Planet::get_seed);
|
||||
ClassDB::bind_method(D_METHOD("set_seed", "value"), &Planet::set_seed);
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
|
||||
void setup();
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
void generate_chunk_bind(Node *chunk, bool spawn_mobs);
|
||||
Ref<Image> generate_map();
|
||||
|
Loading…
Reference in New Issue
Block a user