mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-04-14 23:58:26 +02:00
Added TerrainWorldChunkDataManager class to support loading and saving TerrainWorld chunks dynamically to and from disk.
This commit is contained in:
parent
9bb5495776
commit
e88789ba9e
@ -45,6 +45,9 @@ sources = [
|
||||
"world/jobs/terrain_mesher_job_step.cpp",
|
||||
"world/jobs/terrain_light_job.cpp",
|
||||
"world/jobs/terrain_prop_job.cpp",
|
||||
|
||||
"chunk_data_managers/terrain_world_chunk_data_manager.cpp",
|
||||
"chunk_data_managers/terrain_world_chunk_data_manager_static_folder_resources.cpp"
|
||||
]
|
||||
|
||||
if env["tools"]:
|
||||
|
@ -0,0 +1,181 @@
|
||||
/*************************************************************************/
|
||||
/* terrain_world_chunk_data_manager.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* PANDEMONIUM ENGINE */
|
||||
/* https://github.com/Relintai/pandemonium_engine */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2022-present Péter Magyar. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "terrain_world_chunk_data_manager.h"
|
||||
|
||||
#include "../world/terrain_chunk.h"
|
||||
#include "../world/terrain_world.h"
|
||||
|
||||
Ref<TerrainChunk> TerrainWorldChunkDataManager::load_chunk(const Vector2i &p_chunk_position) {
|
||||
return call("_load_chunk", p_chunk_position);
|
||||
}
|
||||
Ref<TerrainChunk> TerrainWorldChunkDataManager::_load_chunk(const Vector2i &p_chunk_position) {
|
||||
return Ref<TerrainChunk>();
|
||||
}
|
||||
|
||||
void TerrainWorldChunkDataManager::load_all_chunks(TerrainWorld *p_world) {
|
||||
ERR_FAIL_COND(!p_world || !ObjectDB::instance_validate(p_world));
|
||||
|
||||
Vector<Vector2i> chunks = get_available_chunk_list();
|
||||
|
||||
for (int i = 0; i < chunks.size(); ++i) {
|
||||
Vector2i chunk_position = chunks[i];
|
||||
|
||||
if (!p_world->chunk_has(chunk_position.x, chunk_position.y)) {
|
||||
Ref<TerrainChunk> chunk = load_chunk(chunk_position);
|
||||
|
||||
ERR_CONTINUE(!chunk.is_valid());
|
||||
|
||||
p_world->chunk_add(chunk, chunk_position.x, chunk_position.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TerrainWorldChunkDataManager::load_chunks(TerrainWorld *p_world, const Vector<Vector2i> &p_chunks) {
|
||||
ERR_FAIL_COND(!p_world || !ObjectDB::instance_validate(p_world));
|
||||
|
||||
for (int i = 0; i < p_chunks.size(); ++i) {
|
||||
Vector2i chunk_position = p_chunks[i];
|
||||
|
||||
if (!p_world->chunk_has(chunk_position.x, chunk_position.y)) {
|
||||
Ref<TerrainChunk> chunk = load_chunk(chunk_position);
|
||||
|
||||
// Invalid value got passed in, just skip so scripts don't have to worry about checking validity one by one
|
||||
// (like a spawn range script)
|
||||
if (!chunk.is_valid()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
p_world->chunk_add(chunk, chunk_position.x, chunk_position.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TerrainWorldChunkDataManager::load_all_chunks_bind(Node *p_world) {
|
||||
load_all_chunks(Object::cast_to<TerrainWorld>(p_world));
|
||||
}
|
||||
void TerrainWorldChunkDataManager::load_chunks_bind(Node *p_world, const Vector<Vector2i> &p_chunks) {
|
||||
load_chunks(Object::cast_to<TerrainWorld>(p_world), p_chunks);
|
||||
}
|
||||
|
||||
Vector<Vector2i> TerrainWorldChunkDataManager::get_available_chunk_list() {
|
||||
return call("_get_available_chunk_list");
|
||||
}
|
||||
Vector<Vector2i> TerrainWorldChunkDataManager::_get_available_chunk_list() {
|
||||
return Vector<Vector2i>();
|
||||
}
|
||||
|
||||
void TerrainWorldChunkDataManager::delete_chunk_data_at(const Vector2i &p_chunk_position) {
|
||||
call("_delete_chunk_data_at", p_chunk_position);
|
||||
}
|
||||
void TerrainWorldChunkDataManager::_delete_chunk_data_at(const Vector2i &p_chunk_position) {
|
||||
}
|
||||
|
||||
void TerrainWorldChunkDataManager::delete_chunk_data(const Ref<TerrainChunk> &p_chunk) {
|
||||
call("_delete_chunk_data", p_chunk);
|
||||
}
|
||||
void TerrainWorldChunkDataManager::_delete_chunk_data(const Ref<TerrainChunk> &p_chunk) {
|
||||
}
|
||||
|
||||
void TerrainWorldChunkDataManager::delete_all_chunk_data() {
|
||||
call("_delete_all_chunk_data");
|
||||
}
|
||||
void TerrainWorldChunkDataManager::_delete_all_chunk_data() {
|
||||
}
|
||||
|
||||
// Callbacks
|
||||
void TerrainWorldChunkDataManager::on_world_chunk_created(const Ref<TerrainChunk> &p_chunk) {
|
||||
call("_on_world_chunk_created", p_chunk);
|
||||
}
|
||||
void TerrainWorldChunkDataManager::_on_world_chunk_created(const Ref<TerrainChunk> &p_chunk) {
|
||||
}
|
||||
|
||||
void TerrainWorldChunkDataManager::on_world_chunk_removed(const Ref<TerrainChunk> &p_chunk) {
|
||||
call("_on_world_chunk_removed", p_chunk);
|
||||
}
|
||||
void TerrainWorldChunkDataManager::_on_world_chunk_removed(const Ref<TerrainChunk> &p_chunk) {
|
||||
}
|
||||
|
||||
void TerrainWorldChunkDataManager::on_world_chunk_added(const Ref<TerrainChunk> &p_chunk) {
|
||||
call("_on_world_chunk_added", p_chunk);
|
||||
}
|
||||
void TerrainWorldChunkDataManager::_on_world_chunk_added(const Ref<TerrainChunk> &p_chunk) {
|
||||
}
|
||||
|
||||
TerrainWorldChunkDataManager::TerrainWorldChunkDataManager() {
|
||||
}
|
||||
|
||||
TerrainWorldChunkDataManager::~TerrainWorldChunkDataManager() {
|
||||
}
|
||||
|
||||
void TerrainWorldChunkDataManager::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk"),
|
||||
"_load_chunk",
|
||||
PropertyInfo(Variant::VECTOR2I, "chunk_position")));
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::POOL_VECTOR2I_ARRAY, "chunks"), "_get_available_chunk_list"));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_delete_chunk_data_at", PropertyInfo(Variant::VECTOR2I, "chunk_position")));
|
||||
BIND_VMETHOD(MethodInfo("_delete_chunk_data", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk")));
|
||||
BIND_VMETHOD(MethodInfo("_delete_all_chunk_data"));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_on_world_chunk_created", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk")));
|
||||
BIND_VMETHOD(MethodInfo("_on_world_chunk_removed", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk")));
|
||||
BIND_VMETHOD(MethodInfo("_on_world_chunk_added", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "TerrainChunk")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("load_chunk", "chunk_position"), &TerrainWorldChunkDataManager::load_chunk);
|
||||
ClassDB::bind_method(D_METHOD("_load_chunk", "chunk_position"), &TerrainWorldChunkDataManager::_load_chunk);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("load_all_chunks", "world"), &TerrainWorldChunkDataManager::load_all_chunks_bind);
|
||||
ClassDB::bind_method(D_METHOD("load_chunks", "world", "chunks"), &TerrainWorldChunkDataManager::load_chunks_bind);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_available_chunk_list"), &TerrainWorldChunkDataManager::get_available_chunk_list);
|
||||
ClassDB::bind_method(D_METHOD("_get_available_chunk_list"), &TerrainWorldChunkDataManager::_get_available_chunk_list);
|
||||
|
||||
// Delete
|
||||
ClassDB::bind_method(D_METHOD("delete_chunk_data_at", "chunk_position"), &TerrainWorldChunkDataManager::delete_chunk_data_at);
|
||||
ClassDB::bind_method(D_METHOD("_delete_chunk_data_at", "chunk_position"), &TerrainWorldChunkDataManager::_delete_chunk_data_at);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("delete_chunk_data", "chunk"), &TerrainWorldChunkDataManager::delete_chunk_data);
|
||||
ClassDB::bind_method(D_METHOD("_delete_chunk_data", "chunk"), &TerrainWorldChunkDataManager::_delete_chunk_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("delete_all_chunk_data"), &TerrainWorldChunkDataManager::delete_all_chunk_data);
|
||||
ClassDB::bind_method(D_METHOD("_delete_all_chunk_data"), &TerrainWorldChunkDataManager::_delete_all_chunk_data);
|
||||
|
||||
// Callbacks
|
||||
ClassDB::bind_method(D_METHOD("on_world_chunk_created", "chunk"), &TerrainWorldChunkDataManager::on_world_chunk_created);
|
||||
ClassDB::bind_method(D_METHOD("_on_world_chunk_created", "chunk"), &TerrainWorldChunkDataManager::_on_world_chunk_created);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("on_world_chunk_removed", "chunk"), &TerrainWorldChunkDataManager::on_world_chunk_removed);
|
||||
ClassDB::bind_method(D_METHOD("_on_world_chunk_removed", "chunk"), &TerrainWorldChunkDataManager::_on_world_chunk_removed);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("on_world_chunk_added", "chunk"), &TerrainWorldChunkDataManager::on_world_chunk_added);
|
||||
ClassDB::bind_method(D_METHOD("_on_world_chunk_added", "chunk"), &TerrainWorldChunkDataManager::_on_world_chunk_added);
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
#ifndef TERRAIN_WORLD_CHUNK_DATA_MANAGER_H
|
||||
#define TERRAIN_WORLD_CHUNK_DATA_MANAGER_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* terrain_world_chunk_data_manager.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* PANDEMONIUM ENGINE */
|
||||
/* https://github.com/Relintai/pandemonium_engine */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2022-present Péter Magyar. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "core/object/resource.h"
|
||||
|
||||
class TerrainChunk;
|
||||
class TerrainWorld;
|
||||
|
||||
class TerrainWorldChunkDataManager : public Resource {
|
||||
GDCLASS(TerrainWorldChunkDataManager, Resource);
|
||||
|
||||
public:
|
||||
Ref<TerrainChunk> load_chunk(const Vector2i &p_chunk_position);
|
||||
virtual Ref<TerrainChunk> _load_chunk(const Vector2i &p_chunk_position);
|
||||
|
||||
void load_all_chunks(TerrainWorld *p_world);
|
||||
void load_chunks(TerrainWorld *p_world, const Vector<Vector2i> &p_chunks);
|
||||
void load_all_chunks_bind(Node *p_world);
|
||||
void load_chunks_bind(Node *p_world, const Vector<Vector2i> &p_chunks);
|
||||
|
||||
Vector<Vector2i> get_available_chunk_list();
|
||||
virtual Vector<Vector2i> _get_available_chunk_list();
|
||||
|
||||
// Delete
|
||||
void delete_chunk_data_at(const Vector2i &p_chunk_position);
|
||||
virtual void _delete_chunk_data_at(const Vector2i &p_chunk_position);
|
||||
|
||||
void delete_chunk_data(const Ref<TerrainChunk> &p_chunk);
|
||||
virtual void _delete_chunk_data(const Ref<TerrainChunk> &p_chunk);
|
||||
|
||||
void delete_all_chunk_data();
|
||||
virtual void _delete_all_chunk_data();
|
||||
|
||||
// Callbacks
|
||||
void on_world_chunk_created(const Ref<TerrainChunk> &p_chunk);
|
||||
virtual void _on_world_chunk_created(const Ref<TerrainChunk> &p_chunk);
|
||||
|
||||
void on_world_chunk_removed(const Ref<TerrainChunk> &p_chunk);
|
||||
virtual void _on_world_chunk_removed(const Ref<TerrainChunk> &p_chunk);
|
||||
|
||||
void on_world_chunk_added(const Ref<TerrainChunk> &p_chunk);
|
||||
virtual void _on_world_chunk_added(const Ref<TerrainChunk> &p_chunk);
|
||||
|
||||
TerrainWorldChunkDataManager();
|
||||
~TerrainWorldChunkDataManager();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,54 @@
|
||||
/*************************************************************************/
|
||||
/* terrain_world_chunk_data_manager_static_folder_resources.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* PANDEMONIUM ENGINE */
|
||||
/* https://github.com/Relintai/pandemonium_engine */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2022-present Péter Magyar. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "terrain_world_chunk_data_manager_static_folder_resources.h"
|
||||
|
||||
#include "../world/terrain_chunk.h"
|
||||
|
||||
TerrainWorldChunkDataManagerStaticFolderResources::TerrainWorldChunkDataManagerStaticFolderResources() {
|
||||
}
|
||||
|
||||
TerrainWorldChunkDataManagerStaticFolderResources::~TerrainWorldChunkDataManagerStaticFolderResources() {
|
||||
}
|
||||
|
||||
void TerrainWorldChunkDataManagerStaticFolderResources::_bind_methods() {
|
||||
/*
|
||||
ClassDB::bind_method(D_METHOD("get_floor_position"), &TerrainWorldChunkDataManagerStaticFolderResources::get_floor_position);
|
||||
ClassDB::bind_method(D_METHOD("set_floor_position", "value"), &TerrainWorldChunkDataManagerStaticFolderResources::set_floor_position);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "floor_position"), "set_floor_position", "get_floor_position");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_channel_map"), &TerrainWorldChunkDataManagerStaticFolderResources::get_channel_map);
|
||||
ClassDB::bind_method(D_METHOD("set_channel_map", "value"), &TerrainWorldChunkDataManagerStaticFolderResources::set_channel_map);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "channel_map"), "set_channel_map", "get_channel_map");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_generate_chunk", "chunk"), &TerrainWorldChunkDataManagerStaticFolderResources::_generate_chunk);
|
||||
*/
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
#ifndef TERRAIN_WORLD_CHUNK_DATA_MANAGER_STATIC_FOLDER_RESOURCES_H
|
||||
#define TERRAIN_WORLD_CHUNK_DATA_MANAGER_STATIC_FOLDER_RESOURCES_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* terrain_world_chunk_data_manager_static_folder_resources.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* PANDEMONIUM ENGINE */
|
||||
/* https://github.com/Relintai/pandemonium_engine */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2022-present Péter Magyar. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "terrain_world_chunk_data_manager.h"
|
||||
|
||||
class TerrainChunk;
|
||||
|
||||
class TerrainWorldChunkDataManagerStaticFolderResources : public TerrainWorldChunkDataManager {
|
||||
GDCLASS(TerrainWorldChunkDataManagerStaticFolderResources, TerrainWorldChunkDataManager);
|
||||
|
||||
public:
|
||||
|
||||
TerrainWorldChunkDataManagerStaticFolderResources();
|
||||
~TerrainWorldChunkDataManagerStaticFolderResources();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int _floor_position;
|
||||
Dictionary _channel_map;
|
||||
};
|
||||
|
||||
#endif
|
@ -18,6 +18,9 @@ def get_doc_classes():
|
||||
"TerrainLevelGenerator",
|
||||
"TerrainLevelGeneratorFlat",
|
||||
|
||||
"TerrainWorldChunkDataManager",
|
||||
"TerrainWorldChunkDataManagerStaticFolderResources",
|
||||
|
||||
"TerrainSurfaceMerger",
|
||||
"TerrainSurfaceSimple",
|
||||
"TerrainSurface",
|
||||
|
118
modules/terraman/doc_classes/TerrainWorldChunkDataManager.xml
Normal file
118
modules/terraman/doc_classes/TerrainWorldChunkDataManager.xml
Normal file
@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="TerrainWorldChunkDataManager" inherits="Resource">
|
||||
<brief_description>
|
||||
</brief_description>
|
||||
<description>
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_delete_all_chunk_data" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_delete_chunk_data" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<argument index="0" name="chunk" type="TerrainChunk" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_delete_chunk_data_at" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<argument index="0" name="chunk_position" type="Vector2i" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_available_chunk_list" qualifiers="virtual">
|
||||
<return type="PoolVector2iArray" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_load_chunk" qualifiers="virtual">
|
||||
<return type="TerrainChunk" />
|
||||
<argument index="0" name="chunk_position" type="Vector2i" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_world_chunk_added" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<argument index="0" name="chunk" type="TerrainChunk" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_world_chunk_created" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<argument index="0" name="chunk" type="TerrainChunk" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_world_chunk_removed" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<argument index="0" name="chunk" type="TerrainChunk" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="delete_all_chunk_data">
|
||||
<return type="void" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="delete_chunk_data">
|
||||
<return type="void" />
|
||||
<argument index="0" name="chunk" type="TerrainChunk" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="delete_chunk_data_at">
|
||||
<return type="void" />
|
||||
<argument index="0" name="chunk_position" type="Vector2i" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_available_chunk_list">
|
||||
<return type="PoolVector2iArray" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="load_all_chunks">
|
||||
<return type="void" />
|
||||
<argument index="0" name="world" type="Node" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="load_chunk">
|
||||
<return type="TerrainChunk" />
|
||||
<argument index="0" name="chunk_position" type="Vector2i" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="load_chunks">
|
||||
<return type="void" />
|
||||
<argument index="0" name="world" type="Node" />
|
||||
<argument index="1" name="chunks" type="PoolVector2iArray" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="on_world_chunk_added">
|
||||
<return type="void" />
|
||||
<argument index="0" name="chunk" type="TerrainChunk" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="on_world_chunk_created">
|
||||
<return type="void" />
|
||||
<argument index="0" name="chunk" type="TerrainChunk" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="on_world_chunk_removed">
|
||||
<return type="void" />
|
||||
<argument index="0" name="chunk" type="TerrainChunk" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<constants>
|
||||
</constants>
|
||||
</class>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="TerrainWorldChunkDataManagerStaticFolderResources" inherits="TerrainWorldChunkDataManager">
|
||||
<brief_description>
|
||||
</brief_description>
|
||||
<description>
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
</methods>
|
||||
<constants>
|
||||
</constants>
|
||||
</class>
|
@ -81,6 +81,9 @@
|
||||
#include "world/jobs/terrain_prop_job.h"
|
||||
#include "world/jobs/terrain_terrain_job.h"
|
||||
|
||||
#include "chunk_data_managers/terrain_world_chunk_data_manager.h"
|
||||
#include "chunk_data_managers/terrain_world_chunk_data_manager_static_folder_resources.h"
|
||||
|
||||
void register_terraman_types(ModuleRegistrationLevel p_level) {
|
||||
if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) {
|
||||
ClassDB::register_class<TerrainMesher>();
|
||||
@ -122,6 +125,9 @@ void register_terraman_types(ModuleRegistrationLevel p_level) {
|
||||
|
||||
ClassDB::register_class<TerrainWorldArea>();
|
||||
|
||||
ClassDB::register_class<TerrainWorldChunkDataManager>();
|
||||
ClassDB::register_class<TerrainWorldChunkDataManagerStaticFolderResources>();
|
||||
|
||||
ClassDB::register_class<TerrainJob>();
|
||||
ClassDB::register_class<TerrainTerrainJob>();
|
||||
ClassDB::register_class<TerrainMesherJobStep>();
|
||||
|
Loading…
Reference in New Issue
Block a user