CPU lightmapper formatting and minor fixes.
This commit is contained in:
parent
089da5a71b
commit
7d7d7ef16d
15 changed files with 22 additions and 10 deletions
|
@ -31,6 +31,7 @@
|
||||||
#include "geometry.h"
|
#include "geometry.h"
|
||||||
|
|
||||||
#include "core/print_string.h"
|
#include "core/print_string.h"
|
||||||
|
|
||||||
#include "thirdparty/misc/clipper.hpp"
|
#include "thirdparty/misc/clipper.hpp"
|
||||||
#include "thirdparty/misc/triangulator.h"
|
#include "thirdparty/misc/triangulator.h"
|
||||||
#define STB_RECT_PACK_IMPLEMENTATION
|
#define STB_RECT_PACK_IMPLEMENTATION
|
||||||
|
|
|
@ -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, "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);
|
oidnSetSharedFilterImage(filter, "output", (void *)p_floats, OIDN_FORMAT_FLOAT3, p_width, p_height, 0, 0, 0);
|
||||||
oidnSetFilter1b(filter, "hdr", true);
|
oidnSetFilter1b(filter, "hdr", true);
|
||||||
//oidnSetFilter1f(filter, "hdrScale", 1.0f);
|
|
||||||
//oidnSetFilter1i(filter, "verbose", 4);
|
|
||||||
oidnCommitFilter(filter);
|
oidnCommitFilter(filter);
|
||||||
oidnExecuteFilter(filter);
|
oidnExecuteFilter(filter);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "lightmap_denoiser.h"
|
#include "lightmap_denoiser.h"
|
||||||
|
|
||||||
#include "denoise_wrapper.h"
|
#include "denoise_wrapper.h"
|
||||||
|
|
||||||
LightmapDenoiser *LightmapDenoiserOIDN::create_oidn_denoiser() {
|
LightmapDenoiser *LightmapDenoiserOIDN::create_oidn_denoiser() {
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "register_types.h"
|
#include "register_types.h"
|
||||||
|
|
||||||
#include "core/engine.h"
|
#include "core/engine.h"
|
||||||
#include "lightmap_denoiser.h"
|
#include "lightmap_denoiser.h"
|
||||||
|
|
||||||
|
|
|
@ -5,4 +5,5 @@ Import("env_modules")
|
||||||
|
|
||||||
env_lightmapper_rd = env_modules.Clone()
|
env_lightmapper_rd = env_modules.Clone()
|
||||||
# Godot source files
|
# Godot source files
|
||||||
|
env_lightmapper_rd.Prepend(CPPPATH=["#thirdparty/embree/include"])
|
||||||
env_lightmapper_rd.add_source_files(env.modules_sources, "*.cpp")
|
env_lightmapper_rd.add_source_files(env.modules_sources, "*.cpp")
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "lightmapper_cpu.h"
|
#include "lightmapper_cpu.h"
|
||||||
|
|
||||||
#include "core/math/geometry.h"
|
#include "core/math/geometry.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
#include "core/os/threaded_array_processor.h"
|
#include "core/os/threaded_array_processor.h"
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "scene/3d/lightmapper.h"
|
#include "scene/3d/lightmapper.h"
|
||||||
#include "scene/resources/mesh.h"
|
#include "scene/resources/mesh.h"
|
||||||
#include "scene/resources/surface_tool.h"
|
#include "scene/resources/surface_tool.h"
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
class LightmapperCPU : public Lightmapper {
|
class LightmapperCPU : public Lightmapper {
|
||||||
|
|
|
@ -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/high_quality_ray_count", 512);
|
||||||
GLOBAL_DEF("rendering/cpu_lightmapper/quality/ultra_quality_ray_count", 1024);
|
GLOBAL_DEF("rendering/cpu_lightmapper/quality/ultra_quality_ray_count", 1024);
|
||||||
#ifndef _3D_DISABLED
|
#ifndef _3D_DISABLED
|
||||||
ClassDB::register_class<LightmapperCPU>();
|
|
||||||
Lightmapper::create_cpu = create_lightmapper_cpu;
|
Lightmapper::create_cpu = create_lightmapper_cpu;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ embree_dir = "#thirdparty/embree/"
|
||||||
|
|
||||||
env_embree = env_modules.Clone()
|
env_embree = env_modules.Clone()
|
||||||
embree_sources = [embree_dir + file for file in embree_src]
|
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(
|
env_embree.Append(
|
||||||
CPPFLAGS=[
|
CPPFLAGS=[
|
||||||
"-DEMBREE_TARGET_SSE2",
|
"-DEMBREE_TARGET_SSE2",
|
||||||
|
@ -88,6 +88,6 @@ env_embree.disable_warnings()
|
||||||
env_embree.add_source_files(env.modules_sources, embree_sources)
|
env_embree.add_source_files(env.modules_sources, embree_sources)
|
||||||
|
|
||||||
env_raycast = env_modules.Clone()
|
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")
|
env_raycast.add_source_files(env.modules_sources, "*.cpp")
|
||||||
|
|
|
@ -29,8 +29,10 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "lightmap_raycaster.h"
|
#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;
|
using namespace embree;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
#include "core/object.h"
|
#include "core/object.h"
|
||||||
#include "scene/3d/lightmapper.h"
|
#include "scene/3d/lightmapper.h"
|
||||||
#include "scene/resources/mesh.h"
|
#include "scene/resources/mesh.h"
|
||||||
#include "thirdparty/embree/include/embree3/rtcore.h"
|
|
||||||
|
#include <embree3/rtcore.h>
|
||||||
|
|
||||||
class LightmapRaycasterEmbree : public LightmapRaycaster {
|
class LightmapRaycasterEmbree : public LightmapRaycaster {
|
||||||
GDCLASS(LightmapRaycasterEmbree, LightmapRaycaster);
|
GDCLASS(LightmapRaycasterEmbree, LightmapRaycaster);
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "register_types.h"
|
#include "register_types.h"
|
||||||
|
|
||||||
#include "lightmap_raycaster.h"
|
#include "lightmap_raycaster.h"
|
||||||
|
|
||||||
void register_raycast_types() {
|
void register_raycast_types() {
|
||||||
|
|
|
@ -1454,7 +1454,10 @@ void BakedLightmap::_bind_methods() {
|
||||||
BIND_ENUM_CONSTANT(BAKE_ERROR_NO_SAVE_PATH);
|
BIND_ENUM_CONSTANT(BAKE_ERROR_NO_SAVE_PATH);
|
||||||
BIND_ENUM_CONSTANT(BAKE_ERROR_NO_MESHES);
|
BIND_ENUM_CONSTANT(BAKE_ERROR_NO_MESHES);
|
||||||
BIND_ENUM_CONSTANT(BAKE_ERROR_CANT_CREATE_IMAGE);
|
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_USER_ABORTED);
|
||||||
|
BIND_ENUM_CONSTANT(BAKE_ERROR_NO_LIGHTMAPPER);
|
||||||
|
|
||||||
BIND_ENUM_CONSTANT(ENVIRONMENT_MODE_DISABLED);
|
BIND_ENUM_CONSTANT(ENVIRONMENT_MODE_DISABLED);
|
||||||
BIND_ENUM_CONSTANT(ENVIRONMENT_MODE_SCENE);
|
BIND_ENUM_CONSTANT(ENVIRONMENT_MODE_SCENE);
|
||||||
|
|
|
@ -30,14 +30,13 @@
|
||||||
|
|
||||||
#include "mesh.h"
|
#include "mesh.h"
|
||||||
|
|
||||||
|
#include "core/crypto/crypto_core.h"
|
||||||
#include "core/local_vector.h"
|
#include "core/local_vector.h"
|
||||||
#include "core/pair.h"
|
#include "core/pair.h"
|
||||||
#include "scene/resources/concave_polygon_shape.h"
|
#include "scene/resources/concave_polygon_shape.h"
|
||||||
#include "scene/resources/convex_polygon_shape.h"
|
#include "scene/resources/convex_polygon_shape.h"
|
||||||
#include "surface_tool.h"
|
#include "surface_tool.h"
|
||||||
|
|
||||||
#include "core/crypto/crypto_core.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
Mesh::ConvexDecompositionFunc Mesh::convex_composition_function = NULL;
|
Mesh::ConvexDecompositionFunc Mesh::convex_composition_function = NULL;
|
||||||
|
|
3
thirdparty/README.md
vendored
3
thirdparty/README.md
vendored
|
@ -50,6 +50,9 @@ Files extracted from upstream:
|
||||||
- All cpp files listed in `modules/raytrace/godot_update_embree.py`
|
- 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`
|
- 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.
|
Some minor changes have been made in order to fix build errors.
|
||||||
They are marked with `// -- GODOT start --` and `// -- GODOT end --`
|
They are marked with `// -- GODOT start --` and `// -- GODOT end --`
|
||||||
comments. Apply the patches in the `patches/` folder when syncing on newer upstream
|
comments. Apply the patches in the `patches/` folder when syncing on newer upstream
|
||||||
|
|
Loading…
Reference in a new issue