From 7d7d7ef16d49db3c3fdf354540a9bd24df8557c7 Mon Sep 17 00:00:00 2001 From: JFonS Date: Wed, 30 Dec 2020 15:36:39 +0100 Subject: [PATCH] CPU lightmapper formatting and minor fixes. --- core/math/geometry.cpp | 1 + modules/denoise/denoise_wrapper.cpp | 2 -- modules/denoise/lightmap_denoiser.cpp | 1 + modules/denoise/register_types.cpp | 1 + modules/lightmapper_cpu/SCsub | 1 + modules/lightmapper_cpu/lightmapper_cpu.cpp | 1 + modules/lightmapper_cpu/lightmapper_cpu.h | 1 + modules/lightmapper_cpu/register_types.cpp | 1 - modules/raycast/SCsub | 4 ++-- modules/raycast/lightmap_raycaster.cpp | 6 ++++-- modules/raycast/lightmap_raycaster.h | 3 ++- modules/raycast/register_types.cpp | 1 + scene/3d/baked_lightmap.cpp | 3 +++ scene/resources/mesh.cpp | 3 +-- thirdparty/README.md | 3 +++ 15 files changed, 22 insertions(+), 10 deletions(-) diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp index 83f7f67dd88..096bee73ceb 100644 --- a/core/math/geometry.cpp +++ b/core/math/geometry.cpp @@ -31,6 +31,7 @@ #include "geometry.h" #include "core/print_string.h" + #include "thirdparty/misc/clipper.hpp" #include "thirdparty/misc/triangulator.h" #define STB_RECT_PACK_IMPLEMENTATION diff --git a/modules/denoise/denoise_wrapper.cpp b/modules/denoise/denoise_wrapper.cpp index a52ac735a62..cc0d52d46f0 100644 --- a/modules/denoise/denoise_wrapper.cpp +++ b/modules/denoise/denoise_wrapper.cpp @@ -48,8 +48,6 @@ bool oidn_denoise(void *deviceptr, float *p_floats, int p_width, int p_height) { oidnSetSharedFilterImage(filter, "color", input_buffer, OIDN_FORMAT_FLOAT3, p_width, p_height, 0, 0, 0); oidnSetSharedFilterImage(filter, "output", (void *)p_floats, OIDN_FORMAT_FLOAT3, p_width, p_height, 0, 0, 0); oidnSetFilter1b(filter, "hdr", true); - //oidnSetFilter1f(filter, "hdrScale", 1.0f); - //oidnSetFilter1i(filter, "verbose", 4); oidnCommitFilter(filter); oidnExecuteFilter(filter); diff --git a/modules/denoise/lightmap_denoiser.cpp b/modules/denoise/lightmap_denoiser.cpp index 7726e0dc065..6978f2a8470 100644 --- a/modules/denoise/lightmap_denoiser.cpp +++ b/modules/denoise/lightmap_denoiser.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "lightmap_denoiser.h" + #include "denoise_wrapper.h" LightmapDenoiser *LightmapDenoiserOIDN::create_oidn_denoiser() { diff --git a/modules/denoise/register_types.cpp b/modules/denoise/register_types.cpp index b78734a5318..c9c90c3408d 100644 --- a/modules/denoise/register_types.cpp +++ b/modules/denoise/register_types.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "register_types.h" + #include "core/engine.h" #include "lightmap_denoiser.h" diff --git a/modules/lightmapper_cpu/SCsub b/modules/lightmapper_cpu/SCsub index 4fbb1b6b1dd..e27beafe3df 100644 --- a/modules/lightmapper_cpu/SCsub +++ b/modules/lightmapper_cpu/SCsub @@ -5,4 +5,5 @@ Import("env_modules") env_lightmapper_rd = env_modules.Clone() # Godot source files +env_lightmapper_rd.Prepend(CPPPATH=["#thirdparty/embree/include"]) env_lightmapper_rd.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/lightmapper_cpu/lightmapper_cpu.cpp b/modules/lightmapper_cpu/lightmapper_cpu.cpp index 375d20976e1..a4965216237 100644 --- a/modules/lightmapper_cpu/lightmapper_cpu.cpp +++ b/modules/lightmapper_cpu/lightmapper_cpu.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "lightmapper_cpu.h" + #include "core/math/geometry.h" #include "core/os/os.h" #include "core/os/threaded_array_processor.h" diff --git a/modules/lightmapper_cpu/lightmapper_cpu.h b/modules/lightmapper_cpu/lightmapper_cpu.h index e809240099b..f090ccdc2fe 100644 --- a/modules/lightmapper_cpu/lightmapper_cpu.h +++ b/modules/lightmapper_cpu/lightmapper_cpu.h @@ -35,6 +35,7 @@ #include "scene/3d/lightmapper.h" #include "scene/resources/mesh.h" #include "scene/resources/surface_tool.h" + #include class LightmapperCPU : public Lightmapper { diff --git a/modules/lightmapper_cpu/register_types.cpp b/modules/lightmapper_cpu/register_types.cpp index ccf443669f0..bd56763e85a 100644 --- a/modules/lightmapper_cpu/register_types.cpp +++ b/modules/lightmapper_cpu/register_types.cpp @@ -46,7 +46,6 @@ void register_lightmapper_cpu_types() { GLOBAL_DEF("rendering/cpu_lightmapper/quality/high_quality_ray_count", 512); GLOBAL_DEF("rendering/cpu_lightmapper/quality/ultra_quality_ray_count", 1024); #ifndef _3D_DISABLED - ClassDB::register_class(); Lightmapper::create_cpu = create_lightmapper_cpu; #endif } diff --git a/modules/raycast/SCsub b/modules/raycast/SCsub index 8c0f81ea033..84ab1335881 100644 --- a/modules/raycast/SCsub +++ b/modules/raycast/SCsub @@ -62,7 +62,7 @@ embree_dir = "#thirdparty/embree/" env_embree = env_modules.Clone() embree_sources = [embree_dir + file for file in embree_src] -env_embree.Prepend(CPPPATH=[embree_dir, embree_dir + "include/embree3"]) +env_embree.Prepend(CPPPATH=[embree_dir, embree_dir + "include"]) env_embree.Append( CPPFLAGS=[ "-DEMBREE_TARGET_SSE2", @@ -88,6 +88,6 @@ env_embree.disable_warnings() env_embree.add_source_files(env.modules_sources, embree_sources) env_raycast = env_modules.Clone() -env_raycast.Prepend(CPPPATH=[embree_dir, embree_dir + "include/embree3", embree_dir + "common"]) +env_raycast.Prepend(CPPPATH=[embree_dir, embree_dir + "include", embree_dir + "common"]) env_raycast.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/raycast/lightmap_raycaster.cpp b/modules/raycast/lightmap_raycaster.cpp index b5eb15de4ab..ef0eaa3694c 100644 --- a/modules/raycast/lightmap_raycaster.cpp +++ b/modules/raycast/lightmap_raycaster.cpp @@ -29,8 +29,10 @@ /*************************************************************************/ #include "lightmap_raycaster.h" -#include "math/vec2.h" -#include "math/vec3.h" + +// From Embree. +#include +#include using namespace embree; diff --git a/modules/raycast/lightmap_raycaster.h b/modules/raycast/lightmap_raycaster.h index 46ed2dfba2b..e04286f40c6 100644 --- a/modules/raycast/lightmap_raycaster.h +++ b/modules/raycast/lightmap_raycaster.h @@ -31,7 +31,8 @@ #include "core/object.h" #include "scene/3d/lightmapper.h" #include "scene/resources/mesh.h" -#include "thirdparty/embree/include/embree3/rtcore.h" + +#include class LightmapRaycasterEmbree : public LightmapRaycaster { GDCLASS(LightmapRaycasterEmbree, LightmapRaycaster); diff --git a/modules/raycast/register_types.cpp b/modules/raycast/register_types.cpp index 8009fbbbecc..8af3c467ab2 100644 --- a/modules/raycast/register_types.cpp +++ b/modules/raycast/register_types.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "register_types.h" + #include "lightmap_raycaster.h" void register_raycast_types() { diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp index 017de2cd373..ecd0f5a85e7 100644 --- a/scene/3d/baked_lightmap.cpp +++ b/scene/3d/baked_lightmap.cpp @@ -1454,7 +1454,10 @@ void BakedLightmap::_bind_methods() { BIND_ENUM_CONSTANT(BAKE_ERROR_NO_SAVE_PATH); BIND_ENUM_CONSTANT(BAKE_ERROR_NO_MESHES); BIND_ENUM_CONSTANT(BAKE_ERROR_CANT_CREATE_IMAGE); + BIND_ENUM_CONSTANT(BAKE_ERROR_LIGHTMAP_SIZE); + BIND_ENUM_CONSTANT(BAKE_ERROR_INVALID_MESH); BIND_ENUM_CONSTANT(BAKE_ERROR_USER_ABORTED); + BIND_ENUM_CONSTANT(BAKE_ERROR_NO_LIGHTMAPPER); BIND_ENUM_CONSTANT(ENVIRONMENT_MODE_DISABLED); BIND_ENUM_CONSTANT(ENVIRONMENT_MODE_SCENE); diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 57df051a9f6..f997929ed3f 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -30,14 +30,13 @@ #include "mesh.h" +#include "core/crypto/crypto_core.h" #include "core/local_vector.h" #include "core/pair.h" #include "scene/resources/concave_polygon_shape.h" #include "scene/resources/convex_polygon_shape.h" #include "surface_tool.h" -#include "core/crypto/crypto_core.h" - #include Mesh::ConvexDecompositionFunc Mesh::convex_composition_function = NULL; diff --git a/thirdparty/README.md b/thirdparty/README.md index 0a406db1c5f..9ff0bf6e6f9 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -50,6 +50,9 @@ Files extracted from upstream: - All cpp files listed in `modules/raytrace/godot_update_embree.py` - All header files in the directories listed in `modules/raytrace/godot_update_embree.py` +The `modules/raytrace/godot_update_embree.py`script can be used to pull the +relevant files from the latest Embree release and apply some automatic changes. + Some minor changes have been made in order to fix build errors. They are marked with `// -- GODOT start --` and `// -- GODOT end --` comments. Apply the patches in the `patches/` folder when syncing on newer upstream