mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-12 10:15:12 +01:00
Level generator skeleton class.
This commit is contained in:
parent
63c7c0536c
commit
5eb5249147
2
SCsub
2
SCsub
@ -24,3 +24,5 @@ env.add_source_files(env.modules_sources,"meshers/cubic_mesher/voxel_cube_points
|
||||
|
||||
env.add_source_files(env.modules_sources,"props/voxelman_prop_data.cpp")
|
||||
env.add_source_files(env.modules_sources,"props/voxelman_prop.cpp")
|
||||
|
||||
env.add_source_files(env.modules_sources,"level_generator/voxelman_level_generator.cpp")
|
||||
|
10
level_generator/voxelman_level_generator.cpp
Normal file
10
level_generator/voxelman_level_generator.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include "voxelman_level_generator.h"
|
||||
|
||||
VoxelmanLevelGenerator::VoxelmanLevelGenerator() {
|
||||
}
|
||||
|
||||
VoxelmanLevelGenerator::~VoxelmanLevelGenerator() {
|
||||
}
|
||||
|
||||
void VoxelmanLevelGenerator::_bind_methods() {
|
||||
}
|
19
level_generator/voxelman_level_generator.h
Normal file
19
level_generator/voxelman_level_generator.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef VOXELMAN_LEVEL_GENERATOR_H
|
||||
#define VOXELMAN_LEVEL_GENERATOR_H
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
class VoxelmanLevelGenerator : public Resource {
|
||||
GDCLASS(VoxelmanLevelGenerator, Resource);
|
||||
|
||||
public:
|
||||
VoxelmanLevelGenerator();
|
||||
~VoxelmanLevelGenerator();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "props/voxelman_prop_data.h"
|
||||
#include "props/voxelman_prop.h"
|
||||
|
||||
#include "level_generator/voxelman_level_generator.h"
|
||||
|
||||
void register_voxelman_types() {
|
||||
ClassDB::register_class<VoxelMesher>();
|
||||
ClassDB::register_class<VoxelMesherTransvoxel>();
|
||||
@ -39,6 +41,8 @@ void register_voxelman_types() {
|
||||
|
||||
ClassDB::register_class<VoxelmanPropData>();
|
||||
ClassDB::register_class<VoxelmanProp>();
|
||||
|
||||
ClassDB::register_class<VoxelmanLevelGenerator>();
|
||||
}
|
||||
|
||||
void unregister_voxelman_types() {
|
||||
|
@ -30,6 +30,13 @@ void VoxelWorld::set_library(const Ref<VoxelmanLibrary> library) {
|
||||
_library = library;
|
||||
}
|
||||
|
||||
Ref<VoxelmanLevelGenerator> VoxelWorld::get_level_generator() const {
|
||||
return _level_generator;
|
||||
}
|
||||
void VoxelWorld::set_level_generator(const Ref<VoxelmanLevelGenerator> level_generator) {
|
||||
_level_generator = level_generator;
|
||||
}
|
||||
|
||||
float VoxelWorld::get_voxel_scale() const {
|
||||
return _voxel_scale;
|
||||
}
|
||||
@ -141,7 +148,11 @@ void VoxelWorld::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_library"), &VoxelWorld::get_library);
|
||||
ClassDB::bind_method(D_METHOD("set_library", "library"), &VoxelWorld::set_library);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary"), "set_library", "get_library");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_level_generator"), &VoxelWorld::get_level_generator);
|
||||
ClassDB::bind_method(D_METHOD("set_level_generator", "level_generator"), &VoxelWorld::set_level_generator);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "level_generator", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLevelGenerator"), "set_level_generator", "get_level_generator");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_voxel_scale"), &VoxelWorld::get_voxel_scale);
|
||||
ClassDB::bind_method(D_METHOD("set_voxel_scale", "value"), &VoxelWorld::set_voxel_scale);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "voxel_scale"), "set_voxel_scale", "get_voxel_scale");
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "../math/vector3i.h"
|
||||
#include "../library/voxelman_library.h"
|
||||
#include "../level_generator/voxelman_level_generator.h"
|
||||
#include "voxel_buffer.h"
|
||||
|
||||
class VoxelChunk;
|
||||
@ -25,6 +26,9 @@ public:
|
||||
|
||||
Ref<VoxelmanLibrary> get_library() const;
|
||||
void set_library(const Ref<VoxelmanLibrary> library);
|
||||
|
||||
Ref<VoxelmanLevelGenerator> get_level_generator() const;
|
||||
void set_level_generator(const Ref<VoxelmanLevelGenerator> level_generator);
|
||||
|
||||
float get_voxel_scale() const;
|
||||
void set_voxel_scale(const float value);
|
||||
@ -57,6 +61,7 @@ protected:
|
||||
private:
|
||||
Vector3i _chunk_size;
|
||||
Ref<VoxelmanLibrary> _library;
|
||||
Ref<VoxelmanLevelGenerator> _level_generator;
|
||||
float _voxel_scale;
|
||||
int _chunk_spawn_range;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user