mirror of
https://github.com/Relintai/world_generator.git
synced 2024-11-12 10:15:07 +01:00
Rough class structure.
This commit is contained in:
parent
c47c7dc500
commit
2b71488e6f
21
data/biome_data.cpp
Normal file
21
data/biome_data.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#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");
|
||||
}
|
28
data/biome_data.h
Normal file
28
data/biome_data.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
|
||||
public:
|
||||
|
||||
Ref<Biome> setup_biome();
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector2 _humidity_range;
|
||||
Vector2 _temperature_range;
|
||||
Vector<DungeonData> _dungeon_datas;
|
||||
Vector<Ref<VoxelmanProp> > _props;
|
||||
};
|
||||
|
||||
#endif
|
21
data/dungeon_data.cpp
Normal file
21
data/dungeon_data.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#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");
|
||||
}
|
25
data/dungeon_data.h
Normal file
25
data/dungeon_data.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
|
||||
public:
|
||||
|
||||
Ref<Dungeon> setup_dungeon(int seed);
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<Ref<DungeonRoomData> > _rooms;
|
||||
};
|
||||
|
||||
#endif
|
25
data/dungeon_room_data.h
Normal file
25
data/dungeon_room_data.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
|
||||
public:
|
||||
|
||||
Ref<DungeonRoom> setup_room(int seed);
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<VoxelmanProp> _props;
|
||||
};
|
||||
|
||||
#endif
|
21
data/dungeon_room_data.h.cpp
Normal file
21
data/dungeon_room_data.h.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#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");
|
||||
}
|
19
data/planet_data.cpp
Normal file
19
data/planet_data.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include "voxelman_prop_entry.h"
|
||||
|
||||
Transform PlanetData::get_transform() const {
|
||||
return _transform;
|
||||
}
|
||||
void PlanetData::set_transform(const Transform value) {
|
||||
_transform = value;
|
||||
}
|
||||
|
||||
PlanetData::PlanetData() {
|
||||
|
||||
}
|
||||
PlanetData::~PlanetData() {
|
||||
|
||||
}
|
||||
|
||||
void PlanetData::_bind_methods() {
|
||||
|
||||
}
|
37
data/planet_data.h
Normal file
37
data/planet_data.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.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);
|
||||
void remove_planet_data(const int index);
|
||||
|
||||
int get_planet_data_count() const;
|
||||
|
||||
Vector<Variant> get_planet_datas();
|
||||
void set_planet_datas(const Vector<Variant> &planet_datas);
|
||||
|
||||
Ref<Planet> setup_planet(int seed);
|
||||
|
||||
PlanetData();
|
||||
~PlanetData();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
int _id;
|
||||
Vector<BiomeData> _biome_datas;
|
||||
Ref<NoiseParams> _humidity_noise_params;
|
||||
Ref<NoiseParams> _temperature_noise_params;
|
||||
};
|
||||
|
||||
#endif
|
70
data/world_generator.cpp
Normal file
70
data/world_generator.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
#include "world_generator.h"
|
||||
|
||||
Ref<PlanetData> WorldGenerator::get_planet_data(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _planet_datas.size(), Ref<PlanetData>());
|
||||
|
||||
return _planet_datas.get(index);
|
||||
}
|
||||
void WorldGenerator::set_planet_data(const int index, const Ref<PlanetData> planet_data) {
|
||||
ERR_FAIL_INDEX(index, _planet_datas.size());
|
||||
|
||||
_planet_datas.set(index, planet_data);
|
||||
}
|
||||
void WorldGenerator::add_planet_data(const Ref<PlanetData> planet_data) {
|
||||
_planet_datas.push_back(planet_data);
|
||||
}
|
||||
void WorldGenerator::remove_planet_data(const int index) {
|
||||
ERR_FAIL_INDEX(index, _planet_datas.size());
|
||||
|
||||
_planet_datas.remove(index);
|
||||
}
|
||||
|
||||
int WorldGenerator::get_planet_data_count() const {
|
||||
return _planet_datas.size();
|
||||
}
|
||||
|
||||
Vector<Variant> WorldGenerator::get_planet_datas() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _planet_datas.size(); i++) {
|
||||
r.push_back(_planet_datas[i].get_ref_ptr());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
void WorldGenerator::set_planet_datas(const Vector<Variant> &planet_datas) {
|
||||
_planet_datas.clear();
|
||||
for (int i = 0; i < planet_datas.size(); i++) {
|
||||
Ref<PlanetData> planet_data = Ref<PlanetData>(planet_datas[i]);
|
||||
|
||||
_planet_datas.push_back(planet_data);
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Planet> WorldGenerator::setup_planet() {
|
||||
if (has_method("_setup_planet")) {
|
||||
return call("_setup_planet");
|
||||
}
|
||||
|
||||
return Ref<Planet>(NULL);
|
||||
}
|
||||
|
||||
WorldGenerator::WorldGenerator() {
|
||||
|
||||
}
|
||||
WorldGenerator::~WorldGenerator() {
|
||||
_planet_datas.clear();
|
||||
}
|
||||
|
||||
void WorldGenerator::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "planet", PROPERTY_HINT_RESOURCE_TYPE, "Planet") , "_setup_planet"));
|
||||
|
||||
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("get_planet_data_count"), &VoxelmanProp::get_planet_data_count);
|
||||
|
||||
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);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "planet_datas", PROPERTY_HINT_NONE, "17/17:PlanetData", PROPERTY_USAGE_DEFAULT, "PlanetData"), "set_planet_datas", "get_planet_datas");
|
||||
}
|
38
data/world_generator.h
Normal file
38
data/world_generator.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef WORLD_GENERATOR_H
|
||||
#define WORLD_GENERATOR_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/vector.h"
|
||||
|
||||
#include "planet_data.h"
|
||||
#include "../main/planet.h"
|
||||
|
||||
|
||||
class WorldGenerator : public Resource {
|
||||
GDCLASS(WorldGenerator, 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);
|
||||
void remove_planet_data(const int index);
|
||||
|
||||
int get_planet_data_count() const;
|
||||
|
||||
Vector<Variant> get_planet_datas();
|
||||
void set_planet_datas(const Vector<Variant> &planet_datas);
|
||||
|
||||
Ref<Planet> setup_planet();
|
||||
|
||||
WorldGenerator();
|
||||
~WorldGenerator();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<PlanetData> _planet_datas;
|
||||
};
|
||||
|
||||
#endif
|
21
main/biome.cpp
Normal file
21
main/biome.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#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");
|
||||
}
|
27
main/biome.h
Normal file
27
main/biome.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
|
||||
public:
|
||||
|
||||
void generate_chunk(Ref<VoxelChunk> chunk);
|
||||
void generate_stack(int x, int z, Ref<VoxelChunk> chunk);
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<Ref<VoxelmanProp> > _props;
|
||||
Vector<Ref<Dungeon> > _dungeons;
|
||||
};
|
||||
|
||||
#endif
|
21
main/dungeon.cpp
Normal file
21
main/dungeon.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#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");
|
||||
}
|
25
main/dungeon.h
Normal file
25
main/dungeon.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
|
||||
public:
|
||||
|
||||
Ref<VoxelmanStructure> generate_dungeon();
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<Ref<DungeonRoopm> > _rooms;
|
||||
};
|
||||
|
||||
#endif
|
21
main/dungeon_room.cpp
Normal file
21
main/dungeon_room.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#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");
|
||||
}
|
26
main/dungeon_room.h
Normal file
26
main/dungeon_room.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
|
||||
public:
|
||||
|
||||
void write_room(Ref<VoxelmanStructure> structure, Vector3i position, Vector3i size);
|
||||
void generate_room(Ref<VoxelmanStructure> structure);
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<Ref<VoxelmanProp> > _props;
|
||||
};
|
||||
|
||||
#endif
|
21
main/planet.cpp
Normal file
21
main/planet.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#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");
|
||||
}
|
25
main/planet.h
Normal file
25
main/planet.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef VOXELMAN_PROP_DATA_H
|
||||
#define VOXELMAN_PROP_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
|
||||
class VoxelmanPropEntry : public Resource {
|
||||
GDCLASS(VoxelmanPropEntry, Resource);
|
||||
|
||||
public:
|
||||
|
||||
void generate_chunk(Ref<VoxelChunk> chunk);
|
||||
|
||||
VoxelmanPropEntry();
|
||||
~VoxelmanPropEntry();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<Ref<Biome> > _biomes;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user