Moved the lod_index property from TerraMesherBlocky to TerraMesher.

This commit is contained in:
Relintai 2021-08-07 12:31:52 +02:00
parent f59f817ee6
commit 31a5ac8764
4 changed files with 18 additions and 18 deletions

View File

@ -33,13 +33,6 @@ void TerraMesherBlocky::set_always_add_colors(const bool value) {
_always_add_colors = 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<TerraChunk> p_chunk) { void TerraMesherBlocky::_add_chunk(Ref<TerraChunk> p_chunk) {
Ref<TerraChunkDefault> chunk = p_chunk; Ref<TerraChunkDefault> chunk = p_chunk;
@ -1226,7 +1219,6 @@ void TerraMesherBlocky::create_face(Ref<TerraChunkDefault> chunk, int dataxmin,
TerraMesherBlocky::TerraMesherBlocky() { TerraMesherBlocky::TerraMesherBlocky() {
_always_add_colors = false; _always_add_colors = false;
_lod_index = 0;
} }
TerraMesherBlocky::~TerraMesherBlocky() { 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("get_always_add_colors"), &TerraMesherBlocky::get_always_add_colors);
ClassDB::bind_method(D_METHOD("set_always_add_colors", "value"), &TerraMesherBlocky::set_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"); 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");
} }

View File

@ -44,9 +44,6 @@ public:
bool get_always_add_colors() const; bool get_always_add_colors() const;
void set_always_add_colors(const bool value); void set_always_add_colors(const bool value);
int get_lod_index() const;
void set_lod_index(const int value);
void _add_chunk(Ref<TerraChunk> p_chunk); void _add_chunk(Ref<TerraChunk> p_chunk);
void add_chunk_normal(Ref<TerraChunkDefault> chunk); void add_chunk_normal(Ref<TerraChunkDefault> chunk);
@ -67,7 +64,6 @@ protected:
private: private:
bool _always_add_colors; bool _always_add_colors;
int _lod_index;
}; };
#endif #endif

View File

@ -112,6 +112,13 @@ void TerraMesher::set_texture_scale(const int value) {
_texture_scale = 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<TerramanLibrary> TerraMesher::get_library() { Ref<TerramanLibrary> TerraMesher::get_library() {
return _library; return _library;
} }
@ -913,6 +920,7 @@ TerraMesher::TerraMesher() {
_channel_index_type = 0; _channel_index_type = 0;
_channel_index_isolevel = 0; _channel_index_isolevel = 0;
_texture_scale = 1; _texture_scale = 1;
_lod_index = 0;
} }
TerraMesher::~TerraMesher() { TerraMesher::~TerraMesher() {
@ -946,6 +954,10 @@ void TerraMesher::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_texture_scale", "value"), &TerraMesher::set_texture_scale); 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"); 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("get_library"), &TerraMesher::get_library);
ClassDB::bind_method(D_METHOD("set_library", "value"), &TerraMesher::set_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"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "TerramanLibrary"), "set_library", "get_library");

View File

@ -66,7 +66,6 @@ public:
const double PI = 3.141592653589793238463; const double PI = 3.141592653589793238463;
struct Vertex { struct Vertex {
Vector3 vertex; Vector3 vertex;
Color color; Color color;
Vector3 normal; // normal, binormal, tangent Vector3 normal; // normal, binormal, tangent
@ -110,6 +109,9 @@ public:
int get_texture_scale() const; int get_texture_scale() const;
void set_texture_scale(const int value); void set_texture_scale(const int value);
int get_lod_index() const;
void set_lod_index(const int value);
Ref<TerramanLibrary> get_library(); Ref<TerramanLibrary> get_library();
void set_library(const Ref<TerramanLibrary> &library); void set_library(const Ref<TerramanLibrary> &library);
@ -146,7 +148,7 @@ public:
PoolVector<Vector3> build_collider() const; PoolVector<Vector3> build_collider() const;
void bake_lights(MeshInstance *node, Vector<Ref<TerraLight> > &lights); void bake_lights(MeshInstance *node, Vector<Ref<TerraLight>> &lights);
Array build_mesh(); Array build_mesh();
void build_mesh_into(RID mesh); void build_mesh_into(RID mesh);
@ -205,6 +207,8 @@ protected:
int _texture_scale; int _texture_scale;
int _lod_index;
PoolVector<Vertex> _vertices; PoolVector<Vertex> _vertices;
PoolVector<int> _indices; PoolVector<int> _indices;