mirror of
https://github.com/Relintai/world_generator.git
synced 2024-11-12 10:15:07 +01:00
Simple skeleton bingings.
This commit is contained in:
parent
2b71488e6f
commit
16ae08568a
12
SCsub
12
SCsub
@ -2,3 +2,15 @@ Import('env')
|
||||
|
||||
env.add_source_files(env.modules_sources,"register_types.cpp")
|
||||
|
||||
env.add_source_files(env.modules_sources,"main/dungeon_room.cpp")
|
||||
env.add_source_files(env.modules_sources,"main/dungeon.cpp")
|
||||
env.add_source_files(env.modules_sources,"main/biome.cpp")
|
||||
env.add_source_files(env.modules_sources,"main/planet.cpp")
|
||||
|
||||
env.add_source_files(env.modules_sources,"data/dungeon_room_data.cpp")
|
||||
env.add_source_files(env.modules_sources,"data/dungeon_data.cpp")
|
||||
env.add_source_files(env.modules_sources,"data/biome_data.cpp")
|
||||
env.add_source_files(env.modules_sources,"data/planet_data.cpp")
|
||||
|
||||
env.add_source_files(env.modules_sources,"world_generator.cpp")
|
||||
|
||||
|
@ -1,21 +1,22 @@
|
||||
#include "voxelman_prop_entry.h"
|
||||
#include "biome_data.h"
|
||||
|
||||
Transform VoxelmanPropEntry::get_transform() const {
|
||||
return _transform;
|
||||
}
|
||||
void VoxelmanPropEntry::set_transform(const Transform value) {
|
||||
_transform = value;
|
||||
Ref<Biome> BiomeData::setup_biome(int seed) {
|
||||
if (has_method("_setup_biome")) {
|
||||
return call("_setup_biome", seed);
|
||||
}
|
||||
|
||||
VoxelmanPropEntry::VoxelmanPropEntry() {
|
||||
return Ref<Biome>(NULL);
|
||||
}
|
||||
|
||||
BiomeData::BiomeData() {
|
||||
|
||||
}
|
||||
VoxelmanPropEntry::~VoxelmanPropEntry() {
|
||||
BiomeData::~BiomeData() {
|
||||
|
||||
}
|
||||
|
||||
void VoxelmanPropEntry::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform);
|
||||
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
|
||||
void BiomeData::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "room", PROPERTY_HINT_RESOURCE_TYPE, "Biome"), "_setup_biome", PropertyInfo(Variant::INT, "seed")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup_biome", "seed"), &BiomeData::setup_biome);
|
||||
}
|
||||
|
@ -1,28 +1,29 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
#ifndef BIOME_DATA_H
|
||||
#define BIOME_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
#include "../main/biome.h"
|
||||
|
||||
class BiomeData : public Resource {
|
||||
GDCLASS(BiomeData, Resource);
|
||||
|
||||
public:
|
||||
|
||||
Ref<Biome> setup_biome();
|
||||
Ref<Biome> setup_biome(int seed);
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
BiomeData();
|
||||
~BiomeData();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector2 _humidity_range;
|
||||
Vector2 _temperature_range;
|
||||
Vector<DungeonData> _dungeon_datas;
|
||||
Vector<Ref<VoxelmanProp> > _props;
|
||||
//Vector2 _humidity_range;
|
||||
//Vector2 _temperature_range;
|
||||
//Vector<DungeonData> _dungeon_datas;
|
||||
//Vector<Ref<VoxelmanProp> > _props;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,21 +1,22 @@
|
||||
#include "voxelman_prop_entry.h"
|
||||
#include "dungeon_data.h"
|
||||
|
||||
Transform VoxelmanPropEntry::get_transform() const {
|
||||
return _transform;
|
||||
}
|
||||
void VoxelmanPropEntry::set_transform(const Transform value) {
|
||||
_transform = value;
|
||||
Ref<Dungeon> DungeonData::setup_dungeon(int seed) {
|
||||
if (has_method("_setup_dungeon")) {
|
||||
return call("_setup_dungeon", seed);
|
||||
}
|
||||
|
||||
VoxelmanPropEntry::VoxelmanPropEntry() {
|
||||
return Ref<Dungeon>(NULL);
|
||||
}
|
||||
|
||||
DungeonData::DungeonData() {
|
||||
|
||||
}
|
||||
VoxelmanPropEntry::~VoxelmanPropEntry() {
|
||||
DungeonData::~DungeonData() {
|
||||
|
||||
}
|
||||
|
||||
void VoxelmanPropEntry::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform);
|
||||
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
|
||||
void DungeonData::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "room", PROPERTY_HINT_RESOURCE_TYPE, "Dungeon"), "_setup_dungeon", PropertyInfo(Variant::INT, "seed")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup_dungeon", "seed"), &DungeonData::setup_dungeon);
|
||||
}
|
||||
|
@ -1,25 +1,24 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
#ifndef DUNGEON_DATA_H
|
||||
#define DUNGEON_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
#include "../main/dungeon.h"
|
||||
|
||||
class DungeonData : public Resource {
|
||||
GDCLASS(DungeonData, Resource);
|
||||
|
||||
public:
|
||||
|
||||
Ref<Dungeon> setup_dungeon(int seed);
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
DungeonData();
|
||||
~DungeonData();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<Ref<DungeonRoomData> > _rooms;
|
||||
//Vector<Ref<DungeonRoomData> > _rooms;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
22
data/dungeon_room_data.cpp
Normal file
22
data/dungeon_room_data.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "dungeon_room_data.h"
|
||||
|
||||
Ref<DungeonRoom> DungeonRoomData::setup_room(int seed) {
|
||||
if (has_method("_setup_room")) {
|
||||
return call("_setup_room", seed);
|
||||
}
|
||||
|
||||
return Ref<DungeonRoom>(NULL);
|
||||
}
|
||||
|
||||
DungeonRoomData::DungeonRoomData() {
|
||||
|
||||
}
|
||||
DungeonRoomData::~DungeonRoomData() {
|
||||
|
||||
}
|
||||
|
||||
void DungeonRoomData::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "room", PROPERTY_HINT_RESOURCE_TYPE, "DungeonRoom"), "_setup_room", PropertyInfo(Variant::INT, "seed")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup_room", "seed"), &DungeonRoomData::setup_room);
|
||||
}
|
@ -1,25 +1,25 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
#ifndef DUNGEON_ROOM_DATA_H
|
||||
#define DUNGEON_ROOM_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
#include "../main/dungeon_room.h"
|
||||
|
||||
class DungeonRoomData : public Resource {
|
||||
GDCLASS(DungeonRoomData, Resource);
|
||||
|
||||
public:
|
||||
|
||||
Ref<DungeonRoom> setup_room(int seed);
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
DungeonRoomData();
|
||||
~DungeonRoomData();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<VoxelmanProp> _props;
|
||||
//Vector<VoxelmanProp> _props;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,21 +0,0 @@
|
||||
#include "voxelman_prop_entry.h"
|
||||
|
||||
Transform VoxelmanPropEntry::get_transform() const {
|
||||
return _transform;
|
||||
}
|
||||
void VoxelmanPropEntry::set_transform(const Transform value) {
|
||||
_transform = value;
|
||||
}
|
||||
|
||||
VoxelmanPropEntry::VoxelmanPropEntry() {
|
||||
|
||||
}
|
||||
VoxelmanPropEntry::~VoxelmanPropEntry() {
|
||||
|
||||
}
|
||||
|
||||
void VoxelmanPropEntry::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform);
|
||||
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
|
||||
}
|
@ -1,10 +1,11 @@
|
||||
#include "voxelman_prop_entry.h"
|
||||
#include "planet_data.h"
|
||||
|
||||
Transform PlanetData::get_transform() const {
|
||||
return _transform;
|
||||
Ref<Planet> PlanetData::setup_planet(int seed) {
|
||||
if (has_method("_setup_planet")) {
|
||||
return call("_setup_planet", seed);
|
||||
}
|
||||
void PlanetData::set_transform(const Transform value) {
|
||||
_transform = value;
|
||||
|
||||
return Ref<Planet>(NULL);
|
||||
}
|
||||
|
||||
PlanetData::PlanetData() {
|
||||
@ -15,5 +16,7 @@ PlanetData::~PlanetData() {
|
||||
}
|
||||
|
||||
void PlanetData::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "biome", PROPERTY_HINT_RESOURCE_TYPE, "Planet"), "_setup_planet", PropertyInfo(Variant::INT, "seed")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup_planet", "seed"), &PlanetData::setup_planet);
|
||||
}
|
||||
|
@ -1,13 +1,15 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
#ifndef PLANET_DATA_H
|
||||
#define PLANET_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
#include "../main/planet.h"
|
||||
|
||||
class PlanetData : public Resource {
|
||||
GDCLASS(PlanetData, Resource);
|
||||
|
||||
public:
|
||||
/*
|
||||
Ref<PlanetData> get_planet_data(const int index) const;
|
||||
void set_planet_data(const int index, const Ref<PlanetData> planet_data);
|
||||
void add_planet_data(const Ref<PlanetData> planet_data);
|
||||
@ -17,6 +19,7 @@ public:
|
||||
|
||||
Vector<Variant> get_planet_datas();
|
||||
void set_planet_datas(const Vector<Variant> &planet_datas);
|
||||
*/
|
||||
|
||||
Ref<Planet> setup_planet(int seed);
|
||||
|
||||
@ -28,10 +31,10 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
int _id;
|
||||
Vector<BiomeData> _biome_datas;
|
||||
Ref<NoiseParams> _humidity_noise_params;
|
||||
Ref<NoiseParams> _temperature_noise_params;
|
||||
//int _id;
|
||||
//Vector<BiomeData> _biome_datas;
|
||||
//Ref<NoiseParams> _humidity_noise_params;
|
||||
//Ref<NoiseParams> _temperature_noise_params;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,21 +1,27 @@
|
||||
#include "voxelman_prop_entry.h"
|
||||
#include "biome.h"
|
||||
|
||||
Transform VoxelmanPropEntry::get_transform() const {
|
||||
return _transform;
|
||||
void Biome::generate_chunk(Ref<VoxelChunk> chunk) {
|
||||
if (has_method("_generate")) {
|
||||
call("_generate", chunk);
|
||||
}
|
||||
}
|
||||
void Biome::generate_stack(Ref<VoxelChunk> chunk, int x, int z) {
|
||||
if (has_method("_generate")) {
|
||||
call("_generate", chunk, x, z);
|
||||
}
|
||||
void VoxelmanPropEntry::set_transform(const Transform value) {
|
||||
_transform = value;
|
||||
}
|
||||
|
||||
VoxelmanPropEntry::VoxelmanPropEntry() {
|
||||
Biome::Biome() {
|
||||
|
||||
}
|
||||
VoxelmanPropEntry::~VoxelmanPropEntry() {
|
||||
Biome::~Biome() {
|
||||
|
||||
}
|
||||
|
||||
void VoxelmanPropEntry::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform);
|
||||
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
|
||||
void Biome::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_stack", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::INT, "x"), PropertyInfo(Variant::INT, "z")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Biome::generate_chunk);
|
||||
ClassDB::bind_method(D_METHOD("generate_stack", "chunk", "x", "z"), &Biome::generate_stack);
|
||||
}
|
||||
|
23
main/biome.h
23
main/biome.h
@ -1,27 +1,26 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
#ifndef BIOME_H
|
||||
#define BIOME_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
|
||||
class Biome : public Resource {
|
||||
GDCLASS(Biome, Resource);
|
||||
|
||||
public:
|
||||
|
||||
void generate_chunk(Ref<VoxelChunk> chunk);
|
||||
void generate_stack(int x, int z, Ref<VoxelChunk> chunk);
|
||||
void generate_stack(Ref<VoxelChunk> chunk, int x, int z);
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
Biome();
|
||||
~Biome();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<Ref<VoxelmanProp> > _props;
|
||||
Vector<Ref<Dungeon> > _dungeons;
|
||||
//Vector<Ref<VoxelmanProp> > _props;
|
||||
//Vector<Ref<Dungeon> > _dungeons;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,21 +1,20 @@
|
||||
#include "voxelman_prop_entry.h"
|
||||
#include "dungeon.h"
|
||||
|
||||
Transform VoxelmanPropEntry::get_transform() const {
|
||||
return _transform;
|
||||
void Dungeon::generate(Ref<VoxelStructure> structure) {
|
||||
if (has_method("_generate")) {
|
||||
call("_generate", structure);
|
||||
}
|
||||
void VoxelmanPropEntry::set_transform(const Transform value) {
|
||||
_transform = value;
|
||||
}
|
||||
|
||||
VoxelmanPropEntry::VoxelmanPropEntry() {
|
||||
Dungeon::Dungeon() {
|
||||
|
||||
}
|
||||
VoxelmanPropEntry::~VoxelmanPropEntry() {
|
||||
Dungeon::~Dungeon() {
|
||||
|
||||
}
|
||||
|
||||
void VoxelmanPropEntry::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform);
|
||||
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
|
||||
void Dungeon::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_generate", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate", "structure"), &Dungeon::generate);
|
||||
}
|
||||
|
@ -1,25 +1,26 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
#ifndef DUNGEON_H
|
||||
#define DUNGEON_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
#include "../../voxelman/world/voxel_structure.h"
|
||||
|
||||
class Dungeon : public Reference {
|
||||
GDCLASS(Dungeon, Reference);
|
||||
|
||||
public:
|
||||
|
||||
Ref<VoxelmanStructure> generate_dungeon();
|
||||
void generate(Ref<VoxelStructure> structure);
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
Dungeon();
|
||||
~Dungeon();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<Ref<DungeonRoopm> > _rooms;
|
||||
//Vector<Ref<DungeonRoopm> > _rooms;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,21 +1,20 @@
|
||||
#include "voxelman_prop_entry.h"
|
||||
#include "dungeon_room.h"
|
||||
|
||||
Transform VoxelmanPropEntry::get_transform() const {
|
||||
return _transform;
|
||||
void DungeonRoom::generate_room(Ref<VoxelStructure> structure) {
|
||||
if (has_method("_generate_room")) {
|
||||
call("_generate_room", structure);
|
||||
}
|
||||
void VoxelmanPropEntry::set_transform(const Transform value) {
|
||||
_transform = value;
|
||||
}
|
||||
|
||||
VoxelmanPropEntry::VoxelmanPropEntry() {
|
||||
DungeonRoom::DungeonRoom() {
|
||||
|
||||
}
|
||||
VoxelmanPropEntry::~VoxelmanPropEntry() {
|
||||
DungeonRoom::~DungeonRoom() {
|
||||
|
||||
}
|
||||
|
||||
void VoxelmanPropEntry::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform);
|
||||
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
|
||||
void DungeonRoom::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_generate_room", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_room", "structure"), &DungeonRoom::generate_room);
|
||||
}
|
||||
|
@ -1,26 +1,26 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
#ifndef DUNGEON_ROOM_H
|
||||
#define DUNGEON_ROOM_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
#include "core/reference.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
#include "../../voxelman/world/voxel_structure.h"
|
||||
|
||||
class DungeonRoom : public Reference {
|
||||
GDCLASS(DungeonRoom, Reference);
|
||||
|
||||
public:
|
||||
|
||||
void write_room(Ref<VoxelmanStructure> structure, Vector3i position, Vector3i size);
|
||||
void generate_room(Ref<VoxelmanStructure> structure);
|
||||
void generate_room(Ref<VoxelStructure> structure);
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
DungeonRoom();
|
||||
~DungeonRoom();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<Ref<VoxelmanProp> > _props;
|
||||
//Vector<Ref<VoxelmanProp> > _props;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,21 +1,20 @@
|
||||
#include "voxelman_prop_entry.h"
|
||||
#include "planet.h"
|
||||
|
||||
Transform VoxelmanPropEntry::get_transform() const {
|
||||
return _transform;
|
||||
void Planet::generate_chunk(Ref<VoxelChunk> chunk) {
|
||||
if (has_method("_generate_chunk")) {
|
||||
call("_generate_chunk", chunk);
|
||||
}
|
||||
void VoxelmanPropEntry::set_transform(const Transform value) {
|
||||
_transform = value;
|
||||
}
|
||||
|
||||
VoxelmanPropEntry::VoxelmanPropEntry() {
|
||||
Planet::Planet() {
|
||||
|
||||
}
|
||||
VoxelmanPropEntry::~VoxelmanPropEntry() {
|
||||
Planet::~Planet() {
|
||||
|
||||
}
|
||||
|
||||
void VoxelmanPropEntry::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform);
|
||||
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
|
||||
void Planet::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Planet::generate_chunk);
|
||||
}
|
||||
|
@ -1,25 +1,24 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
#ifndef PLANET_H
|
||||
#define PLANET_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
|
||||
class Planet : public Resource {
|
||||
GDCLASS(Planet, Resource);
|
||||
|
||||
public:
|
||||
|
||||
void generate_chunk(Ref<VoxelChunk> chunk);
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
Planet();
|
||||
~Planet();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<Ref<Biome> > _biomes;
|
||||
//Vector<Ref<Biome> > _biomes;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,29 @@
|
||||
#include "register_types.h"
|
||||
|
||||
#include "data/dungeon_room_data.h"
|
||||
#include "data/dungeon_data.h"
|
||||
#include "data/biome_data.h"
|
||||
#include "data/planet_data.h"
|
||||
|
||||
#include "main/dungeon_room.h"
|
||||
#include "main/dungeon.h"
|
||||
#include "main/biome.h"
|
||||
#include "main/planet.h"
|
||||
|
||||
#include "world_generator.h"
|
||||
|
||||
void register_world_generator_types() {
|
||||
//ClassDB::register_class<BSInputModifier>();
|
||||
ClassDB::register_class<DungeonRoomData>();
|
||||
ClassDB::register_class<DungeonData>();
|
||||
ClassDB::register_class<BiomeData>();
|
||||
ClassDB::register_class<PlanetData>();
|
||||
|
||||
ClassDB::register_class<DungeonRoom>();
|
||||
ClassDB::register_class<Dungeon>();
|
||||
ClassDB::register_class<Biome>();
|
||||
ClassDB::register_class<Planet>();
|
||||
|
||||
ClassDB::register_class<WorldGenerator>();
|
||||
}
|
||||
|
||||
void unregister_world_generator_types() {
|
||||
|
@ -39,7 +39,7 @@ void WorldGenerator::set_planet_datas(const Vector<Variant> &planet_datas) {
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Planet> WorldGenerator::setup_planet() {
|
||||
Ref<Planet> WorldGenerator::setup_planet(int seed) {
|
||||
if (has_method("_setup_planet")) {
|
||||
return call("_setup_planet");
|
||||
}
|
||||
@ -55,16 +55,18 @@ WorldGenerator::~WorldGenerator() {
|
||||
}
|
||||
|
||||
void WorldGenerator::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "planet", PROPERTY_HINT_RESOURCE_TYPE, "Planet") , "_setup_planet"));
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "planet", PROPERTY_HINT_RESOURCE_TYPE, "Planet"), "_setup_planet", PropertyInfo(Variant::INT, "seed")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_planet_data", "index"), &VoxelmanProp::get_planet_data);
|
||||
ClassDB::bind_method(D_METHOD("set_planet_data", "index", "data"), &VoxelmanProp::set_planet_data);
|
||||
ClassDB::bind_method(D_METHOD("add_planet_data", "planet_data"), &VoxelmanProp::add_planet_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_planet_data", "index"), &VoxelmanProp::remove_planet_data);
|
||||
ClassDB::bind_method(D_METHOD("setup_planet", "seed"), &WorldGenerator::setup_planet);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_planet_data_count"), &VoxelmanProp::get_planet_data_count);
|
||||
ClassDB::bind_method(D_METHOD("get_planet_data", "index"), &WorldGenerator::get_planet_data);
|
||||
ClassDB::bind_method(D_METHOD("set_planet_data", "index", "data"), &WorldGenerator::set_planet_data);
|
||||
ClassDB::bind_method(D_METHOD("add_planet_data", "planet_data"), &WorldGenerator::add_planet_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_planet_data", "index"), &WorldGenerator::remove_planet_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_planet_datas"), &VoxelmanProp::get_planet_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_planet_datas", "planet_datas"), &VoxelmanProp::set_planet_datas);
|
||||
ClassDB::bind_method(D_METHOD("get_planet_data_count"), &WorldGenerator::get_planet_data_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_planet_datas"), &WorldGenerator::get_planet_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_planet_datas", "planet_datas"), &WorldGenerator::set_planet_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "planet_datas", PROPERTY_HINT_NONE, "17/17:PlanetData", PROPERTY_USAGE_DEFAULT, "PlanetData"), "set_planet_datas", "get_planet_datas");
|
||||
}
|
@ -4,8 +4,9 @@
|
||||
#include "core/resource.h"
|
||||
#include "core/vector.h"
|
||||
|
||||
#include "planet_data.h"
|
||||
#include "../main/planet.h"
|
||||
#include "data/planet_data.h"
|
||||
|
||||
#include "main/planet.h"
|
||||
|
||||
|
||||
class WorldGenerator : public Resource {
|
||||
@ -22,7 +23,7 @@ public:
|
||||
Vector<Variant> get_planet_datas();
|
||||
void set_planet_datas(const Vector<Variant> &planet_datas);
|
||||
|
||||
Ref<Planet> setup_planet();
|
||||
Ref<Planet> setup_planet(int seed);
|
||||
|
||||
WorldGenerator();
|
||||
~WorldGenerator();
|
||||
@ -32,7 +33,7 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
Vector<PlanetData> _planet_datas;
|
||||
Vector<Ref<PlanetData> > _planet_datas;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user