summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp10
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.h1
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp17
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h1
-rw-r--r--drivers/gles2/shaders/canvas.glsl15
-rw-r--r--drivers/gles2/shaders/cubemap_filter.glsl18
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp1
-rw-r--r--editor/editor_inspector.cpp23
-rw-r--r--editor/plugins/script_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp40
-rw-r--r--editor/plugins/texture_region_editor_plugin.h5
-rw-r--r--editor/scene_tree_dock.cpp6
-rw-r--r--main/main.cpp10
-rw-r--r--main/main.h3
-rw-r--r--platform/osx/os_osx.mm4
-rw-r--r--platform/windows/os_windows.cpp4
-rw-r--r--platform/x11/detect.py22
-rw-r--r--scene/2d/cpu_particles_2d.cpp3
-rw-r--r--scene/resources/tile_set.cpp2
-rw-r--r--servers/visual/rasterizer.h1
-rw-r--r--servers/visual/visual_server_scene.cpp164
-rw-r--r--thirdparty/misc/base64.h4
22 files changed, 235 insertions, 121 deletions
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index e4783e907b..ce2961170a 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -524,7 +524,11 @@ bool RasterizerSceneGLES2::reflection_probe_instance_begin_render(RID p_instance
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
glBindRenderbuffer(GL_RENDERBUFFER, rpi->depth); //resize depth buffer
+#ifdef JAVASCRIPT_ENABLED
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, size, size);
+#else
glRenderbufferStorage(GL_RENDERBUFFER, _DEPTH_COMPONENT24_OES, size, size);
+#endif
for (int i = 0; i < 6; i++) {
glBindFramebuffer(GL_FRAMEBUFFER, rpi->fbo[i]);
@@ -2873,7 +2877,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
if (light->type == VS::LIGHT_OMNI) {
// cubemap only
- if (light->omni_shadow_mode == VS::LIGHT_OMNI_SHADOW_CUBE) {
+ if (light->omni_shadow_mode == VS::LIGHT_OMNI_SHADOW_CUBE && storage->config.support_write_depth) {
int cubemap_index = shadow_cubemaps.size() - 1;
// find an appropriate cubemap to render to
@@ -2969,7 +2973,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
state.scene_shader.set_conditional(SceneShaderGLES2::RENDER_DEPTH_DUAL_PARABOLOID, false);
// convert cubemap to dual paraboloid if needed
- if (light->type == VS::LIGHT_OMNI && light->omni_shadow_mode == VS::LIGHT_OMNI_SHADOW_CUBE && p_pass == 5) {
+ if (light->type == VS::LIGHT_OMNI && (light->omni_shadow_mode == VS::LIGHT_OMNI_SHADOW_CUBE && storage->config.support_write_depth) && p_pass == 5) {
ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_shadow_atlas);
glBindFramebuffer(GL_FRAMEBUFFER, shadow_atlas->fbo);
@@ -3131,7 +3135,7 @@ void RasterizerSceneGLES2::initialize() {
}
// cubemaps for shadows
- {
+ if (!storage->config.support_write_depth) { //not going to be used
int max_shadow_cubemap_sampler_size = 512;
int cube_size = max_shadow_cubemap_sampler_size;
diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h
index 42ac621e45..0d917f4da2 100644
--- a/drivers/gles2/rasterizer_scene_gles2.h
+++ b/drivers/gles2/rasterizer_scene_gles2.h
@@ -473,6 +473,7 @@ public:
virtual void light_instance_set_transform(RID p_light_instance, const Transform &p_transform);
virtual void light_instance_set_shadow_transform(RID p_light_instance, const CameraMatrix &p_projection, const Transform &p_transform, float p_far, float p_split, int p_pass, float p_bias_scale = 1.0);
virtual void light_instance_mark_visible(RID p_light_instance);
+ virtual bool light_instances_can_render_shadow_cube() const { return storage->config.support_write_depth; }
LightInstance **render_light_instances;
int render_directional_lights;
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 0622a353df..0d643370e0 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -4007,7 +4007,11 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glGenRenderbuffers(1, &rt->depth);
glBindRenderbuffer(GL_RENDERBUFFER, rt->depth);
+#ifdef JAVASCRIPT_ENABLED
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, rt->width, rt->height);
+#else
glRenderbufferStorage(GL_RENDERBUFFER, _DEPTH_COMPONENT24_OES, rt->width, rt->height);
+#endif
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
@@ -4218,7 +4222,11 @@ RID RasterizerStorageGLES2::canvas_light_shadow_buffer_create(int p_width) {
glGenRenderbuffers(1, &cls->depth);
glBindRenderbuffer(GL_RENDERBUFFER, cls->depth);
- glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, cls->size, cls->height);
+#ifdef JAVASCRIPT_ENABLED
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, cls->size, cls->height);
+#else
+ glRenderbufferStorage(GL_RENDERBUFFER, _DEPTH_COMPONENT24_OES, cls->size, cls->height);
+#endif
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, cls->depth);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
@@ -4665,6 +4673,13 @@ void RasterizerStorageGLES2::initialize() {
config.support_32_bits_indices = config.extensions.has("GL_OES_element_index_uint");
#endif
+#ifdef GLES_OVER_GL
+ config.support_write_depth = true;
+#else
+ config.support_write_depth = config.extensions.has("GL_EXT_frag_depth");
+#endif
+
+
frame.count = 0;
frame.delta = 0;
frame.current_rt = NULL;
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
index ae14aaa9c0..0e0804eef2 100644
--- a/drivers/gles2/rasterizer_storage_gles2.h
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -80,6 +80,7 @@ public:
bool use_rgba_2d_shadows;
bool support_32_bits_indices;
+ bool support_write_depth;
} config;
struct Resources {
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index 0de60d7421..d483659e4d 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -433,19 +433,14 @@ FRAGMENT_SHADER_CODE
#ifdef SHADOW_USE_GRADIENT
-#define SHADOW_TEST(m_ofs) \
- { \
- highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); \
- shadow_attenuation += 1.0 - smoothstep(sd, sd + shadow_gradient, sz); \
- }
+ /* clang-format off */
+ /* GLSL es 100 doesn't support line continuation characters(backslashes) */
+#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); shadow_attenuation += 1.0 - smoothstep(sd, sd + shadow_gradient, sz); }
#else
-#define SHADOW_TEST(m_ofs) \
- { \
- highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); \
- shadow_attenuation += step(sz, sd); \
- }
+#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); shadow_attenuation += step(sz, sd); }
+ /* clang-format on */
#endif
diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl
index 06274a7698..f551cdb52b 100644
--- a/drivers/gles2/shaders/cubemap_filter.glsl
+++ b/drivers/gles2/shaders/cubemap_filter.glsl
@@ -25,9 +25,17 @@ void main() {
/* clang-format off */
[fragment]
+#ifdef GL_EXT_shader_texture_lod
+#extension GL_EXT_shader_texture_lod : enable
+#define texture2DLod(img, coord, lod) texture2DLodEXT(img, coord, lod)
+#define textureCubeLod(img, coord, lod) textureCubeLodEXT(img, coord, lod)
+#endif
+
+#ifdef GL_ARB_shader_texture_lod
#extension GL_ARB_shader_texture_lod : enable
+#endif
-#ifndef GL_ARB_shader_texture_lod
+#if !defined(GL_EXT_shader_texture_lod) && !defined(GL_ARB_shader_texture_lod)
#define texture2DLod(img, coord, lod) texture2D(img, coord)
#define textureCubeLod(img, coord, lod) textureCube(img, coord)
#endif
@@ -118,7 +126,13 @@ vec3 texelCoordToVec(vec2 uv, int faceID) {
faceUvVectors[5][2] = vec3(0.0, 0.0, 1.0); // +z face
// out = u * s_faceUv[0] + v * s_faceUv[1] + s_faceUv[2].
- vec3 result = (faceUvVectors[faceID][0] * uv.x) + (faceUvVectors[faceID][1] * uv.y) + faceUvVectors[faceID][2];
+ vec3 result;
+ for (int i = 0; i < 6; i++) {
+ if (i == faceID) {
+ result = (faceUvVectors[i][0] * uv.x) + (faceUvVectors[i][1] * uv.y) + faceUvVectors[i][2];
+ break;
+ }
+ }
return normalize(result);
}
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 1fba8535d8..02dbe096c5 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1832,6 +1832,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) {
storage->info.render.vertices_count += s->index_array_len * amount;
} else
#endif
+
if (s->index_array_len > 0) {
glDrawElementsInstanced(gl_primitive[s->primitive], s->index_array_len, (s->array_len >= (1 << 16)) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, 0, amount);
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 0e5fd3a999..e660bb2daf 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -1366,7 +1366,28 @@ void EditorInspector::update_tree() {
//to update properly if all is refreshed
StringName current_selected = property_selected;
- int current_focusable = property_focusable;
+ int current_focusable = -1;
+
+ if (property_focusable != -1) {
+ //check focusable is really focusable
+ bool restore_focus = false;
+ Control *focused = get_focus_owner();
+ if (focused) {
+ Node *parent = focused->get_parent();
+ while (parent) {
+ EditorInspector *inspector = Object::cast_to<EditorInspector>(parent);
+ if (inspector) {
+ restore_focus = inspector == this; //may be owned by another inspector
+ break; //exit after the first inspector is found, since there may be nested ones
+ }
+ parent = parent->get_parent();
+ }
+ }
+
+ if (restore_focus) {
+ current_focusable = property_focusable;
+ }
+ }
_clear();
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 182738cf14..9e65d9de10 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -301,7 +301,7 @@ void ScriptEditor::_goto_script_line2(int p_line) {
void ScriptEditor::_goto_script_line(REF p_script, int p_line) {
Ref<Script> script = Object::cast_to<Script>(*p_script);
- if (!script.is_null() && script->has_source_code()) {
+ if (script.is_valid() && (script->has_source_code() || script->get_path().is_resource_file())) {
if (edit(p_script, p_line, 0)) {
editor->push_item(p_script.ptr());
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 6bd0309d17..3eeb871380 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -51,6 +51,8 @@ void TextureRegionEditor::_region_draw() {
Ref<Texture> base_tex = NULL;
if (node_sprite)
base_tex = node_sprite->get_texture();
+ else if (node_sprite_3d)
+ base_tex = node_sprite_3d->get_texture();
else if (node_ninepatch)
base_tex = node_ninepatch->get_texture();
else if (obj_styleBox.is_valid())
@@ -285,6 +287,8 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
Rect2 r;
if (node_sprite)
r = node_sprite->get_region_rect();
+ else if (node_sprite_3d)
+ r = node_sprite_3d->get_region_rect();
else if (node_ninepatch)
r = node_ninepatch->get_region_rect();
else if (obj_styleBox.is_valid())
@@ -298,6 +302,9 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
if (node_sprite) {
undo_redo->add_do_method(node_sprite, "set_region_rect", rect);
undo_redo->add_undo_method(node_sprite, "set_region_rect", node_sprite->get_region_rect());
+ } else if (node_sprite_3d) {
+ undo_redo->add_do_method(node_sprite_3d, "set_region_rect", rect);
+ undo_redo->add_undo_method(node_sprite_3d, "set_region_rect", node_sprite_3d->get_region_rect());
} else if (node_ninepatch) {
undo_redo->add_do_method(node_ninepatch, "set_region_rect", rect);
undo_redo->add_undo_method(node_ninepatch, "set_region_rect", node_ninepatch->get_region_rect());
@@ -325,6 +332,8 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
drag = true;
if (node_sprite)
rect_prev = node_sprite->get_region_rect();
+ else if (node_sprite_3d)
+ rect_prev = node_sprite_3d->get_region_rect();
else if (node_ninepatch)
rect_prev = node_ninepatch->get_region_rect();
else if (obj_styleBox.is_valid())
@@ -363,6 +372,9 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
if (node_sprite) {
undo_redo->add_do_method(node_sprite, "set_region_rect", node_sprite->get_region_rect());
undo_redo->add_undo_method(node_sprite, "set_region_rect", rect_prev);
+ } else if (node_sprite_3d) {
+ undo_redo->add_do_method(node_sprite_3d, "set_region_rect", node_sprite_3d->get_region_rect());
+ undo_redo->add_undo_method(node_sprite_3d, "set_region_rect", rect_prev);
} else if (atlas_tex.is_valid()) {
undo_redo->add_do_method(atlas_tex.ptr(), "set_region", atlas_tex->get_region());
undo_redo->add_undo_method(atlas_tex.ptr(), "set_region", rect_prev);
@@ -590,6 +602,8 @@ void TextureRegionEditor::_zoom_out() {
void TextureRegionEditor::apply_rect(const Rect2 &p_rect) {
if (node_sprite)
node_sprite->set_region_rect(p_rect);
+ else if (node_sprite_3d)
+ node_sprite_3d->set_region_rect(p_rect);
else if (node_ninepatch)
node_ninepatch->set_region_rect(p_rect);
else if (obj_styleBox.is_valid())
@@ -601,6 +615,8 @@ void TextureRegionEditor::apply_rect(const Rect2 &p_rect) {
void TextureRegionEditor::_update_rect() {
if (node_sprite)
rect = node_sprite->get_region_rect();
+ else if (node_sprite_3d)
+ rect = node_sprite_3d->get_region_rect();
else if (node_ninepatch)
rect = node_ninepatch->get_region_rect();
else if (obj_styleBox.is_valid())
@@ -616,6 +632,8 @@ void TextureRegionEditor::_update_autoslice() {
Ref<Texture> texture = NULL;
if (node_sprite)
texture = node_sprite->get_texture();
+ else if (node_sprite_3d)
+ texture = node_sprite_3d->get_texture();
else if (node_ninepatch)
texture = node_ninepatch->get_texture();
else if (obj_styleBox.is_valid())
@@ -702,9 +720,10 @@ void TextureRegionEditor::_notification(int p_what) {
}
void TextureRegionEditor::_node_removed(Object *p_obj) {
- if (p_obj == node_sprite || p_obj == node_ninepatch || p_obj == obj_styleBox.ptr() || p_obj == atlas_tex.ptr()) {
- node_ninepatch = NULL;
+ if (p_obj == node_sprite || p_obj == node_sprite_3d || p_obj == node_ninepatch || p_obj == obj_styleBox.ptr() || p_obj == atlas_tex.ptr()) {
node_sprite = NULL;
+ node_sprite_3d = NULL;
+ node_ninepatch = NULL;
obj_styleBox = Ref<StyleBox>(NULL);
atlas_tex = Ref<AtlasTexture>(NULL);
hide();
@@ -743,6 +762,10 @@ bool TextureRegionEditor::is_ninepatch() {
return node_ninepatch != NULL;
}
+Sprite3D *TextureRegionEditor::get_sprite_3d() {
+ return node_sprite_3d;
+}
+
Sprite *TextureRegionEditor::get_sprite() {
return node_sprite;
}
@@ -750,6 +773,8 @@ Sprite *TextureRegionEditor::get_sprite() {
void TextureRegionEditor::edit(Object *p_obj) {
if (node_sprite)
node_sprite->remove_change_receptor(this);
+ if (node_sprite_3d)
+ node_sprite_3d->remove_change_receptor(this);
if (node_ninepatch)
node_ninepatch->remove_change_receptor(this);
if (obj_styleBox.is_valid())
@@ -758,6 +783,7 @@ void TextureRegionEditor::edit(Object *p_obj) {
atlas_tex->remove_change_receptor(this);
if (p_obj) {
node_sprite = Object::cast_to<Sprite>(p_obj);
+ node_sprite_3d = Object::cast_to<Sprite3D>(p_obj);
node_ninepatch = Object::cast_to<NinePatchRect>(p_obj);
if (Object::cast_to<StyleBoxTexture>(p_obj))
obj_styleBox = Ref<StyleBoxTexture>(Object::cast_to<StyleBoxTexture>(p_obj));
@@ -767,12 +793,13 @@ void TextureRegionEditor::edit(Object *p_obj) {
_edit_region();
} else {
node_sprite = NULL;
+ node_sprite_3d = NULL;
node_ninepatch = NULL;
obj_styleBox = Ref<StyleBoxTexture>(NULL);
atlas_tex = Ref<AtlasTexture>(NULL);
}
edit_draw->update();
- if (node_sprite && !node_sprite->is_region()) {
+ if ((node_sprite && !node_sprite->is_region()) || (node_sprite_3d && !node_sprite_3d->is_region())) {
set_process(true);
}
if (!p_obj) {
@@ -792,6 +819,8 @@ void TextureRegionEditor::_edit_region() {
Ref<Texture> texture = NULL;
if (node_sprite)
texture = node_sprite->get_texture();
+ else if (node_sprite_3d)
+ texture = node_sprite_3d->get_texture();
else if (node_ninepatch)
texture = node_ninepatch->get_texture();
else if (obj_styleBox.is_valid())
@@ -834,6 +863,7 @@ Vector2 TextureRegionEditor::snap_point(Vector2 p_target) const {
TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) {
node_sprite = NULL;
+ node_sprite_3d = NULL;
node_ninepatch = NULL;
obj_styleBox = Ref<StyleBoxTexture>(NULL);
atlas_tex = Ref<AtlasTexture>(NULL);
@@ -976,13 +1006,13 @@ void TextureRegionEditorPlugin::edit(Object *p_object) {
}
bool TextureRegionEditorPlugin::handles(Object *p_object) const {
- return p_object->is_class("Sprite") || p_object->is_class("NinePatchRect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture");
+ return p_object->is_class("Sprite") || p_object->is_class("Sprite3D") || p_object->is_class("NinePatchRect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture");
}
void TextureRegionEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
texture_region_button->show();
- if (region_editor->is_stylebox() || region_editor->is_atlas_texture() || region_editor->is_ninepatch() || (region_editor->get_sprite() && region_editor->get_sprite()->is_region()) || texture_region_button->is_pressed()) {
+ if (region_editor->is_stylebox() || region_editor->is_atlas_texture() || region_editor->is_ninepatch() || (region_editor->get_sprite() && region_editor->get_sprite()->is_region()) || (region_editor->get_sprite_3d() && region_editor->get_sprite_3d()->is_region()) || texture_region_button->is_pressed()) {
editor->make_bottom_panel_item_visible(region_editor);
}
} else {
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index e4d7971160..19eaef9bc3 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -35,6 +35,7 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/2d/sprite.h"
+#include "scene/3d/sprite_3d.h"
#include "scene/gui/nine_patch_rect.h"
#include "scene/resources/style_box.h"
#include "scene/resources/texture.h"
@@ -83,8 +84,9 @@ class TextureRegionEditor : public VBoxContainer {
Vector2 snap_step;
Vector2 snap_separation;
- NinePatchRect *node_ninepatch;
Sprite *node_sprite;
+ Sprite3D *node_sprite_3d;
+ NinePatchRect *node_ninepatch;
Ref<StyleBoxTexture> obj_styleBox;
Ref<AtlasTexture> atlas_tex;
@@ -132,6 +134,7 @@ public:
bool is_stylebox();
bool is_atlas_texture();
bool is_ninepatch();
+ Sprite3D *get_sprite_3d();
Sprite *get_sprite();
void edit(Object *p_obj);
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index be1c4a36bd..738d747956 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -565,6 +565,12 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
//check that from node to root, all owners are right
+ if (root->get_scene_inherited_state().is_valid()) {
+ accept->set_text(TTR("Can't reparent nodes in inherited scenes, order of nodes can't change."));
+ accept->popup_centered_minsize();
+ return;
+ }
+
if (node->get_owner() != root) {
accept->set_text(TTR("Node must belong to the edited scene to become root."));
accept->popup_centered_minsize();
diff --git a/main/main.cpp b/main/main.cpp
index cbf30af38c..b94130002d 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1789,6 +1789,10 @@ uint64_t Main::target_ticks = 0;
uint32_t Main::frames = 0;
uint32_t Main::frame = 0;
bool Main::force_redraw_requested = false;
+bool Main::iterating = false;
+bool Main::is_iterating() {
+ return iterating;
+}
// For performance metrics
static uint64_t physics_process_max = 0;
@@ -1796,6 +1800,10 @@ static uint64_t idle_process_max = 0;
bool Main::iteration() {
+ ERR_FAIL_COND_V(iterating, false);
+
+ iterating = true;
+
uint64_t ticks = OS::get_singleton()->get_ticks_usec();
Engine::get_singleton()->_frame_ticks = ticks;
main_timer_sync.set_cpu_ticks_usec(ticks);
@@ -1923,6 +1931,8 @@ bool Main::iteration() {
frames = 0;
}
+ iterating = false;
+
if (fixed_fps != -1)
return exit;
diff --git a/main/main.h b/main/main.h
index 01fc259a8a..1bdce7d17f 100644
--- a/main/main.h
+++ b/main/main.h
@@ -47,6 +47,7 @@ class Main {
static uint32_t frames;
static uint32_t frame;
static bool force_redraw_requested;
+ static bool iterating;
public:
static bool is_project_manager();
@@ -58,6 +59,8 @@ public:
static bool iteration();
static void force_redraw();
+ static bool is_iterating();
+
static void cleanup();
};
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index ddd98ab88c..760858b2e5 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -304,7 +304,9 @@ static Vector2 get_mouse_pos(NSPoint locationInWindow, CGFloat backingScaleFacto
if (OS_OSX::singleton->main_loop) {
Main::force_redraw();
//Event retrieval blocks until resize is over. Call Main::iteration() directly.
- Main::iteration();
+ if (!Main::is_iterating()) { //avoid cyclic loop
+ Main::iteration();
+ }
}
/*
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 3b41f1b901..d1693cb0b4 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -783,7 +783,9 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_TIMER: {
if (wParam == move_timer_id) {
process_key_events();
- Main::iteration();
+ if (!Main::is_iterating()) {
+ Main::iteration();
+ }
}
} break;
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 415e8ceaa6..72139538b7 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -61,8 +61,9 @@ def get_opts():
return [
BoolVariable('use_llvm', 'Use the LLVM compiler', False),
BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', False),
- BoolVariable('use_sanitizer', 'Use LLVM compiler address sanitizer', False),
- BoolVariable('use_leak_sanitizer', 'Use LLVM compiler memory leaks sanitizer (implies use_sanitizer)', False),
+ BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
+ BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
+ BoolVariable('use_lsan', 'Use LLVM/GCC compiler leak sanitizer (LSAN))', False),
BoolVariable('pulseaudio', 'Detect & use pulseaudio', True),
BoolVariable('udev', 'Use udev for gamepad connection callbacks', False),
EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
@@ -131,12 +132,19 @@ def configure(env):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env.extra_suffix = ".llvm" + env.extra_suffix
- # leak sanitizer requires (address) sanitizer
- if env['use_sanitizer'] or env['use_leak_sanitizer']:
- env.Append(CCFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
- env.Append(LINKFLAGS=['-fsanitize=address'])
+
+ if env['use_ubsan'] or env['use_asan'] or env['use_lsan']:
env.extra_suffix += "s"
- if env['use_leak_sanitizer']:
+
+ if env['use_ubsan']:
+ env.Append(CCFLAGS=['-fsanitize=undefined'])
+ env.Append(LINKFLAGS=['-fsanitize=undefined'])
+
+ if env['use_asan']:
+ env.Append(CCFLAGS=['-fsanitize=address'])
+ env.Append(LINKFLAGS=['-fsanitize=address'])
+
+ if env['use_lsan']:
env.Append(CCFLAGS=['-fsanitize=leak'])
env.Append(LINKFLAGS=['-fsanitize=leak'])
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 36b900bf82..21feb6e226 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -840,7 +840,7 @@ void CPUParticles2D::_particles_process(float p_delta) {
if (flags[FLAG_ALIGN_Y_TO_VELOCITY]) {
if (p.velocity.length() > 0.0) {
- p.transform.elements[0] = p.velocity.normalized();
+ p.transform.elements[1] = p.velocity.normalized();
p.transform.elements[0] = p.transform.elements[1].tangent();
}
@@ -1378,6 +1378,7 @@ CPUParticles2D::CPUParticles2D() {
set_param(PARAM_INITIAL_LINEAR_VELOCITY, 1);
//set_param(PARAM_ORBIT_VELOCITY, 0);
set_param(PARAM_LINEAR_ACCEL, 0);
+ set_param(PARAM_ANGULAR_VELOCITY, 0);
set_param(PARAM_RADIAL_ACCEL, 0);
set_param(PARAM_TANGENTIAL_ACCEL, 0);
set_param(PARAM_DAMPING, 0);
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 38a5f9714e..5a2e7245a2 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -908,7 +908,7 @@ void TileSet::_tile_set_shapes(int p_id, const Array &p_shapes) {
if (d.has("one_way_margin") && d["one_way_margin"].is_num())
s.one_way_collision_margin = d["one_way_margin"];
else
- s.one_way_collision = 1.0;
+ s.one_way_collision_margin = 1.0;
if (d.has("autotile_coord") && d["autotile_coord"].get_type() == Variant::VECTOR2)
s.autotile_coord = d["autotile_coord"];
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 394592ec64..6f8a30070a 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -141,6 +141,7 @@ public:
virtual void light_instance_set_transform(RID p_light_instance, const Transform &p_transform) = 0;
virtual void light_instance_set_shadow_transform(RID p_light_instance, const CameraMatrix &p_projection, const Transform &p_transform, float p_far, float p_split, int p_pass, float p_bias_scale = 1.0) = 0;
virtual void light_instance_mark_visible(RID p_light_instance) = 0;
+ virtual bool light_instances_can_render_shadow_cube() const { return true; }
virtual RID reflection_atlas_create() = 0;
virtual void reflection_atlas_set_size(RID p_ref_atlas, int p_size) = 0;
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 53e8d6a030..23ad2ec1ec 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -1535,106 +1535,102 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
VS::LightOmniShadowMode shadow_mode = VSG::storage->light_omni_get_shadow_mode(p_instance->base);
- switch (shadow_mode) {
- case VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID: {
+ if (shadow_mode == VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID || !VSG::scene_render->light_instances_can_render_shadow_cube()) {
- for (int i = 0; i < 2; i++) {
+ for (int i = 0; i < 2; i++) {
- //using this one ensures that raster deferred will have it
+ //using this one ensures that raster deferred will have it
- float radius = VSG::storage->light_get_param(p_instance->base, VS::LIGHT_PARAM_RANGE);
-
- float z = i == 0 ? -1 : 1;
- Vector<Plane> planes;
- planes.resize(5);
- planes.write[0] = light_transform.xform(Plane(Vector3(0, 0, z), radius));
- planes.write[1] = light_transform.xform(Plane(Vector3(1, 0, z).normalized(), radius));
- planes.write[2] = light_transform.xform(Plane(Vector3(-1, 0, z).normalized(), radius));
- planes.write[3] = light_transform.xform(Plane(Vector3(0, 1, z).normalized(), radius));
- planes.write[4] = light_transform.xform(Plane(Vector3(0, -1, z).normalized(), radius));
-
- int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
- Plane near_plane(light_transform.origin, light_transform.basis.get_axis(2) * z);
-
- for (int j = 0; j < cull_count; j++) {
-
- Instance *instance = instance_shadow_cull_result[j];
- if (!instance->visible || !((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
- cull_count--;
- SWAP(instance_shadow_cull_result[j], instance_shadow_cull_result[cull_count]);
- j--;
- } else {
- if (static_cast<InstanceGeometryData *>(instance->base_data)->material_is_animated) {
- animated_material_found = true;
- }
+ float radius = VSG::storage->light_get_param(p_instance->base, VS::LIGHT_PARAM_RANGE);
- instance->depth = near_plane.distance_to(instance->transform.origin);
- instance->depth_layer = 0;
+ float z = i == 0 ? -1 : 1;
+ Vector<Plane> planes;
+ planes.resize(5);
+ planes.write[0] = light_transform.xform(Plane(Vector3(0, 0, z), radius));
+ planes.write[1] = light_transform.xform(Plane(Vector3(1, 0, z).normalized(), radius));
+ planes.write[2] = light_transform.xform(Plane(Vector3(-1, 0, z).normalized(), radius));
+ planes.write[3] = light_transform.xform(Plane(Vector3(0, 1, z).normalized(), radius));
+ planes.write[4] = light_transform.xform(Plane(Vector3(0, -1, z).normalized(), radius));
+
+ int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
+ Plane near_plane(light_transform.origin, light_transform.basis.get_axis(2) * z);
+
+ for (int j = 0; j < cull_count; j++) {
+
+ Instance *instance = instance_shadow_cull_result[j];
+ if (!instance->visible || !((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
+ cull_count--;
+ SWAP(instance_shadow_cull_result[j], instance_shadow_cull_result[cull_count]);
+ j--;
+ } else {
+ if (static_cast<InstanceGeometryData *>(instance->base_data)->material_is_animated) {
+ animated_material_found = true;
}
- }
- VSG::scene_render->light_instance_set_shadow_transform(light->instance, CameraMatrix(), light_transform, radius, 0, i);
- VSG::scene_render->render_shadow(light->instance, p_shadow_atlas, i, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
+ instance->depth = near_plane.distance_to(instance->transform.origin);
+ instance->depth_layer = 0;
+ }
}
- } break;
- case VS::LIGHT_OMNI_SHADOW_CUBE: {
-
- float radius = VSG::storage->light_get_param(p_instance->base, VS::LIGHT_PARAM_RANGE);
- CameraMatrix cm;
- cm.set_perspective(90, 1, 0.01, radius);
-
- for (int i = 0; i < 6; i++) {
- //using this one ensures that raster deferred will have it
-
- static const Vector3 view_normals[6] = {
- Vector3(-1, 0, 0),
- Vector3(+1, 0, 0),
- Vector3(0, -1, 0),
- Vector3(0, +1, 0),
- Vector3(0, 0, -1),
- Vector3(0, 0, +1)
- };
- static const Vector3 view_up[6] = {
- Vector3(0, -1, 0),
- Vector3(0, -1, 0),
- Vector3(0, 0, -1),
- Vector3(0, 0, +1),
- Vector3(0, -1, 0),
- Vector3(0, -1, 0)
- };
-
- Transform xform = light_transform * Transform().looking_at(view_normals[i], view_up[i]);
-
- Vector<Plane> planes = cm.get_projection_planes(xform);
+ VSG::scene_render->light_instance_set_shadow_transform(light->instance, CameraMatrix(), light_transform, radius, 0, i);
+ VSG::scene_render->render_shadow(light->instance, p_shadow_atlas, i, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
+ }
+ } else { //shadow cube
- int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
+ float radius = VSG::storage->light_get_param(p_instance->base, VS::LIGHT_PARAM_RANGE);
+ CameraMatrix cm;
+ cm.set_perspective(90, 1, 0.01, radius);
- Plane near_plane(xform.origin, -xform.basis.get_axis(2));
- for (int j = 0; j < cull_count; j++) {
+ for (int i = 0; i < 6; i++) {
- Instance *instance = instance_shadow_cull_result[j];
- if (!instance->visible || !((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
- cull_count--;
- SWAP(instance_shadow_cull_result[j], instance_shadow_cull_result[cull_count]);
- j--;
- } else {
- if (static_cast<InstanceGeometryData *>(instance->base_data)->material_is_animated) {
- animated_material_found = true;
- }
- instance->depth = near_plane.distance_to(instance->transform.origin);
- instance->depth_layer = 0;
+ //using this one ensures that raster deferred will have it
+
+ static const Vector3 view_normals[6] = {
+ Vector3(-1, 0, 0),
+ Vector3(+1, 0, 0),
+ Vector3(0, -1, 0),
+ Vector3(0, +1, 0),
+ Vector3(0, 0, -1),
+ Vector3(0, 0, +1)
+ };
+ static const Vector3 view_up[6] = {
+ Vector3(0, -1, 0),
+ Vector3(0, -1, 0),
+ Vector3(0, 0, -1),
+ Vector3(0, 0, +1),
+ Vector3(0, -1, 0),
+ Vector3(0, -1, 0)
+ };
+
+ Transform xform = light_transform * Transform().looking_at(view_normals[i], view_up[i]);
+
+ Vector<Plane> planes = cm.get_projection_planes(xform);
+
+ int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
+
+ Plane near_plane(xform.origin, -xform.basis.get_axis(2));
+ for (int j = 0; j < cull_count; j++) {
+
+ Instance *instance = instance_shadow_cull_result[j];
+ if (!instance->visible || !((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
+ cull_count--;
+ SWAP(instance_shadow_cull_result[j], instance_shadow_cull_result[cull_count]);
+ j--;
+ } else {
+ if (static_cast<InstanceGeometryData *>(instance->base_data)->material_is_animated) {
+ animated_material_found = true;
}
+ instance->depth = near_plane.distance_to(instance->transform.origin);
+ instance->depth_layer = 0;
}
-
- VSG::scene_render->light_instance_set_shadow_transform(light->instance, cm, xform, radius, 0, i);
- VSG::scene_render->render_shadow(light->instance, p_shadow_atlas, i, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
}
- //restore the regular DP matrix
- VSG::scene_render->light_instance_set_shadow_transform(light->instance, CameraMatrix(), light_transform, radius, 0, 0);
+ VSG::scene_render->light_instance_set_shadow_transform(light->instance, cm, xform, radius, 0, i);
+ VSG::scene_render->render_shadow(light->instance, p_shadow_atlas, i, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
+ }
- } break;
+ //restore the regular DP matrix
+ VSG::scene_render->light_instance_set_shadow_transform(light->instance, CameraMatrix(), light_transform, radius, 0, 0);
}
} break;
diff --git a/thirdparty/misc/base64.h b/thirdparty/misc/base64.h
index 4c300382c1..ffcd0af973 100644
--- a/thirdparty/misc/base64.h
+++ b/thirdparty/misc/base64.h
@@ -11,8 +11,8 @@
extern "C" {
-uint32_t base64_encode(char *to, char *from, uint32_t len);
-uint32_t base64_decode(char *to, char *from, uint32_t len);
+long base64_encode(char *to, char *from, unsigned int len);
+long base64_decode(char *to, char *from, unsigned int len);
};
#endif /* BASE64_H */