From 31a5ac8764ef083acb296e42d62b5f7cddee6e05 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 7 Aug 2021 12:31:52 +0200 Subject: [PATCH] Moved the lod_index property from TerraMesherBlocky to TerraMesher. --- meshers/blocky/terra_mesher_blocky.cpp | 12 ------------ meshers/blocky/terra_mesher_blocky.h | 4 ---- meshers/terra_mesher.cpp | 12 ++++++++++++ meshers/terra_mesher.h | 8 ++++++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/meshers/blocky/terra_mesher_blocky.cpp b/meshers/blocky/terra_mesher_blocky.cpp index 0152f0f..029e04a 100644 --- a/meshers/blocky/terra_mesher_blocky.cpp +++ b/meshers/blocky/terra_mesher_blocky.cpp @@ -33,13 +33,6 @@ void TerraMesherBlocky::set_always_add_colors(const bool value) { _always_add_colors = value; } -int TerraMesherBlocky::get_lod_index() const { - return _lod_index; -} -void TerraMesherBlocky::set_lod_index(const int value) { - _lod_index = value; -} - void TerraMesherBlocky::_add_chunk(Ref p_chunk) { Ref chunk = p_chunk; @@ -1226,7 +1219,6 @@ void TerraMesherBlocky::create_face(Ref chunk, int dataxmin, TerraMesherBlocky::TerraMesherBlocky() { _always_add_colors = false; - _lod_index = 0; } TerraMesherBlocky::~TerraMesherBlocky() { @@ -1238,8 +1230,4 @@ void TerraMesherBlocky::_bind_methods() { ClassDB::bind_method(D_METHOD("get_always_add_colors"), &TerraMesherBlocky::get_always_add_colors); ClassDB::bind_method(D_METHOD("set_always_add_colors", "value"), &TerraMesherBlocky::set_always_add_colors); ADD_PROPERTY(PropertyInfo(Variant::INT, "always_add_colors"), "set_always_add_colors", "get_always_add_colors"); - - ClassDB::bind_method(D_METHOD("get_lod_index"), &TerraMesherBlocky::get_lod_index); - ClassDB::bind_method(D_METHOD("set_lod_index", "value"), &TerraMesherBlocky::set_lod_index); - ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_index"), "set_lod_index", "get_lod_index"); } diff --git a/meshers/blocky/terra_mesher_blocky.h b/meshers/blocky/terra_mesher_blocky.h index af32445..a42e0e6 100644 --- a/meshers/blocky/terra_mesher_blocky.h +++ b/meshers/blocky/terra_mesher_blocky.h @@ -44,9 +44,6 @@ public: bool get_always_add_colors() const; void set_always_add_colors(const bool value); - int get_lod_index() const; - void set_lod_index(const int value); - void _add_chunk(Ref p_chunk); void add_chunk_normal(Ref chunk); @@ -67,7 +64,6 @@ protected: private: bool _always_add_colors; - int _lod_index; }; #endif diff --git a/meshers/terra_mesher.cpp b/meshers/terra_mesher.cpp index 9434578..ead1b07 100644 --- a/meshers/terra_mesher.cpp +++ b/meshers/terra_mesher.cpp @@ -112,6 +112,13 @@ void TerraMesher::set_texture_scale(const int value) { _texture_scale = value; } +int TerraMesher::get_lod_index() const { + return _lod_index; +} +void TerraMesher::set_lod_index(const int value) { + _lod_index = value; +} + Ref TerraMesher::get_library() { return _library; } @@ -913,6 +920,7 @@ TerraMesher::TerraMesher() { _channel_index_type = 0; _channel_index_isolevel = 0; _texture_scale = 1; + _lod_index = 0; } TerraMesher::~TerraMesher() { @@ -946,6 +954,10 @@ void TerraMesher::_bind_methods() { ClassDB::bind_method(D_METHOD("set_texture_scale", "value"), &TerraMesher::set_texture_scale); ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_scale"), "set_texture_scale", "get_texture_scale"); + ClassDB::bind_method(D_METHOD("get_lod_index"), &TerraMesher::get_lod_index); + ClassDB::bind_method(D_METHOD("set_lod_index", "value"), &TerraMesher::set_lod_index); + ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_index"), "set_lod_index", "get_lod_index"); + ClassDB::bind_method(D_METHOD("get_library"), &TerraMesher::get_library); ClassDB::bind_method(D_METHOD("set_library", "value"), &TerraMesher::set_library); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "TerramanLibrary"), "set_library", "get_library"); diff --git a/meshers/terra_mesher.h b/meshers/terra_mesher.h index 45b301c..b868f96 100644 --- a/meshers/terra_mesher.h +++ b/meshers/terra_mesher.h @@ -66,7 +66,6 @@ public: const double PI = 3.141592653589793238463; struct Vertex { - Vector3 vertex; Color color; Vector3 normal; // normal, binormal, tangent @@ -110,6 +109,9 @@ public: int get_texture_scale() const; void set_texture_scale(const int value); + int get_lod_index() const; + void set_lod_index(const int value); + Ref get_library(); void set_library(const Ref &library); @@ -146,7 +148,7 @@ public: PoolVector build_collider() const; - void bake_lights(MeshInstance *node, Vector > &lights); + void bake_lights(MeshInstance *node, Vector> &lights); Array build_mesh(); void build_mesh_into(RID mesh); @@ -205,6 +207,8 @@ protected: int _texture_scale; + int _lod_index; + PoolVector _vertices; PoolVector _indices;