Replaced MESH_UTILS_PRESENT defines aswell.

This commit is contained in:
Relintai 2022-10-05 14:35:44 +02:00
parent 50e1108e18
commit 258857332c
29 changed files with 115 additions and 92 deletions

View File

@ -4,9 +4,6 @@ Import('env')
module_env = env.Clone()
if env["module_mesh_utils_enabled"]:
module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT'])
module_env.add_source_files(env.modules_sources,"register_types.cpp")
module_env.add_source_files(env.modules_sources,"mesh_data_resource.cpp")
@ -19,20 +16,21 @@ if 'TOOLS_ENABLED' in env["CPPDEFINES"]:
module_env.add_source_files(env.modules_sources,"plugin_gltf/editor_import_gltf_mdr.cpp")
module_env.add_source_files(env.modules_sources,"plugin_gltf/editor_plugin_gltf_mdr.cpp")
module_env.add_source_files(env.modules_sources,"editor/utilities/mdr_ed_mesh_decompose.cpp")
module_env.add_source_files(env.modules_sources,"editor/utilities/mdr_ed_mesh_outline.cpp")
module_env.add_source_files(env.modules_sources,"editor/utilities/mdr_ed_mesh_utils.cpp")
if env["module_mesh_utils_enabled"]:
module_env.add_source_files(env.modules_sources,"editor/utilities/mdr_ed_mesh_decompose.cpp")
module_env.add_source_files(env.modules_sources,"editor/utilities/mdr_ed_mesh_outline.cpp")
module_env.add_source_files(env.modules_sources,"editor/utilities/mdr_ed_mesh_utils.cpp")
module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_ed_uv_previewer.cpp")
module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_editor.cpp")
module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_view_node.cpp")
module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_editor_popup.cpp")
module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_view.cpp")
module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_ed_uv_previewer.cpp")
module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_editor.cpp")
module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_view_node.cpp")
module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_editor_popup.cpp")
module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_view.cpp")
module_env.add_source_files(env.modules_sources,"editor/mdi_ed_plugin.cpp")
module_env.add_source_files(env.modules_sources,"editor/mdi_ed.cpp")
module_env.add_source_files(env.modules_sources,"editor/mdi_gizmo_plugin.cpp")
module_env.add_source_files(env.modules_sources,"editor/mdi_gizmo.cpp")
module_env.add_source_files(env.modules_sources,"editor/mdi_ed_plugin.cpp")
module_env.add_source_files(env.modules_sources,"editor/mdi_ed.cpp")
module_env.add_source_files(env.modules_sources,"editor/mdi_gizmo_plugin.cpp")
module_env.add_source_files(env.modules_sources,"editor/mdi_gizmo.cpp")
module_env.add_source_files(env.modules_sources,"nodes/mesh_data_instance.cpp")
module_env.add_source_files(env.modules_sources,"nodes/mesh_data_instance_2d.cpp")

View File

