Browse Source

CPU lightmapper formatting and minor fixes.

JFonS 4 years ago
parent
commit
7d7d7ef16d

+ 1 - 0
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

+ 0 - 2
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);
 

+ 1 - 0
modules/denoise/lightmap_denoiser.cpp

@@ -29,6 +29,7 @@
 /*************************************************************************/
 
 #include "lightmap_denoiser.h"
+
 #include "denoise_wrapper.h"
 
 LightmapDenoiser *LightmapDenoiserOIDN::create_oidn_denoiser() {

+ 1 - 0
modules/denoise/register_types.cpp

@@ -29,6 +29,7 @@
 /*************************************************************************/
 
 #include "register_types.h"
+
 #include "core/engine.h"
 #include "lightmap_denoiser.h"
 

+ 1 - 0
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")

+ 1 - 0
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"

+ 1 - 0
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 <atomic>
 
 class LightmapperCPU : public Lightmapper {

+ 0 - 1
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<LightmapperCPU>();
 	Lightmapper::create_cpu = create_lightmapper_cpu;
 #endif
 }

+ 2 - 2
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")

+ 4 - 2
modules/raycast/lightmap_raycaster.cpp

@@ -29,8 +29,10 @@
 /*************************************************************************/
 
 #include "lightmap_raycaster.h"
-#include "math/vec2.h"
-#include "math/vec3.h"
+
+// From Embree.
+#include <math/vec2.h>
+#include <math/vec3.h>
 
 using namespace embree;
 

+ 2 - 1
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 <embree3/rtcore.h>
 
 class LightmapRaycasterEmbree : public LightmapRaycaster {
 	GDCLASS(LightmapRaycasterEmbree, LightmapRaycaster);

+ 1 - 0
modules/raycast/register_types.cpp

@@ -29,6 +29,7 @@
 /*************************************************************************/
 
 #include "register_types.h"
+
 #include "lightmap_raycaster.h"
 
 void register_raycast_types() {

+ 3 - 0
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);

+ 1 - 2
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 <stdlib.h>
 
 Mesh::ConvexDecompositionFunc Mesh::convex_composition_function = NULL;

+ 3 - 0
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