summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYRIGHT.txt5
-rw-r--r--SConstruct1
-rw-r--r--editor/editor_log.cpp5
-rw-r--r--modules/raycast/SCsub169
-rw-r--r--modules/raycast/lightmap_raycaster.cpp29
-rw-r--r--platform/linuxbsd/detect.py4
-rw-r--r--scene/gui/rich_text_label.cpp1
7 files changed, 119 insertions, 95 deletions
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index 9e63da3fc4..cfd983bb0a 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -131,6 +131,11 @@ Comment: doctest
Copyright: 2016-2020, Viktor Kirilov
License: Expat
+Files: ./thirdparty/embree-aarch64/
+Comment: Embree-aarch64
+Copyright: 2009-2021 Intel Corporation
+License: Apache-2.0
+
Files: ./thirdparty/enet/
Comment: ENet
Copyright: 2002-2020, Lee Salzman
diff --git a/SConstruct b/SConstruct
index 2d9802f293..6516b42e59 100644
--- a/SConstruct
+++ b/SConstruct
@@ -145,6 +145,7 @@ opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise e
# Thirdparty libraries
opts.Add(BoolVariable("builtin_bullet", "Use the built-in Bullet library", True))
opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", True))
+opts.Add(BoolVariable("builtin_embree", "Use the built-in Embree library", True))
opts.Add(BoolVariable("builtin_enet", "Use the built-in ENet library", True))
opts.Add(BoolVariable("builtin_freetype", "Use the built-in FreeType library", True))
opts.Add(BoolVariable("builtin_glslang", "Use the built-in glslang library", True))
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 3957f981be..9f188b53c4 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -224,7 +224,7 @@ void EditorLog::_add_log_line(LogMessage &p_message, bool p_replace_previous) {
log->add_text(p_message.text);
// Need to use pop() to exit out of the RichTextLabels current "push" stack.
- // We only "push" in the above swicth when message type != STD, so only pop when that is the case.
+ // We only "push" in the above switch when message type != STD, so only pop when that is the case.
if (p_message.type != MSG_TYPE_STD) {
log->pop();
}
@@ -298,6 +298,7 @@ EditorLog::EditorLog() {
clear_button->set_flat(true);
clear_button->set_focus_mode(FOCUS_NONE);
clear_button->set_shortcut(ED_SHORTCUT("editor/clear_output", TTR("Clear Output"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_K));
+ clear_button->set_shortcut_context(this);
clear_button->connect("pressed", callable_mp(this, &EditorLog::_clear_request));
hb_tools->add_child(clear_button);
@@ -306,6 +307,7 @@ EditorLog::EditorLog() {
copy_button->set_flat(true);
copy_button->set_focus_mode(FOCUS_NONE);
copy_button->set_shortcut(ED_SHORTCUT("editor/copy_output", TTR("Copy Selection"), KEY_MASK_CMD | KEY_C));
+ copy_button->set_shortcut_context(this);
copy_button->connect("pressed", callable_mp(this, &EditorLog::_copy_request));
hb_tools->add_child(copy_button);
@@ -331,6 +333,7 @@ EditorLog::EditorLog() {
show_search_button->set_toggle_mode(true);
show_search_button->set_pressed(true);
show_search_button->set_shortcut(ED_SHORTCUT("editor/open_search", TTR("Open the search box."), KEY_MASK_CMD | KEY_F));
+ show_search_button->set_shortcut_context(this);
show_search_button->connect("toggled", callable_mp(this, &EditorLog::_set_search_visible));
hb_tools2->add_child(show_search_button);
diff --git a/modules/raycast/SCsub b/modules/raycast/SCsub
index 68e9df5263..57120bff26 100644
--- a/modules/raycast/SCsub
+++ b/modules/raycast/SCsub
@@ -3,84 +3,101 @@
Import("env")
Import("env_modules")
-embree_src = [
- "common/sys/sysinfo.cpp",
- "common/sys/alloc.cpp",
- "common/sys/filename.cpp",
- "common/sys/library.cpp",
- "common/sys/thread.cpp",
- "common/sys/string.cpp",
- "common/sys/regression.cpp",
- "common/sys/mutex.cpp",
- "common/sys/condition.cpp",
- "common/sys/barrier.cpp",
- "common/math/constants.cpp",
- "common/simd/sse.cpp",
- "common/lexers/stringstream.cpp",
- "common/lexers/tokenstream.cpp",
- "common/tasking/taskschedulerinternal.cpp",
- "common/algorithms/parallel_for.cpp",
- "common/algorithms/parallel_reduce.cpp",
- "common/algorithms/parallel_prefix_sum.cpp",
- "common/algorithms/parallel_for_for.cpp",
- "common/algorithms/parallel_for_for_prefix_sum.cpp",
- "common/algorithms/parallel_partition.cpp",
- "common/algorithms/parallel_sort.cpp",
- "common/algorithms/parallel_set.cpp",
- "common/algorithms/parallel_map.cpp",
- "common/algorithms/parallel_filter.cpp",
- "kernels/common/device.cpp",
- "kernels/common/stat.cpp",
- "kernels/common/acceln.cpp",
- "kernels/common/accelset.cpp",
- "kernels/common/state.cpp",
- "kernels/common/rtcore.cpp",
- "kernels/common/rtcore_builder.cpp",
- "kernels/common/scene.cpp",
- "kernels/common/alloc.cpp",
- "kernels/common/geometry.cpp",
- "kernels/common/scene_triangle_mesh.cpp",
- "kernels/geometry/primitive4.cpp",
- "kernels/builders/primrefgen.cpp",
- "kernels/bvh/bvh.cpp",
- "kernels/bvh/bvh_statistics.cpp",
- "kernels/bvh/bvh4_factory.cpp",
- "kernels/bvh/bvh8_factory.cpp",
- "kernels/bvh/bvh_collider.cpp",
- "kernels/bvh/bvh_rotate.cpp",
- "kernels/bvh/bvh_refit.cpp",
- "kernels/bvh/bvh_builder.cpp",
- "kernels/bvh/bvh_builder_morton.cpp",
- "kernels/bvh/bvh_builder_sah.cpp",
- "kernels/bvh/bvh_builder_sah_spatial.cpp",
- "kernels/bvh/bvh_builder_sah_mb.cpp",
- "kernels/bvh/bvh_builder_twolevel.cpp",
- "kernels/bvh/bvh_intersector1_bvh4.cpp",
-]
-
-embree_dir = "#thirdparty/embree-aarch64/"
-
-env_embree = env_modules.Clone()
-embree_sources = [embree_dir + file for file in embree_src]
-env_embree.Prepend(CPPPATH=[embree_dir, embree_dir + "include"])
-env_embree.Append(CPPFLAGS=["-DEMBREE_TARGET_SSE2", "-DEMBREE_LOWEST_ISA", "-DTASKING_INTERNAL", "-DNDEBUG"])
-
-if not env_embree.msvc:
- env_embree.Append(CPPFLAGS=["-msse2", "-mxsave"])
+env_raycast = env_modules.Clone()
+
+# Thirdparty source files
+
+thirdparty_obj = []
+
+if env["builtin_embree"]:
+ thirdparty_dir = "#thirdparty/embree-aarch64/"
+
+ embree_src = [
+ "common/sys/sysinfo.cpp",
+ "common/sys/alloc.cpp",
+ "common/sys/filename.cpp",
+ "common/sys/library.cpp",
+ "common/sys/thread.cpp",
+ "common/sys/string.cpp",
+ "common/sys/regression.cpp",
+ "common/sys/mutex.cpp",
+ "common/sys/condition.cpp",
+ "common/sys/barrier.cpp",
+ "common/math/constants.cpp",
+ "common/simd/sse.cpp",
+ "common/lexers/stringstream.cpp",
+ "common/lexers/tokenstream.cpp",
+ "common/tasking/taskschedulerinternal.cpp",
+ "common/algorithms/parallel_for.cpp",
+ "common/algorithms/parallel_reduce.cpp",
+ "common/algorithms/parallel_prefix_sum.cpp",
+ "common/algorithms/parallel_for_for.cpp",
+ "common/algorithms/parallel_for_for_prefix_sum.cpp",
+ "common/algorithms/parallel_partition.cpp",
+ "common/algorithms/parallel_sort.cpp",
+ "common/algorithms/parallel_set.cpp",
+ "common/algorithms/parallel_map.cpp",
+ "common/algorithms/parallel_filter.cpp",
+ "kernels/common/device.cpp",
+ "kernels/common/stat.cpp",
+ "kernels/common/acceln.cpp",
+ "kernels/common/accelset.cpp",
+ "kernels/common/state.cpp",
+ "kernels/common/rtcore.cpp",
+ "kernels/common/rtcore_builder.cpp",
+ "kernels/common/scene.cpp",
+ "kernels/common/alloc.cpp",
+ "kernels/common/geometry.cpp",
+ "kernels/common/scene_triangle_mesh.cpp",
+ "kernels/geometry/primitive4.cpp",
+ "kernels/builders/primrefgen.cpp",
+ "kernels/bvh/bvh.cpp",
+ "kernels/bvh/bvh_statistics.cpp",
+ "kernels/bvh/bvh4_factory.cpp",
+ "kernels/bvh/bvh8_factory.cpp",
+ "kernels/bvh/bvh_collider.cpp",
+ "kernels/bvh/bvh_rotate.cpp",
+ "kernels/bvh/bvh_refit.cpp",
+ "kernels/bvh/bvh_builder.cpp",
+ "kernels/bvh/bvh_builder_morton.cpp",
+ "kernels/bvh/bvh_builder_sah.cpp",
+ "kernels/bvh/bvh_builder_sah_spatial.cpp",
+ "kernels/bvh/bvh_builder_sah_mb.cpp",
+ "kernels/bvh/bvh_builder_twolevel.cpp",
+ "kernels/bvh/bvh_intersector1_bvh4.cpp",
+ ]
+
+ thirdparty_sources = [thirdparty_dir + file for file in embree_src]
+
+ env_raycast.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "include"])
+ env_raycast.Append(CPPDEFINES=["EMBREE_TARGET_SSE2", "EMBREE_LOWEST_ISA", "TASKING_INTERNAL", "NDEBUG"])
+
+ if not env.msvc:
+ if env["arch"] in ["x86", "x86_64"]:
+ env_raycast.Append(CPPFLAGS=["-msse2", "-mxsave"])
+
+ if env["platform"] == "windows":
+ env_raycast.Append(CPPFLAGS=["-mstackrealign"])
+
if env["platform"] == "windows":
- env_embree.Append(CPPFLAGS=["-mstackrealign"])
+ if env.msvc:
+ env.Append(LINKFLAGS=["psapi.lib"])
+ env_raycast.Append(CPPDEFINES=["__SSE2__", "__SSE__"])
+ else:
+ env.Append(LIBS=["psapi"])
-if env["platform"] == "windows":
- if env.msvc:
- env.Append(LINKFLAGS=["psapi.lib"])
- env_embree.Append(CPPFLAGS=["-D__SSE2__", "-D__SSE__"])
- else:
- env.Append(LIBS=["psapi"])
+ env_thirdparty = env_raycast.Clone()
+ env_thirdparty.disable_warnings()
+ env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
+ env.modules_sources += thirdparty_obj
-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", embree_dir + "common"])
+# Godot source files
+
+module_obj = []
+
+env_raycast.add_source_files(module_obj, "*.cpp")
+env.modules_sources += module_obj
-env_raycast.add_source_files(env.modules_sources, "*.cpp")
+# Needed to force rebuilding the module files when the thirdparty library is updated.
+env.Depends(module_obj, thirdparty_obj)
diff --git a/modules/raycast/lightmap_raycaster.cpp b/modules/raycast/lightmap_raycaster.cpp
index 9039622d3d..56bdb5900b 100644
--- a/modules/raycast/lightmap_raycaster.cpp
+++ b/modules/raycast/lightmap_raycaster.cpp
@@ -32,14 +32,8 @@
#include "lightmap_raycaster.h"
-// From Embree.
-#include <math/vec2.h>
-#include <math/vec3.h>
-
#include <pmmintrin.h>
-using namespace embree;
-
LightmapRaycaster *LightmapRaycasterEmbree::create_embree_raycaster() {
return memnew(LightmapRaycasterEmbree);
}
@@ -127,25 +121,24 @@ void LightmapRaycasterEmbree::add_mesh(const Vector<Vector3> &p_vertices, const
ERR_FAIL_COND(vertex_count % 3 != 0);
ERR_FAIL_COND(vertex_count != p_uv2s.size());
+ ERR_FAIL_COND(!p_normals.is_empty() && vertex_count != p_normals.size());
- Vec3fa *embree_vertices = (Vec3fa *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX, 0, RTC_FORMAT_FLOAT3, sizeof(Vec3fa), vertex_count);
- Vec2fa *embree_light_uvs = (Vec2fa *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 0, RTC_FORMAT_FLOAT2, sizeof(Vec2fa), vertex_count);
- uint32_t *embree_triangles = (uint32_t *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT3, sizeof(uint32_t) * 3, vertex_count / 3);
+ Vector3 *embree_vertices = (Vector3 *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX, 0, RTC_FORMAT_FLOAT3, sizeof(Vector3), vertex_count);
+ memcpy(embree_vertices, p_vertices.ptr(), sizeof(Vector3) * vertex_count);
- Vec3fa *embree_normals = nullptr;
- if (!p_normals.is_empty()) {
- embree_normals = (Vec3fa *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 1, RTC_FORMAT_FLOAT3, sizeof(Vec3fa), vertex_count);
- }
+ Vector2 *embree_light_uvs = (Vector2 *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 0, RTC_FORMAT_FLOAT2, sizeof(Vector2), vertex_count);
+ memcpy(embree_light_uvs, p_uv2s.ptr(), sizeof(Vector2) * vertex_count);
+ uint32_t *embree_triangles = (uint32_t *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT3, sizeof(uint32_t) * 3, vertex_count / 3);
for (int i = 0; i < vertex_count; i++) {
- embree_vertices[i] = Vec3fa(p_vertices[i].x, p_vertices[i].y, p_vertices[i].z);
- embree_light_uvs[i] = Vec2fa(p_uv2s[i].x, p_uv2s[i].y);
- if (embree_normals != nullptr) {
- embree_normals[i] = Vec3fa(p_normals[i].x, p_normals[i].y, p_normals[i].z);
- }
embree_triangles[i] = i;
}
+ if (!p_normals.is_empty()) {
+ Vector3 *embree_normals = (Vector3 *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 1, RTC_FORMAT_FLOAT3, sizeof(Vector3), vertex_count);
+ memcpy(embree_normals, p_normals.ptr(), sizeof(Vector3) * vertex_count);
+ }
+
rtcCommitGeometry(embree_mesh);
rtcSetGeometryIntersectFilterFunction(embree_mesh, filter_function);
rtcSetGeometryUserData(embree_mesh, this);
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index adbbcaac31..1876960c57 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -325,6 +325,10 @@ def configure(env):
if not env["builtin_pcre2"]:
env.ParseConfig("pkg-config libpcre2-32 --cflags --libs")
+ if not env["builtin_embree"]:
+ # No pkgconfig file so far, hardcode expected lib name.
+ env.Append(LIBS=["embree3"])
+
## Flags
if os.system("pkg-config --exists alsa") == 0: # 0 means found
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 9efc1af23b..e8a908c30e 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -2615,6 +2615,7 @@ void RichTextLabel::pop() {
// Creates a new line without adding an ItemNewline to the previous line.
// Useful when wanting to calling remove_line and add a new line immediately after.
void RichTextLabel::increment_line_count() {
+ _validate_line_caches(main);
current_frame->lines.resize(current_frame->lines.size() + 1);
_invalidate_current_line(current_frame);
}