@ -27,6 +27,8 @@ SOFTWARE.
#include "scene/resources/mesh.h"
#include "scene/resources/surface_tool.h"
#include "modules/modules_enabled.gen.h"
int MDREDMeshUtils::SeamTriangleHelper::get_other_side_index(int index) const {
if (side_index_1 == index) {
return side_index_2;

View File

@ -30,7 +30,9 @@ SOFTWARE.
#include "scene/resources/shape.h"
#include "scene/resources/sphere_shape.h"
#if MESH_UTILS_PRESENT
#include "modules/modules_enabled.gen.h"
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../mesh_utils/mesh_utils.h"
#endif
@ -41,7 +43,7 @@ SOFTWARE.
const String MDRImportPluginBase::BINDING_MDR_IMPORT_TYPE = "Single,Multiple";
const String MDRImportPluginBase::BINDING_MDR_SURFACE_HANDLING_TYPE = "Only Use First,Create Separate MDRs,Merge";
const String MDRImportPluginBase::BINDING_MDR_OPTIMIZATION_TYPE = "Off"
#if MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
",Remove Doubles,Remove Doubles Interpolate Normals"
#endif
;
@ -50,7 +52,7 @@ void MDRImportPluginBase::get_import_options(List<ImportOption> *r_options, int
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "import_type", PROPERTY_HINT_ENUM, BINDING_MDR_IMPORT_TYPE), MDRImportPluginBase::MDR_IMPORT_TIME_SINGLE));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "surface_handling", PROPERTY_HINT_ENUM, BINDING_MDR_SURFACE_HANDLING_TYPE), MDRImportPluginBase::MDR_SURFACE_HANDLING_TYPE_ONLY_USE_FIRST));
#if MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
//Normal remove doubles should be the default if mesh utils present as it shouldn't visibly change the mesh
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "optimization_type", PROPERTY_HINT_ENUM, BINDING_MDR_OPTIMIZATION_TYPE), MDRImportPluginBase::MDR_OPTIMIZATION_REMOVE_DOUBLES));
#else
@ -128,7 +130,7 @@ int MDRImportPluginBase::get_mesh_count(Node *n) {
}
Error MDRImportPluginBase::process_node_single(Node *n, const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
#if MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
MDRImportPluginBase::MDROptimizationType optimization_type = static_cast<MDRImportPluginBase::MDROptimizationType>(static_cast<int>(p_options["optimization_type"]));
#endif
@ -154,7 +156,7 @@ Error MDRImportPluginBase::process_node_single(Node *n, const String &p_source_f
continue;
}
#if MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
switch (optimization_type) {
case MDR_OPTIMIZATION_OFF:
break;
@ -188,7 +190,7 @@ Error MDRImportPluginBase::process_node_single(Node *n, const String &p_source_f
}
Error MDRImportPluginBase::process_node_single_separated_bones(Node *n, const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
#if MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
MDRImportPluginBase::MDROptimizationType optimization_type = static_cast<MDRImportPluginBase::MDROptimizationType>(static_cast<int>(p_options["optimization_type"]));
#endif
@ -223,7 +225,7 @@ Error MDRImportPluginBase::process_node_single_separated_bones(Node *n, const St
if (!mdr.is_valid())
continue;
#if MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
switch (optimization_type) {
case MDR_OPTIMIZATION_OFF:
break;
@ -273,7 +275,7 @@ Error MDRImportPluginBase::process_node_single_separated_bones(Node *n, const St
}
Error MDRImportPluginBase::process_node_multi(Node *n, const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata, Ref<MeshDataResourceCollection> coll, Ref<MeshDataResourceCollection> copy_coll, int node_count) {
#if MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
MDRImportPluginBase::MDROptimizationType optimization_type = static_cast<MDRImportPluginBase::MDROptimizationType>(static_cast<int>(p_options["optimization_type"]));
#endif
@ -298,7 +300,7 @@ Error MDRImportPluginBase::process_node_multi(Node *n, const String &p_source_fi
continue;
}
#if MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
switch (optimization_type) {
case MDR_OPTIMIZATION_OFF:
break;

View File

@ -39,6 +39,8 @@ SOFTWARE.
#include "scene/3d/mesh_instance.h"
#include "modules/modules_enabled.gen.h"
class MDRImportPluginBase : public EditorImportPlugin {
GDCLASS(MDRImportPluginBase, EditorImportPlugin);
@ -62,7 +64,7 @@ public:
enum MDROptimizationType {
MDR_OPTIMIZATION_OFF = 0,
#if MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
MDR_OPTIMIZATION_REMOVE_DOUBLES,
MDR_OPTIMIZATION_REMOVE_DOUBLES_INTERPOLATE_NORMALS,
#endif

View File

@ -36,9 +36,12 @@ SOFTWARE.
#include "plugin_gltf/editor_plugin_gltf_mdr.h"
#endif
#ifdef MODULE_MESH_UTILS_ENABLED
#include "./editor/mdi_ed_plugin.h"
#endif
#endif
#ifdef MODULE_PROPS_ENABLED
#include "../props/singleton/prop_utils.h"
#include "props/prop_data_mesh_data.h"
@ -69,11 +72,16 @@ void register_mesh_data_resource_types() {
#endif
#ifdef TOOLS_ENABLED
#ifdef MODULE_GLTF_ENABLED
EditorPlugins::add_by_type<EditorPluginGLTFMdr>();
#endif
#ifdef MODULE_MESH_UTILS_ENABLED
EditorPlugins::add_by_type<MDIEdPlugin>();
#endif
#endif
}
void unregister_mesh_data_resource_types() {

View File

@ -6,9 +6,6 @@ module_env = env.Clone()
import version
if os.path.isdir('../mesh_utils'):
module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT'])
sources = [
"register_types.cpp",

View File

@ -22,6 +22,8 @@ SOFTWARE.
#include "prop_mesher_job_step.h"
#include "modules/modules_enabled.gen.h"
const String PropMesherJobStep::BINDING_STRING_PROP_MESHER_JOB_STEP_TYPE = "Normal,Normal LOD,Drop UV2,Merge Verts,Bake Texture,Simplify Mesh";
PropMesherJobStep::PropMesherJobStepType PropMesherJobStep::get_job_type() const {
@ -38,7 +40,7 @@ void PropMesherJobStep::set_lod_index(const int value) {
_lod_index = value;
}
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<FastQuadraticMeshSimplifier> PropMesherJobStep::get_fqms() {
return _fqms;
}
@ -73,7 +75,7 @@ PropMesherJobStep::PropMesherJobStep() {
_job_type = TYPE_NORMAL;
_lod_index = 0;
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
_simplification_step_ratio = 0.8;
_simplification_steps = 2;
_simplification_agressiveness = 7;
@ -81,7 +83,7 @@ PropMesherJobStep::PropMesherJobStep() {
}
PropMesherJobStep::~PropMesherJobStep() {
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
_fqms.unref();
#endif
}
@ -95,7 +97,7 @@ void PropMesherJobStep::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_lod_index", "value"), &PropMesherJobStep::set_lod_index);
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_index"), "set_lod_index", "get_lod_index");
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
ClassDB::bind_method(D_METHOD("get_fqms"), &PropMesherJobStep::get_fqms);
ClassDB::bind_method(D_METHOD("set_fqms", "value"), &PropMesherJobStep::set_fqms);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fqms", PROPERTY_HINT_RESOURCE_TYPE, "FastQuadraticMeshSimplifier"), "set_fqms", "get_fqms");

View File

@ -24,7 +24,9 @@ SOFTWARE.
#include "core/object/reference.h"
#ifdef MESH_UTILS_PRESENT
#include "modules/modules_enabled.gen.h"
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif
@ -54,7 +56,7 @@ public:
int get_lod_index() const;
void set_lod_index(const int value);
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<FastQuadraticMeshSimplifier> get_fqms();
void set_fqms(const Ref<FastQuadraticMeshSimplifier> &val);
@ -77,7 +79,7 @@ protected:
PropMesherJobStepType _job_type;
int _lod_index;
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<FastQuadraticMeshSimplifier> _fqms;
float _simplification_step_ratio;
int _simplification_steps;

View File

@ -39,7 +39,7 @@ SOFTWARE.
#include "../mesh_data_resource/mesh_data_resource.h"
#endif
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif
@ -402,7 +402,7 @@ void PropInstancePropJob::phase_steps() {
++count;
break;
case PropMesherJobStep::TYPE_SIMPLIFY_MESH:
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
count += step->get_simplification_steps();
#endif
break;
@ -559,7 +559,7 @@ void PropInstancePropJob::step_type_bake_texture() {
}
void PropInstancePropJob::step_type_simplify_mesh() {
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<PropMesherJobStep> step = _job_steps[_current_job_step];
ERR_FAIL_COND(!step.is_valid());

View File

@ -9,9 +9,6 @@ import version
if os.path.isdir('../terraman_2d'):
module_env.Append(CPPDEFINES=['TERRAMAN_2D_PRESENT'])
if os.path.isdir('../mesh_utils'):
module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT'])
sources = [
"register_types.cpp",

View File

@ -36,7 +36,7 @@ SOFTWARE.
#include "../mesh_data_resource/mesh_data_resource.h"
#endif
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif

View File

@ -4,9 +4,6 @@ Import('env')
module_env = env.Clone()
if os.path.isdir('../mesh_utils'):
module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT'])
sources = [
"register_types.cpp",

View File

@ -29,6 +29,8 @@ SOFTWARE.
#include "../jobs/terrain_prop_job.h"
#include "../jobs/terrain_terrain_job.h"
#include "modules/modules_enabled.gen.h"
Ref<TerrainChunk> TerrainWorldBlocky::_create_chunk(int x, int z, Ref<TerrainChunk> chunk) {
if (!chunk.is_valid()) {
chunk = Ref<TerrainChunk>(memnew(TerrainChunkBlocky));
@ -90,7 +92,7 @@ Ref<TerrainChunk> TerrainWorldBlocky::_create_chunk(int x, int z, Ref<TerrainChu
s.instance();
s->set_job_type(TerrainMesherJobStep::TYPE_SIMPLIFY_MESH);
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<FastQuadraticMeshSimplifier> fqms;
fqms.instance();
s->set_fqms(fqms);

View File

@ -22,6 +22,8 @@ SOFTWARE.
#include "terrain_mesher_job_step.h"
#include "modules/modules_enabled.gen.h"
const String TerrainMesherJobStep::BINDING_STRING_TERRAIN_TERRAIN_JOB_STEP_TYPE = "Normal,Normal LOD,Drop UV2,Merge Verts,Bake Texture,Simplify Mesh";
TerrainMesherJobStep::TerrainMesherJobStepType TerrainMesherJobStep::get_job_type() const {
@ -38,7 +40,7 @@ void TerrainMesherJobStep::set_lod_index(const int value) {
_lod_index = value;
}
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<FastQuadraticMeshSimplifier> TerrainMesherJobStep::get_fqms() {
return _fqms;
}
@ -73,7 +75,7 @@ TerrainMesherJobStep::TerrainMesherJobStep() {
_job_type = TYPE_NORMAL;
_lod_index = 0;
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
_simplification_step_ratio = 0.8;
_simplification_steps = 2;
_simplification_agressiveness = 7;
@ -81,7 +83,7 @@ TerrainMesherJobStep::TerrainMesherJobStep() {
}
TerrainMesherJobStep::~TerrainMesherJobStep() {
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
_fqms.unref();
#endif
}
@ -95,7 +97,7 @@ void TerrainMesherJobStep::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_lod_index", "value"), &TerrainMesherJobStep::set_lod_index);
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_index"), "set_lod_index", "get_lod_index");
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
ClassDB::bind_method(D_METHOD("get_fqms"), &TerrainMesherJobStep::get_fqms);
ClassDB::bind_method(D_METHOD("set_fqms", "value"), &TerrainMesherJobStep::set_fqms);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fqms", PROPERTY_HINT_RESOURCE_TYPE, "FastQuadraticMeshSimplifier"), "set_fqms", "get_fqms");

View File

@ -24,7 +24,9 @@ SOFTWARE.
#include "core/object/reference.h"
#ifdef MESH_UTILS_PRESENT
#include "modules/modules_enabled.gen.h"
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif
@ -54,7 +56,7 @@ public:
int get_lod_index() const;
void set_lod_index(const int value);
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<FastQuadraticMeshSimplifier> get_fqms();
void set_fqms(const Ref<FastQuadraticMeshSimplifier> &val);
@ -77,7 +79,7 @@ protected:
TerrainMesherJobStepType _job_type;
int _lod_index;
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<FastQuadraticMeshSimplifier> _fqms;
float _simplification_step_ratio;
int _simplification_steps;

View File

@ -42,7 +42,7 @@ SOFTWARE.
#include "../../world/default/terrain_world_default.h"
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif
@ -374,7 +374,7 @@ void TerrainPropJob::phase_steps() {
++count;
break;
case TerrainMesherJobStep::TYPE_SIMPLIFY_MESH:
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
count += step->get_simplification_steps();
#endif
break;
@ -561,7 +561,7 @@ void TerrainPropJob::step_type_bake_texture() {
}
void TerrainPropJob::step_type_simplify_mesh() {
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<TerrainChunkDefault> chunk = _chunk;
Ref<TerrainMesherJobStep> step = _job_steps[_current_job_step];

View File

@ -32,7 +32,9 @@ SOFTWARE.
#include "../default/terrain_chunk_default.h"
#include "servers/physics_server.h"
#ifdef MESH_UTILS_PRESENT
#include "modules/modules_enabled.gen.h"
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif
@ -306,7 +308,7 @@ void TerrainTerrainJob::phase_terrain_mesh() {
++count;
break;
case TerrainMesherJobStep::TYPE_SIMPLIFY_MESH:
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
count += step->get_simplification_steps();
#endif
break;
@ -633,7 +635,7 @@ void TerrainTerrainJob::step_type_bake_texture() {
}
void TerrainTerrainJob::step_type_simplify_mesh() {
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<TerrainChunkDefault> chunk = _chunk;
Ref<TerrainMesherJobStep> step = _job_steps[_current_job_step];

View File

@ -4,9 +4,6 @@ Import('env')
module_env = env.Clone()
if os.path.isdir('../mesh_utils'):
module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT'])
sources = [
"register_types.cpp",

View File

@ -40,7 +40,7 @@ SOFTWARE.
#include "../../world/default/terrain_2d_world_default.h"
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif

View File

@ -32,7 +32,9 @@ SOFTWARE.
#include "../default/terrain_2d_chunk_default.h"
#include "servers/physics_2d_server.h"
#ifdef MESH_UTILS_PRESENT
#include "modules/modules_enabled.gen.h"
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif

View File

@ -7,9 +7,6 @@ module_env = env.Clone()
if os.path.isdir('../props'):
module_env.Append(CPPDEFINES=['PROPS_PRESENT'])
if os.path.isdir('../mesh_utils'):
module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT'])
sources = [
"register_types.cpp",

View File

@ -31,7 +31,7 @@ SOFTWARE.
#include "../jobs/voxel_prop_job.h"
#include "../jobs/voxel_terrain_job.h"
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif
@ -64,7 +64,7 @@ Ref<VoxelChunk> VoxelWorldBlocky::_create_chunk(int x, int y, int z, Ref<VoxelCh
s->set_job_type(VoxelMesherJobStep::TYPE_BAKE_TEXTURE);
tj->add_jobs_step(s);
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
s.instance();
Ref<FastQuadraticMeshSimplifier> fqms;
fqms.instance();
@ -97,7 +97,7 @@ Ref<VoxelChunk> VoxelWorldBlocky::_create_chunk(int x, int y, int z, Ref<VoxelCh
s.instance();
s->set_job_type(VoxelMesherJobStep::TYPE_SIMPLIFY_MESH);
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
fqms.instance();
s->set_fqms(fqms);
s->set_simplification_steps(2);

View File

@ -29,7 +29,9 @@ SOFTWARE.
#include "../jobs/voxel_prop_job.h"
#include "../jobs/voxel_terrain_job.h"
#ifdef MESH_UTILS_PRESENT
#include "modules/modules_enabled.gen.h"
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif
@ -62,7 +64,7 @@ Ref<VoxelChunk> VoxelWorldCubic::_create_chunk(int x, int y, int z, Ref<VoxelChu
s->set_job_type(VoxelMesherJobStep::TYPE_BAKE_TEXTURE);
tj->add_jobs_step(s);
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
s.instance();
Ref<FastQuadraticMeshSimplifier> fqms;
fqms.instance();
@ -98,7 +100,7 @@ Ref<VoxelChunk> VoxelWorldCubic::_create_chunk(int x, int y, int z, Ref<VoxelChu
s.instance();
s->set_job_type(VoxelMesherJobStep::TYPE_SIMPLIFY_MESH);
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
fqms.instance();
s->set_fqms(fqms);
s->set_simplification_steps(2);

View File

@ -31,7 +31,9 @@ SOFTWARE.
#include "../jobs/voxel_prop_job.h"
#include "../jobs/voxel_terrain_job.h"
#ifdef MESH_UTILS_PRESENT
#include "modules/modules_enabled.gen.h"
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif
@ -212,7 +214,7 @@ Ref<VoxelChunk> VoxelWorldDefault::_create_chunk(int x, int y, int z, Ref<VoxelC
s->set_job_type(VoxelMesherJobStep::TYPE_BAKE_TEXTURE);
tj->add_jobs_step(s);
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
s.instance();
Ref<FastQuadraticMeshSimplifier> fqms;
fqms.instance();
@ -245,7 +247,7 @@ Ref<VoxelChunk> VoxelWorldDefault::_create_chunk(int x, int y, int z, Ref<VoxelC
s.instance();
s->set_job_type(VoxelMesherJobStep::TYPE_SIMPLIFY_MESH);
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
fqms.instance();
s->set_fqms(fqms);
s->set_simplification_steps(2);

View File

@ -22,6 +22,8 @@ SOFTWARE.
#include "voxel_mesher_job_step.h"
#include "modules/modules_enabled.gen.h"
const String VoxelMesherJobStep::BINDING_STRING_TERRAIN_TERRAIN_JOB_STEP_TYPE = "Normal,Normal LOD,Drop UV2,Merge Verts,Bake Texture,Simplify Mesh";
VoxelMesherJobStep::VoxelMesherJobStepType VoxelMesherJobStep::get_job_type() const {
@ -38,7 +40,7 @@ void VoxelMesherJobStep::set_lod_index(const int value) {
_lod_index = value;
}
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<FastQuadraticMeshSimplifier> VoxelMesherJobStep::get_fqms() {
return _fqms;
}
@ -73,7 +75,7 @@ VoxelMesherJobStep::VoxelMesherJobStep() {
_job_type = TYPE_NORMAL;
_lod_index = 0;
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
_simplification_step_ratio = 0.8;
_simplification_steps = 2;
_simplification_agressiveness = 7;
@ -81,7 +83,7 @@ VoxelMesherJobStep::VoxelMesherJobStep() {
}
VoxelMesherJobStep::~VoxelMesherJobStep() {
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
_fqms.unref();
#endif
}
@ -95,7 +97,7 @@ void VoxelMesherJobStep::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_lod_index", "value"), &VoxelMesherJobStep::set_lod_index);
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_index"), "set_lod_index", "get_lod_index");
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
ClassDB::bind_method(D_METHOD("get_fqms"), &VoxelMesherJobStep::get_fqms);
ClassDB::bind_method(D_METHOD("set_fqms", "value"), &VoxelMesherJobStep::set_fqms);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fqms", PROPERTY_HINT_RESOURCE_TYPE, "FastQuadraticMeshSimplifier"), "set_fqms", "get_fqms");

View File

@ -24,7 +24,9 @@ SOFTWARE.
#include "core/object/reference.h"
#ifdef MESH_UTILS_PRESENT
#include "modules/modules_enabled.gen.h"
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif
@ -54,7 +56,7 @@ public:
int get_lod_index() const;
void set_lod_index(const int value);
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<FastQuadraticMeshSimplifier> get_fqms();
void set_fqms(const Ref<FastQuadraticMeshSimplifier> &val);
@ -77,7 +79,7 @@ protected:
VoxelMesherJobStepType _job_type;
int _lod_index;
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<FastQuadraticMeshSimplifier> _fqms;
float _simplification_step_ratio;
int _simplification_steps;

View File

@ -43,7 +43,7 @@ SOFTWARE.
#include "../../world/default/voxel_world_default.h"
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif
@ -375,7 +375,7 @@ void VoxelPropJob::phase_steps() {
++count;
break;
case VoxelMesherJobStep::TYPE_SIMPLIFY_MESH:
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
count += step->get_simplification_steps();
#endif
break;
@ -562,7 +562,7 @@ void VoxelPropJob::step_type_bake_texture() {
}
void VoxelPropJob::step_type_simplify_mesh() {
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<VoxelChunkDefault> chunk = _chunk;
Ref<VoxelMesherJobStep> step = _job_steps[_current_job_step];

View File

@ -32,7 +32,9 @@ SOFTWARE.
#include "../default/voxel_chunk_default.h"
#include "servers/physics_server.h"
#ifdef MESH_UTILS_PRESENT
#include "modules/modules_enabled.gen.h"
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif
@ -474,7 +476,7 @@ void VoxelTerrainJob::phase_terrain_mesh() {
++count;
break;
case VoxelMesherJobStep::TYPE_SIMPLIFY_MESH:
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
count += step->get_simplification_steps();
#endif
break;
@ -841,7 +843,7 @@ void VoxelTerrainJob::step_type_bake_texture() {
}
void VoxelTerrainJob::step_type_simplify_mesh() {
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
Ref<VoxelChunkDefault> chunk = _chunk;
Ref<VoxelMesherJobStep> step = _job_steps[_current_job_step];

View File

@ -29,7 +29,9 @@ SOFTWARE.
#include "../jobs/voxel_prop_job.h"
#include "../jobs/voxel_terrain_job.h"
#ifdef MESH_UTILS_PRESENT
#include "modules/modules_enabled.gen.h"
#ifdef MODULE_MESH_UTILS_ENABLED
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
#endif
@ -62,7 +64,7 @@ Ref<VoxelChunk> VoxelWorldMarchingCubes::_create_chunk(int x, int y, int z, Ref<
s->set_job_type(VoxelMesherJobStep::TYPE_BAKE_TEXTURE);
tj->add_jobs_step(s);
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
s.instance();
Ref<FastQuadraticMeshSimplifier> fqms;
fqms.instance();
@ -99,7 +101,7 @@ Ref<VoxelChunk> VoxelWorldMarchingCubes::_create_chunk(int x, int y, int z, Ref<
s.instance();
s->set_job_type(VoxelMesherJobStep::TYPE_SIMPLIFY_MESH);
#ifdef MESH_UTILS_PRESENT
#ifdef MODULE_MESH_UTILS_ENABLED
fqms.instance();
s->set_fqms(fqms);
s->set_simplification_steps(2);