mirror of
https://github.com/Relintai/terraman.git
synced 2025-04-23 21:43:23 +02:00
Added simplify mesh type, and an other type to the new class. Also added a bunch of properties for the simplification type if mesh utils is present.
This commit is contained in:
parent
c63fe5238a
commit
de40b5e130
@ -22,7 +22,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "terra_mesher_job_step.h"
|
#include "terra_mesher_job_step.h"
|
||||||
|
|
||||||
const String TerraMesherJobStep::BINDING_STRING_TERRA_TERRARIN_JOB_STEP_TYPE = "Normal,Drop UV2,Merge Verts,Bake Texture";
|
const String TerraMesherJobStep::BINDING_STRING_TERRA_TERRARIN_JOB_STEP_TYPE = "Normal,Drop UV2,Merge Verts,Bake Texture,Simplify Mesh";
|
||||||
|
|
||||||
TerraMesherJobStep::TerraMesherJobStepType TerraMesherJobStep::get_job_type() const {
|
TerraMesherJobStep::TerraMesherJobStepType TerraMesherJobStep::get_job_type() const {
|
||||||
return _job_type;
|
return _job_type;
|
||||||
@ -38,12 +38,38 @@ void TerraMesherJobStep::set_lod_index(const int value) {
|
|||||||
_lod_index = value;
|
_lod_index = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MESH_UTILS_PRESENT
|
||||||
|
Ref<FastQuadraticMeshSimplifier> TerraMesherJobStep::get_fqms() {
|
||||||
|
return _fqms;
|
||||||
|
}
|
||||||
|
void TerraMesherJobStep::set_fqms(const Ref<FastQuadraticMeshSimplifier> &val) {
|
||||||
|
_fqms = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
float TerraMesherJobStep::get_simplification_step_ratio() const {
|
||||||
|
return _simplification_step_ratio;
|
||||||
|
}
|
||||||
|
void TerraMesherJobStep::set_simplification_step_ratio(const float value) {
|
||||||
|
_simplification_step_ratio = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TerraMesherJobStep::get_simplification_steps() const {
|
||||||
|
return _simplification_steps;
|
||||||
|
}
|
||||||
|
void TerraMesherJobStep::set_simplification_steps(const float value) {
|
||||||
|
_simplification_steps = value;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TerraMesherJobStep::TerraMesherJobStep() {
|
TerraMesherJobStep::TerraMesherJobStep() {
|
||||||
_job_type = TYPE_NORMAL;
|
_job_type = TYPE_NORMAL;
|
||||||
_lod_index = 0;
|
_lod_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TerraMesherJobStep::~TerraMesherJobStep() {
|
TerraMesherJobStep::~TerraMesherJobStep() {
|
||||||
|
#ifdef MESH_UTILS_PRESENT
|
||||||
|
_fqms.unref();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerraMesherJobStep::_bind_methods() {
|
void TerraMesherJobStep::_bind_methods() {
|
||||||
@ -55,8 +81,24 @@ void TerraMesherJobStep::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_lod_index", "value"), &TerraMesherJobStep::set_lod_index);
|
ClassDB::bind_method(D_METHOD("set_lod_index", "value"), &TerraMesherJobStep::set_lod_index);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_index"), "set_lod_index", "get_lod_index");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_index"), "set_lod_index", "get_lod_index");
|
||||||
|
|
||||||
|
#ifdef MESH_UTILS_PRESENT
|
||||||
|
ClassDB::bind_method(D_METHOD("get_fqms"), &TerraMesherJobStep::get_fqms);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_fqms", "value"), &TerraMesherJobStep::set_fqms);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fqms", PROPERTY_HINT_RESOURCE_TYPE, "FastQuadraticMeshSimplifier"), "set_fqms", "get_fqms");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_simplification_step_ratio"), &TerraMesherJobStep::get_simplification_step_ratio);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_simplification_step_ratio", "value"), &TerraMesherJobStep::set_simplification_step_ratio);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "simplification_step_ratio"), "set_simplification_step_ratio", "get_simplification_step_ratio");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_simplification_steps"), &TerraMesherJobStep::get_simplification_steps);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_simplification_steps", "value"), &TerraMesherJobStep::set_simplification_steps);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "simplification_steps"), "set_simplification_steps", "get_simplification_steps");
|
||||||
|
#endif
|
||||||
|
|
||||||
BIND_ENUM_CONSTANT(TYPE_NORMAL);
|
BIND_ENUM_CONSTANT(TYPE_NORMAL);
|
||||||
BIND_ENUM_CONSTANT(TYPE_DROP_UV2);
|
BIND_ENUM_CONSTANT(TYPE_DROP_UV2);
|
||||||
BIND_ENUM_CONSTANT(TYPE_MERGE_VERTS);
|
BIND_ENUM_CONSTANT(TYPE_MERGE_VERTS);
|
||||||
BIND_ENUM_CONSTANT(TYPE_BAKE_TEXTURE);
|
BIND_ENUM_CONSTANT(TYPE_BAKE_TEXTURE);
|
||||||
|
BIND_ENUM_CONSTANT(TYPE_SIMPLIFY_MESH);
|
||||||
|
BIND_ENUM_CONSTANT(TYPE_OTHER);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,10 @@ SOFTWARE.
|
|||||||
#include "core/reference.h"
|
#include "core/reference.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MESH_UTILS_PRESENT
|
||||||
|
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class TerraMesherJobStep : public Reference {
|
class TerraMesherJobStep : public Reference {
|
||||||
GDCLASS(TerraMesherJobStep, Reference);
|
GDCLASS(TerraMesherJobStep, Reference);
|
||||||
|
|
||||||
@ -40,6 +44,8 @@ public:
|
|||||||
TYPE_DROP_UV2,
|
TYPE_DROP_UV2,
|
||||||
TYPE_MERGE_VERTS,
|
TYPE_MERGE_VERTS,
|
||||||
TYPE_BAKE_TEXTURE,
|
TYPE_BAKE_TEXTURE,
|
||||||
|
TYPE_SIMPLIFY_MESH,
|
||||||
|
TYPE_OTHER,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const String BINDING_STRING_TERRA_TERRARIN_JOB_STEP_TYPE;
|
static const String BINDING_STRING_TERRA_TERRARIN_JOB_STEP_TYPE;
|
||||||
@ -50,6 +56,17 @@ public:
|
|||||||
int get_lod_index() const;
|
int get_lod_index() const;
|
||||||
void set_lod_index(const int value);
|
void set_lod_index(const int value);
|
||||||
|
|
||||||
|
#ifdef MESH_UTILS_PRESENT
|
||||||
|
Ref<FastQuadraticMeshSimplifier> get_fqms();
|
||||||
|
void set_fqms(const Ref<FastQuadraticMeshSimplifier> &val);
|
||||||
|
|
||||||
|
float get_simplification_step_ratio() const;
|
||||||
|
void set_simplification_step_ratio(const float value);
|
||||||
|
|
||||||
|
int get_simplification_steps() const;
|
||||||
|
void set_simplification_steps(const float value);
|
||||||
|
#endif
|
||||||
|
|
||||||
TerraMesherJobStep();
|
TerraMesherJobStep();
|
||||||
~TerraMesherJobStep();
|
~TerraMesherJobStep();
|
||||||
|
|
||||||
@ -58,6 +75,12 @@ protected:
|
|||||||
|
|
||||||
TerraMesherJobStepType _job_type;
|
TerraMesherJobStepType _job_type;
|
||||||
int _lod_index;
|
int _lod_index;
|
||||||
|
|
||||||
|
#ifdef MESH_UTILS_PRESENT
|
||||||
|
Ref<FastQuadraticMeshSimplifier> _fqms;
|
||||||
|
float _simplification_step_ratio;
|
||||||
|
int _simplification_steps;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(TerraMesherJobStep::TerraMesherJobStepType);
|
VARIANT_ENUM_CAST(TerraMesherJobStep::TerraMesherJobStepType);
|
||||||
|
Loading…
Reference in New Issue
Block a user