diff --git a/README.md b/README.md index d80fa91..f71af55 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ This will generate your terrain collider and mesh (with lods) for you, using the Your lod setup is easily customizable with [TerraMesherJobSteps](https://github.com/Relintai/terraman/blob/master/world/jobs/voxel_mesher_job_step.h). The setup happens in your selected world's `_create_chunk` method. -### TerraPropJob +### TerraProp2DJob This will generate your prop meshes (with lods). diff --git a/SCsub b/SCsub index e1a637a..56a9e86 100644 --- a/SCsub +++ b/SCsub @@ -15,8 +15,8 @@ if os.path.isdir('../thread_pool'): if os.path.isdir('../mesh_data_resource'): module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT']) -if os.path.isdir('../props'): - module_env.Append(CPPDEFINES=['PROPS_PRESENT']) +if os.path.isdir('../props_2d'): + module_env.Append(CPPDEFINES=['PROPS_2D_PRESENT']) if os.path.isdir('../mesh_utils'): module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT']) @@ -79,7 +79,7 @@ if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes': # Shared lib compilation module_env.Append(CCFLAGS=['-fPIC']) module_env['LIBS'] = [] - shared_lib = module_env.SharedLibrary(target='#bin/terraman', source=sources) + shared_lib = module_env.SharedLibrary(target='#bin/terraman_2d', source=sources) shared_lib_shim = shared_lib[0].name.rsplit('.', 1)[0] env.Append(LIBS=[shared_lib_shim]) env.Append(LIBPATH=['#bin']) diff --git a/config.py b/config.py index a6bceb0..9d49fe2 100644 --- a/config.py +++ b/config.py @@ -62,7 +62,7 @@ def get_doc_classes(): "Terrain2DJob", "Terrain2DTerrain2DJob", "Terrain2DLightJob", - "Terrain2DPropJob", + "Terrain2DProp2DJob", "Terrain2DEnvironmentData", "Terrain2DMesherJobStep", diff --git a/doc_classes/TerrainChunk.xml b/doc_classes/TerrainChunk.xml index b4d8244..a9e1702 100644 --- a/doc_classes/TerrainChunk.xml +++ b/doc_classes/TerrainChunk.xml @@ -531,12 +531,12 @@ - + - + diff --git a/doc_classes/TerrainLibrary.xml b/doc_classes/TerrainLibrary.xml index 2b016af..62f545b 100644 --- a/doc_classes/TerrainLibrary.xml +++ b/doc_classes/TerrainLibrary.xml @@ -193,12 +193,12 @@ - + - + @@ -210,7 +210,7 @@ - + @@ -282,7 +282,7 @@ - + diff --git a/doc_classes/TerrainMaterialCache.xml b/doc_classes/TerrainMaterialCache.xml index 43104e0..c85fc69 100644 --- a/doc_classes/TerrainMaterialCache.xml +++ b/doc_classes/TerrainMaterialCache.xml @@ -118,13 +118,13 @@ - + - + diff --git a/doc_classes/TerrainPropJob.xml b/doc_classes/TerrainPropJob.xml index fcc0f7e..e62b53c 100644 --- a/doc_classes/TerrainPropJob.xml +++ b/doc_classes/TerrainPropJob.xml @@ -1,5 +1,5 @@ - + diff --git a/doc_classes/TerrainWorld.xml b/doc_classes/TerrainWorld.xml index 1697248..3261785 100644 --- a/doc_classes/TerrainWorld.xml +++ b/doc_classes/TerrainWorld.xml @@ -255,7 +255,7 @@ - + diff --git a/library/terrain_2d_library.cpp b/library/terrain_2d_library.cpp index c9d0cc2..f0d4ef6 100644 --- a/library/terrain_2d_library.cpp +++ b/library/terrain_2d_library.cpp @@ -26,8 +26,8 @@ SOFTWARE. #include "terrain_2d_material_cache.h" -#ifdef PROPS_PRESENT -#include "../../props/props/prop_data.h" +#ifdef PROPS_2D_PRESENT +#include "../../props_2d/props/prop_2d_data.h" #endif #include "scene/resources/packed_scene.h" @@ -319,7 +319,7 @@ void Terrain2DLibrary::liquid_materials_set(const Vector &materials) { } } -//Prop Materials +//Prop2D Materials Ref Terrain2DLibrary::prop_material_get(const int index) { ERR_FAIL_INDEX_V(index, _prop_materials.size(), Ref()); @@ -424,16 +424,16 @@ int Terrain2DLibrary::scene_get_num() const { void Terrain2DLibrary::scenes_clear() { } -#ifdef PROPS_PRESENT -Ref Terrain2DLibrary::prop_get(const int id) { - return Ref(); +#ifdef PROPS_2D_PRESENT +Ref Terrain2DLibrary::prop_get(const int id) { + return Ref(); } -void Terrain2DLibrary::prop_add(Ref value) { +void Terrain2DLibrary::prop_add(Ref value) { } -bool Terrain2DLibrary::prop_has(const Ref &value) const { +bool Terrain2DLibrary::prop_has(const Ref &value) const { return false; } -void Terrain2DLibrary::prop_set(int id, Ref value) { +void Terrain2DLibrary::prop_set(int id, Ref value) { } void Terrain2DLibrary::prop_remove(const int id) { } @@ -607,7 +607,7 @@ void Terrain2DLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("scene_get_num"), &Terrain2DLibrary::scene_get_num); ClassDB::bind_method(D_METHOD("scenes_clear"), &Terrain2DLibrary::scenes_clear); -#ifdef PROPS_PRESENT +#ifdef PROPS_2D_PRESENT ClassDB::bind_method(D_METHOD("prop_get", "id"), &Terrain2DLibrary::prop_get); ClassDB::bind_method(D_METHOD("prop_add", "value"), &Terrain2DLibrary::prop_add); ClassDB::bind_method(D_METHOD("prop_has", "prop"), &Terrain2DLibrary::prop_has); diff --git a/library/terrain_2d_library.h b/library/terrain_2d_library.h index c52a17e..aa2b092 100644 --- a/library/terrain_2d_library.h +++ b/library/terrain_2d_library.h @@ -67,8 +67,8 @@ class Terrain2DSurface; class Terrain2DMesher; class PackedScene; class Terrain2DChunk; -#ifdef PROPS_PRESENT -class PropData; +#ifdef PROPS_2D_PRESENT +class Prop2DData; #endif class Terrain2DLibrary : public Resource { @@ -159,11 +159,11 @@ public: virtual int scene_get_num() const; virtual void scenes_clear(); -#ifdef PROPS_PRESENT - virtual Ref prop_get(const int id); - virtual void prop_add(Ref value); - virtual bool prop_has(const Ref &value) const; - virtual void prop_set(const int id, Ref value); +#ifdef PROPS_2D_PRESENT + virtual Ref prop_get(const int id); + virtual void prop_add(Ref value); + virtual bool prop_has(const Ref &value) const; + virtual void prop_set(const int id, Ref value); virtual void prop_remove(const int id); virtual int prop_get_num() const; virtual void props_clear(); diff --git a/library/terrain_2d_library_merger.cpp b/library/terrain_2d_library_merger.cpp index 2ae2b01..b34bbb4 100644 --- a/library/terrain_2d_library_merger.cpp +++ b/library/terrain_2d_library_merger.cpp @@ -25,13 +25,13 @@ SOFTWARE. #include "scene/resources/packed_scene.h" #include "scene/resources/texture.h" -#ifdef PROPS_PRESENT -#include "../../props/props/prop_data.h" +#ifdef PROPS_2D_PRESENT +#include "../../props_2d/props/prop_2d_data.h" -#include "../../props/props/prop_data_prop.h" +#include "../../props_2d/props/prop_2d_data_prop.h" #if MESH_DATA_RESOURCE_PRESENT -#include "../../mesh_data_resource/props/prop_data_mesh_data.h" +#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h" #endif #endif @@ -151,19 +151,19 @@ void Terrain2DLibraryMerger::set_terra_surfaces(const Vector &surfaces) } } -#ifdef PROPS_PRESENT -Ref Terrain2DLibraryMerger::get_prop(const int index) { - ERR_FAIL_INDEX_V(index, _props.size(), Ref()); +#ifdef PROPS_2D_PRESENT +Ref Terrain2DLibraryMerger::get_prop(const int index) { + ERR_FAIL_INDEX_V(index, _props.size(), Ref()); return _props[index]; } -void Terrain2DLibraryMerger::add_prop(Ref value) { +void Terrain2DLibraryMerger::add_prop(Ref value) { _props.push_back(value); } -bool Terrain2DLibraryMerger::has_prop(const Ref &value) const { +bool Terrain2DLibraryMerger::has_prop(const Ref &value) const { return _props.find(value) != -1; } -void Terrain2DLibraryMerger::set_prop(const int index, const Ref &value) { +void Terrain2DLibraryMerger::set_prop(const int index, const Ref &value) { ERR_FAIL_INDEX(index, _props.size()); _props.write[index] = value; @@ -185,7 +185,7 @@ Vector Terrain2DLibraryMerger::get_props() { } void Terrain2DLibraryMerger::set_props(const Vector &props) { - VARIANT_ARRAY_SET(props, _props, PropData); + VARIANT_ARRAY_SET(props, _props, Prop2DData); } Rect2 Terrain2DLibraryMerger::get_prop_uv_rect(const Ref &texture) { @@ -260,11 +260,11 @@ void Terrain2DLibraryMerger::refresh_rects() { setup_material_albedo(MATERIAL_INDEX_LIQUID, tex); } -#ifdef PROPS_PRESENT +#ifdef PROPS_2D_PRESENT //todo add this back //texture_added = false; for (int i = 0; i < _props.size(); i++) { - Ref prop = _props.get(i); + Ref prop = _props.get(i); if (prop.is_valid()) { if (process_prop_textures(prop)) @@ -408,8 +408,8 @@ Terrain2DLibraryMerger::~Terrain2DLibraryMerger() { _prop_packer.unref(); } -#ifdef PROPS_PRESENT -bool Terrain2DLibraryMerger::process_prop_textures(Ref prop) { +#ifdef PROPS_2D_PRESENT +bool Terrain2DLibraryMerger::process_prop_textures(Ref prop) { if (!prop.is_valid()) { return false; } @@ -418,7 +418,7 @@ bool Terrain2DLibraryMerger::process_prop_textures(Ref prop) { for (int i = 0; i < prop->get_prop_count(); ++i) { #if MESH_DATA_RESOURCE_PRESENT - Ref pdm = prop->get_prop(i); + Ref pdm = prop->get_prop(i); if (pdm.is_valid()) { Ref tex = pdm->get_texture(); @@ -433,7 +433,7 @@ bool Terrain2DLibraryMerger::process_prop_textures(Ref prop) { } #endif - Ref pdp = prop->get_prop(i); + Ref pdp = prop->get_prop(i); if (pdp.is_valid()) { if (process_prop_textures(pdp)) @@ -470,10 +470,10 @@ void Terrain2DLibraryMerger::_bind_methods() { ClassDB::bind_method(D_METHOD("set_terra_surfaces"), &Terrain2DLibraryMerger::set_terra_surfaces); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "17/17:Terrain2DSurfaceMerger", PROPERTY_USAGE_DEFAULT, "Terrain2DSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces"); -#ifdef PROPS_PRESENT +#ifdef PROPS_2D_PRESENT ClassDB::bind_method(D_METHOD("get_props"), &Terrain2DLibraryMerger::get_props); ClassDB::bind_method(D_METHOD("set_props"), &Terrain2DLibraryMerger::set_props); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "17/17:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "17/17:Prop2DData", PROPERTY_USAGE_DEFAULT, "Prop2DData"), "set_props", "get_props"); ClassDB::bind_method(D_METHOD("get_prop_uv_rect", "texture"), &Terrain2DLibraryMerger::get_prop_uv_rect); diff --git a/library/terrain_2d_library_merger.h b/library/terrain_2d_library_merger.h index 8d14fb4..8e9bdd6 100644 --- a/library/terrain_2d_library_merger.h +++ b/library/terrain_2d_library_merger.h @@ -73,11 +73,11 @@ public: Vector get_terra_surfaces(); void set_terra_surfaces(const Vector &surfaces); -#ifdef PROPS_PRESENT - Ref get_prop(const int index); - void add_prop(Ref value); - bool has_prop(const Ref &value) const; - void set_prop(const int index, const Ref &value); +#ifdef PROPS_2D_PRESENT + Ref get_prop(const int index); + void add_prop(Ref value); + bool has_prop(const Ref &value) const; + void set_prop(const int index, const Ref &value); void remove_prop(const int index); int get_num_props() const; void clear_props(); @@ -98,15 +98,15 @@ public: ~Terrain2DLibraryMerger(); protected: -#ifdef PROPS_PRESENT - bool process_prop_textures(Ref prop); +#ifdef PROPS_2D_PRESENT + bool process_prop_textures(Ref prop); #endif static void _bind_methods(); Vector > _terra_surfaces; -#ifdef PROPS_PRESENT - Vector > _props; +#ifdef PROPS_2D_PRESENT + Vector > _props; #endif Ref _packer; diff --git a/library/terrain_2d_library_merger_pcm.cpp b/library/terrain_2d_library_merger_pcm.cpp index ac83c7c..91a0508 100644 --- a/library/terrain_2d_library_merger_pcm.cpp +++ b/library/terrain_2d_library_merger_pcm.cpp @@ -26,13 +26,13 @@ SOFTWARE. #include "scene/resources/packed_scene.h" #include "scene/resources/texture.h" -#ifdef PROPS_PRESENT -#include "../../props/props/prop_data.h" +#ifdef PROPS_2D_PRESENT +#include "../../props_2d/props/prop_2d_data.h" -#include "../../props/props/prop_data_prop.h" +#include "../../props_2d/props/prop_2d_data_prop.h" #if MESH_DATA_RESOURCE_PRESENT -#include "../../mesh_data_resource/props/prop_data_mesh_data.h" +#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h" #endif #endif @@ -242,14 +242,14 @@ void Terrain2DLibraryMergerPCM::_prop_material_cache_get_key(Ref Vector props; /* - #ifdef PROPS_PRESENT + #ifdef PROPS_2D_PRESENT for (int i = 0; i < chunk->prop_get_count(); ++i) { - Ref prop = chunk->prop_get(i); + Ref prop = chunk->prop_get(i); ERR_CONTINUE(!prop.is_valid()); //get pointer's value as uint64 - uint64_t v = make_uint64_t(*prop); + uint64_t v = make_uint64_t(*prop); int psize = props.size(); bool found = false; @@ -351,9 +351,9 @@ void Terrain2DLibraryMergerPCM::_prop_material_cache_get_key(Ref } /* - #ifdef PROPS_PRESENT + #ifdef PROPS_2D_PRESENT for (int i = 0; i < chunk->prop_get_count(); ++i) { - Ref prop = chunk->prop_get(i); + Ref prop = chunk->prop_get(i); ERR_CONTINUE(!prop.is_valid()); @@ -539,19 +539,19 @@ void Terrain2DLibraryMergerPCM::set_terra_surfaces(const Vector &surfac } } -#ifdef PROPS_PRESENT -Ref Terrain2DLibraryMergerPCM::get_prop(const int index) { - ERR_FAIL_INDEX_V(index, _props.size(), Ref()); +#ifdef PROPS_2D_PRESENT +Ref Terrain2DLibraryMergerPCM::get_prop(const int index) { + ERR_FAIL_INDEX_V(index, _props.size(), Ref()); return _props[index]; } -void Terrain2DLibraryMergerPCM::add_prop(Ref value) { +void Terrain2DLibraryMergerPCM::add_prop(Ref value) { _props.push_back(value); } -bool Terrain2DLibraryMergerPCM::has_prop(const Ref &value) const { +bool Terrain2DLibraryMergerPCM::has_prop(const Ref &value) const { return _props.find(value) != -1; } -void Terrain2DLibraryMergerPCM::set_prop(const int index, const Ref &value) { +void Terrain2DLibraryMergerPCM::set_prop(const int index, const Ref &value) { ERR_FAIL_INDEX(index, _props.size()); _props.write[index] = value; @@ -573,7 +573,7 @@ Vector Terrain2DLibraryMergerPCM::get_props() { } void Terrain2DLibraryMergerPCM::set_props(const Vector &props) { - VARIANT_ARRAY_SET(props, _props, PropData); + VARIANT_ARRAY_SET(props, _props, Prop2DData); } Rect2 Terrain2DLibraryMergerPCM::get_prop_uv_rect(const Ref &texture) { @@ -648,11 +648,11 @@ void Terrain2DLibraryMergerPCM::refresh_rects() { setup_material_albedo(MATERIAL_INDEX_LIQUID, tex); } -#ifdef PROPS_PRESENT +#ifdef PROPS_2D_PRESENT //todo add this back //texture_added = false; for (int i = 0; i < _props.size(); i++) { - Ref prop = _props.get(i); + Ref prop = _props.get(i); if (prop.is_valid()) { if (process_prop_textures(prop)) @@ -796,8 +796,8 @@ Terrain2DLibraryMergerPCM::~Terrain2DLibraryMergerPCM() { _prop_packer.unref(); } -#ifdef PROPS_PRESENT -bool Terrain2DLibraryMergerPCM::process_prop_textures(Ref prop) { +#ifdef PROPS_2D_PRESENT +bool Terrain2DLibraryMergerPCM::process_prop_textures(Ref prop) { if (!prop.is_valid()) { return false; } @@ -805,7 +805,7 @@ bool Terrain2DLibraryMergerPCM::process_prop_textures(Ref prop) { bool texture_added = false; for (int i = 0; i < prop->get_prop_count(); ++i) { - Ref pdm = prop->get_prop(i); + Ref pdm = prop->get_prop(i); if (pdm.is_valid()) { Ref tex = pdm->get_texture(); @@ -819,7 +819,7 @@ bool Terrain2DLibraryMergerPCM::process_prop_textures(Ref prop) { } } - Ref pdp = prop->get_prop(i); + Ref pdp = prop->get_prop(i); if (pdp.is_valid()) { if (process_prop_textures(pdp)) @@ -856,10 +856,10 @@ void Terrain2DLibraryMergerPCM::_bind_methods() { ClassDB::bind_method(D_METHOD("set_terra_surfaces"), &Terrain2DLibraryMergerPCM::set_terra_surfaces); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "17/17:Terrain2DSurfaceMerger", PROPERTY_USAGE_DEFAULT, "Terrain2DSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces"); -#ifdef PROPS_PRESENT +#ifdef PROPS_2D_PRESENT ClassDB::bind_method(D_METHOD("get_props"), &Terrain2DLibraryMergerPCM::get_props); ClassDB::bind_method(D_METHOD("set_props"), &Terrain2DLibraryMergerPCM::set_props); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "17/17:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "17/17:Prop2DData", PROPERTY_USAGE_DEFAULT, "Prop2DData"), "set_props", "get_props"); ClassDB::bind_method(D_METHOD("get_prop_uv_rect", "texture"), &Terrain2DLibraryMergerPCM::get_prop_uv_rect); diff --git a/library/terrain_2d_library_merger_pcm.h b/library/terrain_2d_library_merger_pcm.h index d5ae8e4..cff8c87 100644 --- a/library/terrain_2d_library_merger_pcm.h +++ b/library/terrain_2d_library_merger_pcm.h @@ -88,11 +88,11 @@ public: Vector get_terra_surfaces(); void set_terra_surfaces(const Vector &surfaces); -#ifdef PROPS_PRESENT - Ref get_prop(const int index); - void add_prop(Ref value); - bool has_prop(const Ref &value) const; - void set_prop(const int index, const Ref &value); +#ifdef PROPS_2D_PRESENT + Ref get_prop(const int index); + void add_prop(Ref value); + bool has_prop(const Ref &value) const; + void set_prop(const int index, const Ref &value); void remove_prop(const int index); int get_num_props() const; void clear_props(); @@ -113,8 +113,8 @@ public: ~Terrain2DLibraryMergerPCM(); protected: -#ifdef PROPS_PRESENT - bool process_prop_textures(Ref prop); +#ifdef PROPS_2D_PRESENT + bool process_prop_textures(Ref prop); #endif static void _bind_methods(); @@ -123,8 +123,8 @@ protected: Map > _prop_material_cache; Vector > _terra_surfaces; -#ifdef PROPS_PRESENT - Vector > _props; +#ifdef PROPS_2D_PRESENT + Vector > _props; #endif //todo remove these diff --git a/library/terrain_2d_material_cache.cpp b/library/terrain_2d_material_cache.cpp index 1018ac6..e07d9a0 100644 --- a/library/terrain_2d_material_cache.cpp +++ b/library/terrain_2d_material_cache.cpp @@ -24,12 +24,12 @@ SOFTWARE. #include "../defines.h" -#ifdef PROPS_PRESENT -#include "../../props/props/prop_data.h" -#include "../../props/props/prop_data_prop.h" +#ifdef PROPS_2D_PRESENT +#include "../../props_2d/props/prop_2d_data.h" +#include "../../props_2d/props/prop_2d_data_prop.h" #if MESH_DATA_RESOURCE_PRESENT -#include "../../mesh_data_resource/props/prop_data_mesh_data.h" +#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h" #endif #endif @@ -196,15 +196,15 @@ Rect2 Terrain2DMaterialCache::additional_texture_get_uv_rect(const Ref return Rect2(0, 0, 1, 1); } -#ifdef PROPS_PRESENT -void Terrain2DMaterialCache::prop_add_textures(const Ref &prop) { +#ifdef PROPS_2D_PRESENT +void Terrain2DMaterialCache::prop_add_textures(const Ref &prop) { if (!prop.is_valid()) { return; } for (int i = 0; i < prop->get_prop_count(); ++i) { #if MESH_DATA_RESOURCE_PRESENT - Ref pdm = prop->get_prop(i); + Ref pdm = prop->get_prop(i); if (pdm.is_valid()) { Ref tex = pdm->get_texture(); @@ -216,21 +216,21 @@ void Terrain2DMaterialCache::prop_add_textures(const Ref &prop) { } #endif - Ref pdp = prop->get_prop(i); + Ref pdp = prop->get_prop(i); if (pdp.is_valid()) { prop_add_textures(pdp); } } } -void Terrain2DMaterialCache::prop_remove_textures(const Ref &prop) { +void Terrain2DMaterialCache::prop_remove_textures(const Ref &prop) { if (!prop.is_valid()) { return; } for (int i = 0; i < prop->get_prop_count(); ++i) { #if MESH_DATA_RESOURCE_PRESENT - Ref pdm = prop->get_prop(i); + Ref pdm = prop->get_prop(i); if (pdm.is_valid()) { Ref tex = pdm->get_texture(); @@ -242,7 +242,7 @@ void Terrain2DMaterialCache::prop_remove_textures(const Ref &prop) { } #endif - Ref pdp = prop->get_prop(i); + Ref pdp = prop->get_prop(i); if (pdp.is_valid()) { prop_remove_textures(pdp); @@ -323,7 +323,7 @@ void Terrain2DMaterialCache::_bind_methods() { ClassDB::bind_method(D_METHOD("additional_texture_get_atlas_tex", "index"), &Terrain2DMaterialCache::additional_texture_get_atlas_tex); ClassDB::bind_method(D_METHOD("additional_texture_get_uv_rect", "texture"), &Terrain2DMaterialCache::additional_texture_get_uv_rect); -#ifdef PROPS_PRESENT +#ifdef PROPS_2D_PRESENT ClassDB::bind_method(D_METHOD("prop_add_textures", "prop"), &Terrain2DMaterialCache::prop_add_textures); ClassDB::bind_method(D_METHOD("prop_remove_textures", "prop"), &Terrain2DMaterialCache::prop_remove_textures); #endif diff --git a/library/terrain_2d_material_cache.h b/library/terrain_2d_material_cache.h index a60b7ab..d1a14a7 100644 --- a/library/terrain_2d_material_cache.h +++ b/library/terrain_2d_material_cache.h @@ -85,9 +85,9 @@ public: virtual Ref additional_texture_get_atlas_tex(const Ref &texture); virtual Rect2 additional_texture_get_uv_rect(const Ref &texture); -#ifdef PROPS_PRESENT - void prop_add_textures(const Ref &prop); - void prop_remove_textures(const Ref &prop); +#ifdef PROPS_2D_PRESENT + void prop_add_textures(const Ref &prop); + void prop_remove_textures(const Ref &prop); #endif virtual void refresh_rects(); diff --git a/library/terrain_2d_material_cache_pcm.h b/library/terrain_2d_material_cache_pcm.h index a17b528..cd385bd 100644 --- a/library/terrain_2d_material_cache_pcm.h +++ b/library/terrain_2d_material_cache_pcm.h @@ -44,7 +44,7 @@ SOFTWARE. class Terrain2DSurface; class TexturePacker; -class PropData; +class Prop2DData; class Terrain2DMaterialCachePCM : public Terrain2DMaterialCache { GDCLASS(Terrain2DMaterialCachePCM, Terrain2DMaterialCache); diff --git a/nodes/terrain_2d_light_node.h b/nodes/terrain_2d_light_node.h index 8088d27..6752881 100644 --- a/nodes/terrain_2d_light_node.h +++ b/nodes/terrain_2d_light_node.h @@ -37,7 +37,7 @@ SOFTWARE. class Terrain2DLightNode : public Spatial { GDCLASS(Terrain2DLightNode, Spatial); - OBJ_CATEGORY("Props"); + OBJ_CATEGORY("Prop2Ds"); public: //make it turn into a normal light if voxelman isn't present? diff --git a/register_types.cpp b/register_types.cpp index 9b53d34..655ee3b 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -112,7 +112,7 @@ void register_terraman_2d_types() { ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); #ifdef TOOLS_ENABLED EditorPlugins::add_by_type(); diff --git a/thirdparty/lz4/lz4.c b/thirdparty/lz4/lz4.c index 82ab490..7646f90 100644 --- a/thirdparty/lz4/lz4.c +++ b/thirdparty/lz4/lz4.c @@ -1888,7 +1888,7 @@ LZ4_decompress_generic( } /* The second stage didn't work out, but the info is ready. - * Propel it right to the point of match copying. */ + * Prop2Del it right to the point of match copying. */ goto _copy_match; } diff --git a/world/blocky/terrain_2d_world_blocky.cpp b/world/blocky/terrain_2d_world_blocky.cpp index 21bbe6a..f794121 100644 --- a/world/blocky/terrain_2d_world_blocky.cpp +++ b/world/blocky/terrain_2d_world_blocky.cpp @@ -72,7 +72,7 @@ Ref Terrain2DWorldBlocky::_create_chunk(int x, int z, Refset_channel_index_isolevel(Terrain2DChunkDefault::DEFAULT_CHANNEL_LIQUID_ISOLEVEL); tj->set_liquid_mesher(liquid_mesher); - Ref pj; + Ref pj; pj.instance(); pj->set_prop_mesher(Ref(memnew(Terrain2DMesherBlocky))); diff --git a/world/default/terrain_2d_world_default.cpp b/world/default/terrain_2d_world_default.cpp index 5d8c147..f5b65d7 100644 --- a/world/default/terrain_2d_world_default.cpp +++ b/world/default/terrain_2d_world_default.cpp @@ -187,7 +187,7 @@ Ref Terrain2DWorldDefault::_create_chunk(int x, int z, Ref lj; lj.instance(); - Ref pj; + Ref pj; pj.instance(); pj->set_prop_mesher(Ref(memnew(Terrain2DMesherDefault))); diff --git a/world/jobs/terrain_2d_prop_job.cpp b/world/jobs/terrain_2d_prop_job.cpp index b3c6e86..a2e2816 100644 --- a/world/jobs/terrain_2d_prop_job.cpp +++ b/world/jobs/terrain_2d_prop_job.cpp @@ -42,36 +42,36 @@ SOFTWARE. #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif -Ref Terrain2DPropJob::get_prop_mesher() const { +Ref Terrain2DProp2DJob::get_prop_mesher() const { return _prop_mesher; } -void Terrain2DPropJob::set_prop_mesher(const Ref &mesher) { +void Terrain2DProp2DJob::set_prop_mesher(const Ref &mesher) { _prop_mesher = mesher; } -Ref Terrain2DPropJob::get_jobs_step(int index) const { +Ref Terrain2DProp2DJob::get_jobs_step(int index) const { ERR_FAIL_INDEX_V(index, _job_steps.size(), Ref()); return _job_steps.get(index); } -void Terrain2DPropJob::set_jobs_step(int index, const Ref &step) { +void Terrain2DProp2DJob::set_jobs_step(int index, const Ref &step) { ERR_FAIL_INDEX(index, _job_steps.size()); _job_steps.set(index, step); } -void Terrain2DPropJob::remove_jobs_step(const int index) { +void Terrain2DProp2DJob::remove_jobs_step(const int index) { ERR_FAIL_INDEX(index, _job_steps.size()); _job_steps.remove(index); } -void Terrain2DPropJob::add_jobs_step(const Ref &step) { +void Terrain2DProp2DJob::add_jobs_step(const Ref &step) { _job_steps.push_back(step); } -int Terrain2DPropJob::get_jobs_step_count() const { +int Terrain2DProp2DJob::get_jobs_step_count() const { return _job_steps.size(); } -void Terrain2DPropJob::phase_physics_process() { +void Terrain2DProp2DJob::phase_physics_process() { Ref chunk = _chunk; //TODO this should only update the differences @@ -129,7 +129,7 @@ void Terrain2DPropJob::phase_physics_process() { next_phase(); } -void Terrain2DPropJob::phase_prop() { +void Terrain2DProp2DJob::phase_prop() { #ifdef MESH_DATA_RESOURCE_PRESENT Ref chunk = _chunk; @@ -216,12 +216,12 @@ void Terrain2DPropJob::phase_prop() { next_phase(); } -void Terrain2DPropJob::_physics_process(float delta) { +void Terrain2DProp2DJob::_physics_process(float delta) { if (_phase == 0) phase_physics_process(); } -void Terrain2DPropJob::_execute_phase() { +void Terrain2DProp2DJob::_execute_phase() { ERR_FAIL_COND(!_chunk.is_valid()); Ref library = _chunk->get_library(); @@ -249,11 +249,11 @@ void Terrain2DPropJob::_execute_phase() { } else if (_phase > 3) { set_complete(true); //So threadpool knows it's done next_job(); - ERR_FAIL_MSG("Terrain2DPropJob: _phase is too high!"); + ERR_FAIL_MSG("Terrain2DProp2DJob: _phase is too high!"); } } -void Terrain2DPropJob::_reset() { +void Terrain2DProp2DJob::_reset() { Terrain2DJob::_reset(); _build_done = false; @@ -270,7 +270,7 @@ void Terrain2DPropJob::_reset() { set_build_phase_type(BUILD_PHASE_TYPE_PHYSICS_PROCESS); } -void Terrain2DPropJob::phase_setup() { +void Terrain2DProp2DJob::phase_setup() { Ref library = _chunk->get_library(); if (!library->supports_caching()) { @@ -319,7 +319,7 @@ void Terrain2DPropJob::phase_setup() { } } -void Terrain2DPropJob::phase_steps() { +void Terrain2DProp2DJob::phase_steps() { Ref chunk = _chunk; ERR_FAIL_COND(!_prop_mesher.is_valid()); @@ -441,7 +441,7 @@ void Terrain2DPropJob::phase_steps() { next_job(); } -void Terrain2DPropJob::step_type_normal() { +void Terrain2DProp2DJob::step_type_normal() { //TODO add a lighting generation step Ref chunk = _chunk; @@ -467,13 +467,13 @@ void Terrain2DPropJob::step_type_normal() { ++_current_mesh; } -void Terrain2DPropJob::step_type_normal_lod() { - print_error("Error: step_type_normal_lod doesn't work for Terrain2DPropJobs!"); +void Terrain2DProp2DJob::step_type_normal_lod() { + print_error("Error: step_type_normal_lod doesn't work for Terrain2DProp2DJobs!"); ++_current_mesh; } -void Terrain2DPropJob::step_type_drop_uv2() { +void Terrain2DProp2DJob::step_type_drop_uv2() { Ref chunk = _chunk; RID mesh_rid = chunk->mesh_rid_get_index(Terrain2DChunkDefault::MESH_INDEX_PROP, Terrain2DChunkDefault::MESH_TYPE_INDEX_MESH, _current_mesh); @@ -497,7 +497,7 @@ void Terrain2DPropJob::step_type_drop_uv2() { ++_current_mesh; } -void Terrain2DPropJob::step_type_merge_verts() { +void Terrain2DProp2DJob::step_type_merge_verts() { Array temp_mesh_arr2 = merge_mesh_array(temp_mesh_arr); temp_mesh_arr = temp_mesh_arr2; @@ -521,7 +521,7 @@ void Terrain2DPropJob::step_type_merge_verts() { ++_current_mesh; } -void Terrain2DPropJob::step_type_bake_texture() { +void Terrain2DProp2DJob::step_type_bake_texture() { Ref chunk = _chunk; Ref mat = chunk->get_library()->material_lod_get(0); @@ -558,7 +558,7 @@ void Terrain2DPropJob::step_type_bake_texture() { ++_current_mesh; } -void Terrain2DPropJob::step_type_simplify_mesh() { +void Terrain2DProp2DJob::step_type_simplify_mesh() { #ifdef MESH_UTILS_PRESENT Ref chunk = _chunk; @@ -595,26 +595,26 @@ void Terrain2DPropJob::step_type_simplify_mesh() { #endif } -Terrain2DPropJob::Terrain2DPropJob() { +Terrain2DProp2DJob::Terrain2DProp2DJob() { set_build_phase_type(BUILD_PHASE_TYPE_PHYSICS_PROCESS); _current_job_step = 0; _current_mesh = 0; } -Terrain2DPropJob::~Terrain2DPropJob() { +Terrain2DProp2DJob::~Terrain2DProp2DJob() { } -void Terrain2DPropJob::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_prop_mesher"), &Terrain2DPropJob::get_prop_mesher); - ClassDB::bind_method(D_METHOD("set_prop_mesher", "mesher"), &Terrain2DPropJob::set_prop_mesher); +void Terrain2DProp2DJob::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_prop_mesher"), &Terrain2DProp2DJob::get_prop_mesher); + ClassDB::bind_method(D_METHOD("set_prop_mesher", "mesher"), &Terrain2DProp2DJob::set_prop_mesher); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop_mesher", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DMesher", 0), "set_prop_mesher", "get_prop_mesher"); - ClassDB::bind_method(D_METHOD("get_jobs_step", "index"), &Terrain2DPropJob::get_jobs_step); - ClassDB::bind_method(D_METHOD("set_jobs_step", "index", "mesher"), &Terrain2DPropJob::set_jobs_step); - ClassDB::bind_method(D_METHOD("remove_jobs_step", "index"), &Terrain2DPropJob::remove_jobs_step); - ClassDB::bind_method(D_METHOD("add_jobs_step", "mesher"), &Terrain2DPropJob::add_jobs_step); - ClassDB::bind_method(D_METHOD("get_jobs_step_count"), &Terrain2DPropJob::get_jobs_step_count); + ClassDB::bind_method(D_METHOD("get_jobs_step", "index"), &Terrain2DProp2DJob::get_jobs_step); + ClassDB::bind_method(D_METHOD("set_jobs_step", "index", "mesher"), &Terrain2DProp2DJob::set_jobs_step); + ClassDB::bind_method(D_METHOD("remove_jobs_step", "index"), &Terrain2DProp2DJob::remove_jobs_step); + ClassDB::bind_method(D_METHOD("add_jobs_step", "mesher"), &Terrain2DProp2DJob::add_jobs_step); + ClassDB::bind_method(D_METHOD("get_jobs_step_count"), &Terrain2DProp2DJob::get_jobs_step_count); - ClassDB::bind_method(D_METHOD("_physics_process", "delta"), &Terrain2DPropJob::_physics_process); + ClassDB::bind_method(D_METHOD("_physics_process", "delta"), &Terrain2DProp2DJob::_physics_process); } diff --git a/world/jobs/terrain_2d_prop_job.h b/world/jobs/terrain_2d_prop_job.h index e053953..64ac275 100644 --- a/world/jobs/terrain_2d_prop_job.h +++ b/world/jobs/terrain_2d_prop_job.h @@ -29,8 +29,8 @@ SOFTWARE. class Terrain2DMesher; -class Terrain2DPropJob : public Terrain2DJob { - GDCLASS(Terrain2DPropJob, Terrain2DJob); +class Terrain2DProp2DJob : public Terrain2DJob { + GDCLASS(Terrain2DProp2DJob, Terrain2DJob); public: Ref get_prop_mesher() const; @@ -60,8 +60,8 @@ public: void step_type_bake_texture(); void step_type_simplify_mesh(); - Terrain2DPropJob(); - ~Terrain2DPropJob(); + Terrain2DProp2DJob(); + ~Terrain2DProp2DJob(); protected: static void _bind_methods(); diff --git a/world/terrain_2d_chunk.cpp b/world/terrain_2d_chunk.cpp index 261db99..a144b74 100644 --- a/world/terrain_2d_chunk.cpp +++ b/world/terrain_2d_chunk.cpp @@ -719,18 +719,18 @@ void Terrain2DChunk::clear_baked_lights() { call("_clear_baked_lights"); } -#if PROPS_PRESENT -void Terrain2DChunk::prop_add(const Transform &tarnsform, const Ref &prop) { +#if PROPS_2D_PRESENT +void Terrain2DChunk::prop_add(const Transform &tarnsform, const Ref &prop) { ERR_FAIL_COND(!prop.is_valid()); - PropDataStore s; + Prop2DDataStore s; s.transform = tarnsform; s.prop = prop; _props.push_back(s); } -Ref Terrain2DChunk::prop_get(int index) { - ERR_FAIL_INDEX_V(index, _props.size(), Ref()); +Ref Terrain2DChunk::prop_get(int index) { + ERR_FAIL_INDEX_V(index, _props.size(), Ref()); return _props.get(index).prop; } @@ -775,7 +775,7 @@ int Terrain2DChunk::mesh_data_resource_addv(const Vector3 &local_data_pos, const AABB mesh_aabb = e.transform.xform(mesh->get_aabb()); e.is_inside = aabb.encloses(mesh_aabb); -#if PROPS_PRESENT +#if PROPS_2D_PRESENT if (get_library().is_valid() && texture.is_valid()) { e.uv_rect = get_library()->get_prop_uv_rect(texture); } else { @@ -815,7 +815,7 @@ int Terrain2DChunk::mesh_data_resource_add(const Transform &local_transform, con AABB mesh_aabb = e.transform.xform(mesh->get_aabb()); e.is_inside = aabb.encloses(mesh_aabb); -#if PROPS_PRESENT +#if PROPS_2D_PRESENT if (get_library().is_valid() && texture.is_valid()) e.uv_rect = get_library()->get_prop_uv_rect(texture); else @@ -1113,7 +1113,7 @@ Terrain2DChunk::~Terrain2DChunk() { _library.unref(); } -#if PROPS_PRESENT +#if PROPS_2D_PRESENT props_clear(); #endif @@ -1490,7 +1490,7 @@ void Terrain2DChunk::_bind_methods() { //Meshes -#if PROPS_PRESENT +#if PROPS_2D_PRESENT ClassDB::bind_method(D_METHOD("prop_add", "prop"), &Terrain2DChunk::prop_add); ClassDB::bind_method(D_METHOD("prop_get", "index"), &Terrain2DChunk::prop_get); ClassDB::bind_method(D_METHOD("prop_get_count"), &Terrain2DChunk::prop_get_count); diff --git a/world/terrain_2d_chunk.h b/world/terrain_2d_chunk.h index 9ab25be..da06fdb 100644 --- a/world/terrain_2d_chunk.h +++ b/world/terrain_2d_chunk.h @@ -54,8 +54,8 @@ include_pool_vector #include "../meshers/terrain_2d_mesher.h" -#if PROPS_PRESENT -#include "../../props/props/prop_data.h" +#if PROPS_2D_PRESENT +#include "../../props_2d/props/prop_2d_data.h" #endif #include "core/version.h" @@ -233,9 +233,9 @@ public: void bake_light(Ref light); void clear_baked_lights(); -#if PROPS_PRESENT - void prop_add(const Transform &tarnsform, const Ref &prop); - Ref prop_get(const int index); +#if PROPS_2D_PRESENT + void prop_add(const Transform &tarnsform, const Ref &prop); + Ref prop_get(const int index); Transform prop_get_tarnsform(const int index); int prop_get_count() const; void prop_remove(const int index); @@ -319,10 +319,10 @@ protected: virtual void _generation_physics_process(const float delta); protected: -#if PROPS_PRESENT - struct PropDataStore { +#if PROPS_2D_PRESENT + struct Prop2DDataStore { Transform transform; - Ref prop; + Ref prop; }; #endif @@ -401,8 +401,8 @@ protected: Vector> _voxel_structures; -#if PROPS_PRESENT - Vector _props; +#if PROPS_2D_PRESENT + Vector _props; #endif #if MESH_DATA_RESOURCE_PRESENT diff --git a/world/terrain_2d_world.cpp b/world/terrain_2d_world.cpp index 3a92dd2..3ea2816 100644 --- a/world/terrain_2d_world.cpp +++ b/world/terrain_2d_world.cpp @@ -30,16 +30,16 @@ SOFTWARE. #include "../defines.h" -#if PROPS_PRESENT -#include "../../props/props/prop_data.h" -#include "../../props/props/prop_data_entry.h" -#include "../../props/props/prop_data_light.h" -#include "../../props/props/prop_data_prop.h" -#include "../../props/props/prop_data_scene.h" +#if PROPS_2D_PRESENT +#include "../../props_2d/props/prop_2d_data.h" +#include "../../props_2d/props/prop_2d_data_entry.h" +#include "../../props_2d/props/prop_2d_data_light.h" +#include "../../props_2d/props/prop_2d_data_prop.h" +#include "../../props_2d/props/prop_2d_data_scene.h" #endif #if MESH_DATA_RESOURCE_PRESENT -#include "../../mesh_data_resource/props/prop_data_mesh_data.h" +#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h" #endif #if TOOLS_ENABLED @@ -586,8 +586,8 @@ int Terrain2DWorld::generation_get_size() const { return _generating.size(); } -#if PROPS_PRESENT -void Terrain2DWorld::prop_add(Transform transform, const Ref &prop, const bool apply_voxel_scale) { +#if PROPS_2D_PRESENT +void Terrain2DWorld::prop_add(Transform transform, const Ref &prop, const bool apply_voxel_scale) { ERR_FAIL_COND(!prop.is_valid()); if (apply_voxel_scale) { @@ -602,7 +602,7 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref &prop, co int count = prop->get_prop_count(); for (int i = 0; i < count; ++i) { - Ref entry = prop->get_prop(i); + Ref entry = prop->get_prop(i); if (!entry.is_valid()) continue; @@ -612,10 +612,10 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref &prop, co wp = t.xform(Vector3()); chunk = get_or_create_chunk_at_world_position(wp); - Ref prop_entry_data = entry; + Ref prop_entry_data = entry; if (prop_entry_data.is_valid()) { - Ref p = prop_entry_data->get_prop(); + Ref p = prop_entry_data->get_prop(); if (!p.is_valid()) continue; @@ -625,7 +625,7 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref &prop, co continue; } - Ref scene_data = entry; + Ref scene_data = entry; if (scene_data.is_valid()) { Ref sc = scene_data->get_scene(); @@ -646,7 +646,7 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref &prop, co continue; } - Ref light_data = entry; + Ref light_data = entry; if (light_data.is_valid()) { Ref light; @@ -662,7 +662,7 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref &prop, co } #if MESH_DATA_RESOURCE_PRESENT - Ref mesh_data = entry; + Ref mesh_data = entry; if (mesh_data.is_valid()) { Ref mdr = mesh_data->get_mesh(); @@ -1219,7 +1219,7 @@ void Terrain2DWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("is_position_walkable", "position"), &Terrain2DWorld::is_position_walkable); ClassDB::bind_method(D_METHOD("on_chunk_mesh_generation_finished", "chunk"), &Terrain2DWorld::on_chunk_mesh_generation_finished); -#if PROPS_PRESENT +#if PROPS_2D_PRESENT ClassDB::bind_method(D_METHOD("prop_add", "transform", "prop", "apply_voxel_scale"), &Terrain2DWorld::prop_add, DEFVAL(true)); #endif diff --git a/world/terrain_2d_world.h b/world/terrain_2d_world.h index 16693fd..39c4fbc 100644 --- a/world/terrain_2d_world.h +++ b/world/terrain_2d_world.h @@ -43,13 +43,13 @@ SOFTWARE. #include "core/os/os.h" -#if PROPS_PRESENT -#include "../../props/props/prop_data.h" +#if PROPS_2D_PRESENT +#include "../../props_2d/props/prop_2d_data.h" #endif class Terrain2DStructure; class Terrain2DChunk; -class PropData; +class Prop2DData; class Terrain2DWorld : public Navigation { GDCLASS(Terrain2DWorld, Navigation); @@ -169,8 +169,8 @@ public: void generation_remove_index(const int index); int generation_get_size() const; -#if PROPS_PRESENT - void prop_add(Transform transform, const Ref &prop, const bool apply_voxel_scale = true); +#if PROPS_2D_PRESENT + void prop_add(Transform transform, const Ref &prop, const bool apply_voxel_scale = true); #endif //Lights