summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/math/camera_matrix.cpp1
-rw-r--r--core/os/os.h2
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp53
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h11
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp6
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h1
-rw-r--r--drivers/gles3/shaders/scene.glsl4
-rw-r--r--drivers/unix/os_unix.cpp2
-rw-r--r--drivers/unix/os_unix.h2
-rw-r--r--drivers/wasapi/audio_driver_wasapi.cpp84
-rw-r--r--drivers/wasapi/audio_driver_wasapi.h2
-rw-r--r--editor/editor_audio_buses.cpp4
-rw-r--r--editor/editor_data.cpp4
-rw-r--r--editor/editor_profiler.cpp6
-rw-r--r--editor/editor_settings.cpp15
-rw-r--r--editor/editor_settings.h5
-rw-r--r--editor/plugins/script_text_editor.cpp21
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp10
-rw-r--r--editor/plugins/spatial_editor_plugin.h3
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp105
-rw-r--r--editor/plugins/tile_map_editor_plugin.h2
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp56
-rw-r--r--editor/project_manager.cpp2
-rw-r--r--editor/property_editor.cpp2
-rw-r--r--editor/script_editor_debugger.cpp2
-rw-r--r--editor/settings_config_dialog.cpp6
-rw-r--r--modules/bullet/bullet_physics_server.cpp2
-rw-r--r--modules/gdnative/gdnative.cpp2
-rw-r--r--modules/mono/csharp_script.cpp4
-rw-r--r--platform/iphone/export/export.cpp6
-rw-r--r--platform/iphone/os_iphone.cpp4
-rw-r--r--platform/iphone/os_iphone.h2
-rw-r--r--platform/osx/os_osx.mm2
-rw-r--r--platform/uwp/logo.pngbin1882 -> 1519 bytes
-rw-r--r--platform/windows/os_windows.cpp39
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--scene/2d/path_2d.cpp20
-rw-r--r--scene/2d/ray_cast_2d.cpp12
-rw-r--r--scene/2d/tile_map.cpp48
-rw-r--r--scene/2d/tile_map.h4
-rw-r--r--scene/3d/ray_cast.cpp35
-rw-r--r--scene/3d/ray_cast.h4
-rw-r--r--scene/gui/file_dialog.cpp8
-rw-r--r--scene/main/node.cpp2
-rw-r--r--scene/resources/default_theme/default_theme.cpp1
-rw-r--r--scene/resources/default_theme/icon_parent_folder.pngbin0 -> 329 bytes
-rw-r--r--scene/resources/default_theme/theme_data.h4
-rw-r--r--thirdparty/README.md2
-rw-r--r--thirdparty/glad/KHR/khrplatform.h3
-rw-r--r--thirdparty/glad/glad.c25
-rw-r--r--thirdparty/glad/glad/glad.h48
51 files changed, 422 insertions, 268 deletions
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp
index c5f1d57441..42d2d0373a 100644
--- a/core/math/camera_matrix.cpp
+++ b/core/math/camera_matrix.cpp
@@ -140,6 +140,7 @@ void CameraMatrix::set_for_hmd(int p_eye, real_t p_aspect, real_t p_intraocular_
real_t add = ((f1 + f2) * (p_oversample - 1.0)) / 2.0;
f1 += add;
f2 += add;
+ f3 *= p_oversample;
// always apply KEEP_WIDTH aspect ratio
f3 *= p_aspect;
diff --git a/core/os/os.h b/core/os/os.h
index c72696fe37..91fbf082bf 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -195,7 +195,7 @@ public:
virtual void set_ime_position(const Point2 &p_pos) {}
virtual void set_ime_intermediate_text_callback(ImeCallback p_callback, void *p_inp) {}
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle) { return ERR_UNAVAILABLE; }
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle,bool p_also_set_library_path=false) { return ERR_UNAVAILABLE; }
virtual Error close_dynamic_library(void *p_library_handle) { return ERR_UNAVAILABLE; }
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) { return ERR_UNAVAILABLE; }
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 02df170da1..0f8f98b021 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -2164,7 +2164,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
state.scene_shader.set_conditional(SceneShaderGLES3::USE_OPAQUE_PREPASS, false);
}
-void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, int p_material, bool p_depth_pass) {
+void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, int p_material, bool p_depth_pass,bool p_shadow_pass) {
RasterizerStorageGLES3::Material *m = NULL;
RID m_src = p_instance->material_override.is_valid() ? p_instance->material_override : (p_material >= 0 ? p_instance->materials[p_material] : p_geometry->material);
@@ -2196,17 +2196,17 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo
ERR_FAIL_COND(!m);
- _add_geometry_with_material(p_geometry, p_instance, p_owner, m, p_depth_pass);
+ _add_geometry_with_material(p_geometry, p_instance, p_owner, m, p_depth_pass, p_shadow_pass);
while (m->next_pass.is_valid()) {
m = storage->material_owner.getornull(m->next_pass);
if (!m || !m->shader || !m->shader->valid)
break;
- _add_geometry_with_material(p_geometry, p_instance, p_owner, m, p_depth_pass);
+ _add_geometry_with_material(p_geometry, p_instance, p_owner, m, p_depth_pass, p_shadow_pass);
}
}
-void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_depth_pass) {
+void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_depth_pass, bool p_shadow_pass) {
bool has_base_alpha = (p_material->shader->spatial.uses_alpha && !p_material->shader->spatial.uses_alpha_scissor) || p_material->shader->spatial.uses_screen_texture;
bool has_blend_alpha = p_material->shader->spatial.blend_mode != RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX;
@@ -2238,11 +2238,11 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
if (!p_material->shader->spatial.uses_alpha_scissor && !p_material->shader->spatial.writes_modelview_or_projection && !p_material->shader->spatial.uses_vertex && !p_material->shader->spatial.uses_discard && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) {
//shader does not use discard and does not write a vertex position, use generic material
if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) {
- p_material = storage->material_owner.getptr(default_material_twosided);
+ p_material = storage->material_owner.getptr( !p_shadow_pass && p_material->shader->spatial.uses_world_coordinates ? default_worldcoord_material_twosided : default_material_twosided);
no_cull = true;
mirror = false;
} else {
- p_material = storage->material_owner.getptr(default_material);
+ p_material = storage->material_owner.getptr( !p_shadow_pass && p_material->shader->spatial.uses_world_coordinates ? default_worldcoord_material : default_material);
}
}
@@ -2280,15 +2280,19 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
}
e->sort_key |= uint64_t(e->material->index) << RenderList::SORT_KEY_MATERIAL_INDEX_SHIFT;
- e->sort_key |= uint64_t(e->instance->depth_layer) << RenderList::SORT_KEY_OPAQUE_DEPTH_LAYER_SHIFT;
if (e->instance->gi_probe_instances.size()) {
e->sort_key |= SORT_KEY_GI_PROBES_FLAG;
}
e->sort_key |= uint64_t(p_material->render_priority + 128) << RenderList::SORT_KEY_PRIORITY_SHIFT;
+ } else {
+ e->sort_key |= uint64_t(e->instance->depth_layer) << RenderList::SORT_KEY_OPAQUE_DEPTH_LAYER_SHIFT;
+ e->sort_key |= uint64_t(e->material->index) << RenderList::SORT_KEY_MATERIAL_INDEX_SHIFT;
+
}
+
/*
if (e->geometry->type==RasterizerStorageGLES3::Geometry::GEOMETRY_MULTISURFACE)
e->sort_flags|=RenderList::SORT_FLAG_INSTANCING;
@@ -3060,7 +3064,7 @@ void RasterizerSceneGLES3::_copy_texture_to_front_buffer(GLuint p_texture) {
storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA, false);
}
-void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p_cull_count, bool p_depth_pass) {
+void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p_cull_count, bool p_depth_pass, bool p_shadow_pass) {
current_geometry_index = 0;
current_material_index = 0;
@@ -3085,7 +3089,7 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
int mat_idx = inst->materials[i].is_valid() ? i : -1;
RasterizerStorageGLES3::Surface *s = mesh->surfaces[i];
- _add_geometry(s, inst, NULL, mat_idx, p_depth_pass);
+ _add_geometry(s, inst, NULL, mat_idx, p_depth_pass, p_shadow_pass);
}
//mesh->last_pass=frame;
@@ -3108,7 +3112,7 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
for (int i = 0; i < ssize; i++) {
RasterizerStorageGLES3::Surface *s = mesh->surfaces[i];
- _add_geometry(s, inst, multi_mesh, -1, p_depth_pass);
+ _add_geometry(s, inst, multi_mesh, -1, p_depth_pass, p_shadow_pass);
}
} break;
@@ -3117,7 +3121,7 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
RasterizerStorageGLES3::Immediate *immediate = storage->immediate_owner.getptr(inst->base);
ERR_CONTINUE(!immediate);
- _add_geometry(immediate, inst, NULL, -1, p_depth_pass);
+ _add_geometry(immediate, inst, NULL, -1, p_depth_pass, p_shadow_pass);
} break;
case VS::INSTANCE_PARTICLES: {
@@ -3139,7 +3143,7 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
for (int j = 0; j < ssize; j++) {
RasterizerStorageGLES3::Surface *s = mesh->surfaces[j];
- _add_geometry(s, inst, particles, -1, p_depth_pass);
+ _add_geometry(s, inst, particles, -1, p_depth_pass, p_shadow_pass);
}
}
@@ -4055,8 +4059,8 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
render_list.clear();
- _fill_render_list(p_cull_result, p_cull_count, true);
- render_list.sort_by_depth(false);
+ _fill_render_list(p_cull_result, p_cull_count, true, false);
+ render_list.sort_by_key(false);
state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH, true);
_render_list(render_list.elements, render_list.element_count, p_cam_transform, p_cam_projection, 0, false, false, true, false, false);
state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH, false);
@@ -4086,11 +4090,11 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
_setup_lights(p_light_cull_result, p_light_cull_count, p_cam_transform.affine_inverse(), p_cam_projection, p_shadow_atlas);
_setup_reflections(p_reflection_probe_cull_result, p_reflection_probe_cull_count, p_cam_transform.affine_inverse(), p_cam_projection, p_reflection_atlas, env);
- render_list.clear();
bool use_mrt = false;
- _fill_render_list(p_cull_result, p_cull_count, false);
+ render_list.clear();
+ _fill_render_list(p_cull_result, p_cull_count, false, false);
//
glEnable(GL_BLEND);
@@ -4593,10 +4597,8 @@ void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_
}
}
- //todo hacer que se redibuje cuando corresponde
-
render_list.clear();
- _fill_render_list(p_cull_result, p_cull_count, true);
+ _fill_render_list(p_cull_result, p_cull_count, true, true);
render_list.sort_by_depth(false); //shadow is front to back for performance
@@ -4760,6 +4762,19 @@ void RasterizerSceneGLES3::initialize() {
default_material_twosided = storage->material_create();
storage->shader_set_code(default_shader_twosided, "shader_type spatial; render_mode cull_disabled;\n");
storage->material_set_shader(default_material_twosided, default_shader_twosided);
+
+ //default for shaders using world coordinates (typical for triplanar)
+
+ default_worldcoord_shader = storage->shader_create();
+ storage->shader_set_code(default_worldcoord_shader, "shader_type spatial; render_mode world_vertex_coords;\n");
+ default_worldcoord_material = storage->material_create();
+ storage->material_set_shader(default_worldcoord_material, default_worldcoord_shader);
+
+ default_worldcoord_shader_twosided = storage->shader_create();
+ default_worldcoord_material_twosided = storage->material_create();
+ storage->shader_set_code(default_worldcoord_shader_twosided, "shader_type spatial; render_mode cull_disabled,world_vertex_coords;\n");
+ storage->material_set_shader(default_worldcoord_material_twosided, default_worldcoord_shader_twosided);
+
}
{
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index 69b43c7813..99c8044e2f 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -78,6 +78,11 @@ public:
RID default_shader;
RID default_shader_twosided;
+ RID default_worldcoord_material;
+ RID default_worldcoord_material_twosided;
+ RID default_worldcoord_shader;
+ RID default_worldcoord_shader_twosided;
+
RID default_overdraw_material;
RID default_overdraw_shader;
@@ -812,9 +817,9 @@ public:
void _render_list(RenderList::Element **p_elements, int p_element_count, const Transform &p_view_transform, const CameraMatrix &p_projection, GLuint p_base_env, bool p_reverse_cull, bool p_alpha_pass, bool p_shadow, bool p_directional_add, bool p_directional_shadows);
- _FORCE_INLINE_ void _add_geometry(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, int p_material, bool p_depth_pass);
+ _FORCE_INLINE_ void _add_geometry(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, int p_material, bool p_depth_pass,bool p_shadow_pass);
- _FORCE_INLINE_ void _add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_depth_pass);
+ _FORCE_INLINE_ void _add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_depth_pass, bool p_shadow_pass);
void _draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy);
@@ -827,7 +832,7 @@ public:
void _copy_to_front_buffer(Environment *env);
void _copy_texture_to_front_buffer(GLuint p_texture); //used for debug
- void _fill_render_list(InstanceBase **p_cull_result, int p_cull_count, bool p_depth_pass);
+ void _fill_render_list(InstanceBase **p_cull_result, int p_cull_count, bool p_depth_pass, bool p_shadow_pass);
void _blur_effect_buffer();
void _render_mrts(Environment *env, const CameraMatrix &p_cam_projection);
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index fc9150ecdc..7e3d21adbb 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1601,6 +1601,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
p_shader->spatial.uses_screen_texture = false;
p_shader->spatial.uses_vertex = false;
p_shader->spatial.writes_modelview_or_projection = false;
+ p_shader->spatial.uses_world_coordinates = false;
shaders.actions_scene.render_mode_values["blend_add"] = Pair<int *, int>(&p_shader->spatial.blend_mode, Shader::Spatial::BLEND_MODE_ADD);
shaders.actions_scene.render_mode_values["blend_mix"] = Pair<int *, int>(&p_shader->spatial.blend_mode, Shader::Spatial::BLEND_MODE_MIX);
@@ -1616,14 +1617,16 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
shaders.actions_scene.render_mode_values["cull_back"] = Pair<int *, int>(&p_shader->spatial.cull_mode, Shader::Spatial::CULL_MODE_BACK);
shaders.actions_scene.render_mode_values["cull_disabled"] = Pair<int *, int>(&p_shader->spatial.cull_mode, Shader::Spatial::CULL_MODE_DISABLED);
+
shaders.actions_scene.render_mode_flags["unshaded"] = &p_shader->spatial.unshaded;
shaders.actions_scene.render_mode_flags["depth_test_disable"] = &p_shader->spatial.no_depth_test;
shaders.actions_scene.render_mode_flags["vertex_lighting"] = &p_shader->spatial.uses_vertex_lighting;
+ shaders.actions_scene.render_mode_flags["world_vertex_coords"] = &p_shader->spatial.uses_world_coordinates;
+
shaders.actions_scene.usage_flag_pointers["ALPHA"] = &p_shader->spatial.uses_alpha;
shaders.actions_scene.usage_flag_pointers["ALPHA_SCISSOR"] = &p_shader->spatial.uses_alpha_scissor;
- shaders.actions_scene.usage_flag_pointers["VERTEX"] = &p_shader->spatial.uses_vertex;
shaders.actions_scene.usage_flag_pointers["SSS_STRENGTH"] = &p_shader->spatial.uses_sss;
shaders.actions_scene.usage_flag_pointers["DISCARD"] = &p_shader->spatial.uses_discard;
@@ -1632,6 +1635,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
shaders.actions_scene.write_flag_pointers["MODELVIEW_MATRIX"] = &p_shader->spatial.writes_modelview_or_projection;
shaders.actions_scene.write_flag_pointers["PROJECTION_MATRIX"] = &p_shader->spatial.writes_modelview_or_projection;
+ shaders.actions_scene.write_flag_pointers["VERTEX"] = &p_shader->spatial.uses_vertex;
actions = &shaders.actions_scene;
actions->uniforms = &p_shader->uniforms;
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 0ec110ab87..7c86862425 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -453,6 +453,7 @@ public:
bool uses_time;
bool writes_modelview_or_projection;
bool uses_vertex_lighting;
+ bool uses_world_coordinates;
} spatial;
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index b2b10fdb11..79b989be4a 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -263,6 +263,10 @@ uniform highp sampler2D skeleton_texture; //texunit:-1
out highp vec4 position_interp;
+// FIXME: This triggers a Mesa bug that breaks rendering, so disabled for now.
+// See GH-13450 and https://bugs.freedesktop.org/show_bug.cgi?id=100316
+//invariant gl_Position;
+
void main() {
highp vec4 vertex = vertex_attrib; // vec4(vertex_attrib.xyz * data_attrib.x,1.0);
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 0b1aebaaab..fa208f40ec 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -391,7 +391,7 @@ String OS_Unix::get_locale() const {
return locale;
}
-Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle) {
+Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle,bool p_also_set_library_path) {
p_library_handle = dlopen(p_path.utf8().get_data(), RTLD_NOW);
if (!p_library_handle) {
ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + dlerror());
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index 5b3fb824f0..325aaf7550 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -77,7 +77,7 @@ public:
//virtual VideoMode get_video_mode() const;
//virtual void get_fullscreen_mode_list(List<VideoMode> *p_list) const;
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle);
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle,bool p_also_set_library_path=false);
virtual Error close_dynamic_library(void *p_library_handle);
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false);
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp
index 2c87fb58db..10b6a61b2d 100644
--- a/drivers/wasapi/audio_driver_wasapi.cpp
+++ b/drivers/wasapi/audio_driver_wasapi.cpp
@@ -74,21 +74,22 @@ Error AudioDriverWASAPI::init_device(bool reinit) {
ERR_FAIL_COND_V(hr != S_OK, ERR_CANT_OPEN);
// Since we're using WASAPI Shared Mode we can't control any of these, we just tag along
- channels = pwfex->nChannels;
+ wasapi_channels = pwfex->nChannels;
mix_rate = pwfex->nSamplesPerSec;
format_tag = pwfex->wFormatTag;
bits_per_sample = pwfex->wBitsPerSample;
- switch (channels) {
+ switch (wasapi_channels) {
case 2: // Stereo
case 4: // Surround 3.1
case 6: // Surround 5.1
case 8: // Surround 7.1
+ channels = wasapi_channels;
break;
default:
- ERR_PRINTS("WASAPI: Unsupported number of channels: " + itos(channels));
- ERR_FAIL_V(ERR_CANT_OPEN);
+ WARN_PRINTS("WASAPI: Unsupported number of channels: " + itos(wasapi_channels));
+ channels = 2;
break;
}
@@ -206,6 +207,35 @@ AudioDriver::SpeakerMode AudioDriverWASAPI::get_speaker_mode() const {
return get_speaker_mode_by_total_channels(channels);
}
+void AudioDriverWASAPI::write_sample(AudioDriverWASAPI *ad, BYTE *buffer, int i, int32_t sample) {
+ if (ad->format_tag == WAVE_FORMAT_PCM) {
+ switch (ad->bits_per_sample) {
+ case 8:
+ ((int8_t *)buffer)[i] = sample >> 24;
+ break;
+
+ case 16:
+ ((int16_t *)buffer)[i] = sample >> 16;
+ break;
+
+ case 24:
+ ((int8_t *)buffer)[i * 3 + 2] = sample >> 24;
+ ((int8_t *)buffer)[i * 3 + 1] = sample >> 16;
+ ((int8_t *)buffer)[i * 3 + 0] = sample >> 8;
+ break;
+
+ case 32:
+ ((int32_t *)buffer)[i] = sample;
+ break;
+ }
+ } else if (ad->format_tag == WAVE_FORMAT_IEEE_FLOAT) {
+ ((float *)buffer)[i] = (sample >> 16) / 32768.f;
+ } else {
+ ERR_PRINT("WASAPI: Unknown format tag");
+ ad->exit_thread = true;
+ }
+}
+
void AudioDriverWASAPI::thread_func(void *p_udata) {
AudioDriverWASAPI *ad = (AudioDriverWASAPI *)p_udata;
@@ -240,42 +270,21 @@ void AudioDriverWASAPI::thread_func(void *p_udata) {
if (hr == S_OK) {
// We're using WASAPI Shared Mode so we must convert the buffer
- if (ad->format_tag == WAVE_FORMAT_PCM) {
- switch (ad->bits_per_sample) {
- case 8:
- for (unsigned int i = 0; i < write_frames * ad->channels; i++) {
- ((int8_t *)buffer)[i] = ad->samples_in[buffer_idx++] >> 24;
- }
- break;
-
- case 16:
- for (unsigned int i = 0; i < write_frames * ad->channels; i++) {
- ((int16_t *)buffer)[i] = ad->samples_in[buffer_idx++] >> 16;
- }
- break;
-
- case 24:
- for (unsigned int i = 0; i < write_frames * ad->channels; i++) {
- int32_t sample = ad->samples_in[buffer_idx++];
- ((int8_t *)buffer)[i * 3 + 2] = sample >> 24;
- ((int8_t *)buffer)[i * 3 + 1] = sample >> 16;
- ((int8_t *)buffer)[i * 3 + 0] = sample >> 8;
- }
- break;
-
- case 32:
- for (unsigned int i = 0; i < write_frames * ad->channels; i++) {
- ((int32_t *)buffer)[i] = ad->samples_in[buffer_idx++];
- }
- break;
- }
- } else if (ad->format_tag == WAVE_FORMAT_IEEE_FLOAT) {
+ if (ad->channels == ad->wasapi_channels) {
for (unsigned int i = 0; i < write_frames * ad->channels; i++) {
- ((float *)buffer)[i] = (ad->samples_in[buffer_idx++] >> 16) / 32768.f;
+ ad->write_sample(ad, buffer, i, ad->samples_in[buffer_idx++]);
}
} else {
- ERR_PRINT("WASAPI: Unknown format tag");
- ad->exit_thread = true;
+ for (unsigned int i = 0; i < write_frames; i++) {
+ for (unsigned int j = 0; j < MIN(ad->channels, ad->wasapi_channels); j++) {
+ ad->write_sample(ad, buffer, i * ad->wasapi_channels + j, ad->samples_in[buffer_idx++]);
+ }
+ if (ad->wasapi_channels > ad->channels) {
+ for (unsigned int j = ad->channels; j < ad->wasapi_channels; j++) {
+ ad->write_sample(ad, buffer, i * ad->wasapi_channels + j, 0);
+ }
+ }
+ }
}
hr = ad->render_client->ReleaseBuffer(write_frames, 0);
@@ -380,6 +389,7 @@ AudioDriverWASAPI::AudioDriverWASAPI() {
buffer_size = 0;
channels = 0;
+ wasapi_channels = 0;
mix_rate = 0;
buffer_frames = 0;
diff --git a/drivers/wasapi/audio_driver_wasapi.h b/drivers/wasapi/audio_driver_wasapi.h
index 87a2db724c..5921645f6e 100644
--- a/drivers/wasapi/audio_driver_wasapi.h
+++ b/drivers/wasapi/audio_driver_wasapi.h
@@ -55,6 +55,7 @@ class AudioDriverWASAPI : public AudioDriver {
unsigned int buffer_size;
unsigned int channels;
+ unsigned int wasapi_channels;
int mix_rate;
int buffer_frames;
@@ -62,6 +63,7 @@ class AudioDriverWASAPI : public AudioDriver {
mutable bool exit_thread;
bool active;
+ _FORCE_INLINE_ void write_sample(AudioDriverWASAPI *ad, BYTE *buffer, int i, int32_t sample);
static void thread_func(void *p_udata);
Error init_device(bool reinit = false);
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index de64c11308..6e507fac9b 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -251,7 +251,7 @@ void EditorAudioBus::_volume_db_changed(float p_db) {
updating_bus = true;
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
- ur->create_action("Change Audio Bus Volume", UndoRedo::MERGE_ENDS);
+ ur->create_action(TTR("Change Audio Bus Volume"), UndoRedo::MERGE_ENDS);
ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", get_index(), p_db);
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_volume_db", get_index(), AudioServer::get_singleton()->get_bus_volume_db(get_index()));
ur->add_do_method(buses, "_update_bus", get_index());
@@ -812,7 +812,7 @@ void EditorAudioBuses::_update_buses() {
EditorAudioBuses *EditorAudioBuses::register_editor() {
EditorAudioBuses *audio_buses = memnew(EditorAudioBuses);
- EditorNode::get_singleton()->add_bottom_panel_item("Audio", audio_buses);
+ EditorNode::get_singleton()->add_bottom_panel_item(TTR("Audio"), audio_buses);
return audio_buses;
}
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 443004f820..49d55e6305 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -690,9 +690,9 @@ Ref<Script> EditorData::get_scene_root_script(int p_idx) const {
String EditorData::get_scene_title(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, edited_scene.size(), String());
if (!edited_scene[p_idx].root)
- return "[empty]";
+ return TTR("[empty]");
if (edited_scene[p_idx].root->get_filename() == "")
- return "[unsaved]";
+ return TTR("[unsaved]");
bool show_ext = EDITOR_DEF("interface/scene_tabs/show_extension", false);
String name = edited_scene[p_idx].root->get_filename().get_file();
if (!show_ext) {
diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp
index 5d81fc6ea4..71c26244ee 100644
--- a/editor/editor_profiler.cpp
+++ b/editor/editor_profiler.cpp
@@ -670,13 +670,13 @@ EditorProfiler::EditorProfiler() {
variables->set_hide_root(true);
variables->set_columns(3);
variables->set_column_titles_visible(true);
- variables->set_column_title(0, "Name");
+ variables->set_column_title(0, TTR("Name"));
variables->set_column_expand(0, true);
variables->set_column_min_width(0, 60);
- variables->set_column_title(1, "Time");
+ variables->set_column_title(1, TTR("Time"));
variables->set_column_expand(1, false);
variables->set_column_min_width(1, 60 * EDSCALE);
- variables->set_column_title(2, "Calls");
+ variables->set_column_title(2, TTR("Calls"));
variables->set_column_expand(2, false);
variables->set_column_min_width(2, 60 * EDSCALE);
variables->connect("item_edited", this, "_item_edited");
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 52672fff72..638b23382d 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -75,10 +75,9 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool
return true;
}
- if (p_value.get_type() == Variant::NIL)
+ if (p_value.get_type() == Variant::NIL) {
props.erase(p_name);
- else {
-
+ } else {
if (props.has(p_name))
props[p_name].variant = p_value;
else
@@ -967,6 +966,8 @@ void EditorSettings::raise_order(const String &p_setting) {
void EditorSettings::set_initial_value(const StringName &p_setting, const Variant &p_value) {
+ _THREAD_SAFE_METHOD_
+
if (!props.has(p_setting))
return;
props[p_setting].initial = p_value;
@@ -979,7 +980,8 @@ Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default) {
if (EditorSettings::get_singleton()->has_setting(p_setting))
ret = EditorSettings::get_singleton()->get(p_setting);
else
- EditorSettings::get_singleton()->set(p_setting, p_default);
+ EditorSettings::get_singleton()->set_manually(p_setting, p_default);
+
if (!EditorSettings::get_singleton()->has_default_value(p_setting))
EditorSettings::get_singleton()->set_initial_value(p_setting, p_default);
@@ -997,12 +999,15 @@ bool EditorSettings::property_can_revert(const String &p_setting) {
if (!props.has(p_setting))
return false;
+ if (!props[p_setting].has_default_value)
+ return false;
+
return props[p_setting].initial != props[p_setting].variant;
}
Variant EditorSettings::property_get_revert(const String &p_setting) {
- if (!props.has(p_setting))
+ if (!props.has(p_setting) || !props[p_setting].has_default_value)
return Variant();
return props[p_setting].initial;
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index a8c991a6d9..5b15b1d6be 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -70,6 +70,8 @@ private:
bool hide_from_editor;
bool save;
VariantContainer() {
+ variant = Variant();
+ initial = Variant();
order = 0;
hide_from_editor = false;
has_default_value = false;
@@ -77,8 +79,11 @@ private:
}
VariantContainer(const Variant &p_variant, int p_order) {
variant = p_variant;
+ initial = Variant();
order = p_order;
hide_from_editor = false;
+ has_default_value = false;
+ save = false;
}
};
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 214f24b386..19293360ed 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1039,6 +1039,13 @@ void ScriptTextEditor::_edit_option(int p_op) {
if (scr.is_null())
return;
+ String delimiter = "#";
+ List<String> comment_delimiters;
+ scr->get_language()->get_comment_delimiters(&comment_delimiters);
+ if (!comment_delimiters.empty()) {
+ delimiter = comment_delimiters.front()->get();
+ }
+
tx->begin_complex_operation();
if (tx->is_selection_active()) {
int begin = tx->get_selection_from_line();
@@ -1051,7 +1058,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
// Check if all lines in the selected block are commented
bool is_commented = true;
for (int i = begin; i <= end; i++) {
- if (!tx->get_line(i).begins_with("#")) {
+ if (!tx->get_line(i).begins_with(delimiter)) {
is_commented = false;
break;
}
@@ -1060,12 +1067,12 @@ void ScriptTextEditor::_edit_option(int p_op) {
String line_text = tx->get_line(i);
if (line_text.strip_edges().empty()) {
- line_text = "#";
+ line_text = delimiter;
} else {
if (is_commented) {
- line_text = line_text.substr(1, line_text.length());
+ line_text = line_text.substr(delimiter.length(), line_text.length());
} else {
- line_text = "#" + line_text;
+ line_text = delimiter + line_text;
}
}
tx->set_line(i, line_text);
@@ -1074,10 +1081,10 @@ void ScriptTextEditor::_edit_option(int p_op) {
int begin = tx->cursor_get_line();
String line_text = tx->get_line(begin);
- if (line_text.begins_with("#"))
- line_text = line_text.substr(1, line_text.length());
+ if (line_text.begins_with(delimiter))
+ line_text = line_text.substr(delimiter.length(), line_text.length());
else
- line_text = "#" + line_text;
+ line_text = delimiter + line_text;
tx->set_line(begin, line_text);
}
tx->end_complex_operation();
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 9fd41c1064..b855d2d4c4 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -3389,6 +3389,8 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
preview_camera->set_toggle_mode(true);
preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE);
preview_camera->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
+ preview_camera->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -10 * EDSCALE);
+ preview_camera->set_h_grow_direction(GROW_DIRECTION_BEGIN);
preview_camera->set_text(TTR("preview"));
surface->add_child(preview_camera);
preview_camera->hide();
@@ -4751,9 +4753,9 @@ VSplitContainer *SpatialEditor::get_shader_split() {
return shader_split;
}
-HBoxContainer *SpatialEditor::get_palette_split() {
+HSplitContainer *SpatialEditor::get_palette_split() {
- return palette_split_container;
+ return palette_split;
}
void SpatialEditor::_request_gizmo(Object *p_obj) {
@@ -5044,10 +5046,6 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
palette_split->set_v_size_flags(SIZE_EXPAND_FILL);
vbc->add_child(palette_split);
- palette_split_container = memnew(HBoxContainer);
- palette_split_container->set_v_size_flags(SIZE_EXPAND_FILL);
- palette_split->add_child(palette_split_container);
-
shader_split = memnew(VSplitContainer);
shader_split->set_h_size_flags(SIZE_EXPAND_FILL);
palette_split->add_child(shader_split);
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index ab26a70f7f..0c2571017b 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -413,7 +413,6 @@ private:
SpatialEditorViewport *viewports[VIEWPORTS_COUNT];
VSplitContainer *shader_split;
HSplitContainer *palette_split;
- HBoxContainer *palette_split_container;
/////
@@ -608,7 +607,7 @@ public:
void add_control_to_menu_panel(Control *p_control);
VSplitContainer *get_shader_split();
- HBoxContainer *get_palette_split();
+ HSplitContainer *get_palette_split();
Spatial *get_selected() { return selected; }
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index e552e24c17..4d06342fe0 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -123,12 +123,14 @@ void TileMapEditor::_menu_option(int p_option) {
return;
undo_redo->create_action(TTR("Erase Selection"));
+ undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
- _set_cell(Point2i(j, i), TileMap::INVALID_CELL, false, false, false, true);
+ _set_cell(Point2i(j, i), TileMap::INVALID_CELL, false, false, false);
}
}
+ undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
undo_redo->commit_action();
selection_active = false;
@@ -171,7 +173,7 @@ void TileMapEditor::set_selected_tile(int p_tile) {
}
}
-void TileMapEditor::_set_cell(const Point2i &p_pos, int p_value, bool p_flip_h, bool p_flip_v, bool p_transpose, bool p_with_undo) {
+void TileMapEditor::_set_cell(const Point2i &p_pos, int p_value, bool p_flip_h, bool p_flip_v, bool p_transpose) {
ERR_FAIL_COND(!node);
@@ -184,17 +186,8 @@ void TileMapEditor::_set_cell(const Point2i &p_pos, int p_value, bool p_flip_h,
if (p_value == prev_val && p_flip_h == prev_flip_h && p_flip_v == prev_flip_v && p_transpose == prev_transpose)
return; //check that it's actually different
- if (p_with_undo) {
-
- undo_redo->add_do_method(node, "set_cellv", Point2(p_pos), p_value, p_flip_h, p_flip_v, p_transpose);
- undo_redo->add_do_method(node, "make_bitmask_area_dirty", Point2(p_pos));
- undo_redo->add_undo_method(node, "set_cellv", Point2(p_pos), prev_val, prev_flip_h, prev_flip_v, prev_transpose);
- undo_redo->add_undo_method(node, "make_bitmask_area_dirty", Point2(p_pos));
- } else {
-
- node->set_cell(p_pos.x, p_pos.y, p_value, p_flip_h, p_flip_v, p_transpose);
- node->update_bitmask_area(Point2(p_pos));
- }
+ node->set_cell(p_pos.x, p_pos.y, p_value, p_flip_h, p_flip_v, p_transpose);
+ node->update_bitmask_area(Point2(p_pos));
}
void TileMapEditor::_text_entered(const String &p_text) {
@@ -404,6 +397,7 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era
}
PoolVector<Vector2> points;
+ Vector<Vector2> non_preview_cache;
int count = 0;
int limit = 0;
@@ -432,8 +426,10 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era
bucket_cache_visited[loc] = true;
bucket_cache.push_back(n);
} else {
- node->set_cellv(n, id, flip_h, flip_v, transpose);
+ if (non_preview_cache.find(n) >= 0)
+ continue;
points.push_back(n);
+ non_preview_cache.push_back(n);
}
bucket_queue.push_back(Point2i(n.x, n.y + 1));
@@ -462,9 +458,10 @@ void TileMapEditor::_fill_points(const PoolVector<Vector2> p_points, const Dicti
bool tr = p_op["transpose"];
for (int i = 0; i < len; i++) {
-
_set_cell(pr[i], id, xf, yf, tr);
+ node->make_bitmask_area_dirty(pr[i]);
}
+ node->update_dirty_bitmask();
}
void TileMapEditor::_erase_points(const PoolVector<Vector2> p_points) {
@@ -565,20 +562,19 @@ void TileMapEditor::_draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h
}
} else if (node->get_tile_origin() == TileMap::TILE_ORIGIN_CENTER) {
- rect.position += node->get_cell_size() / 2;
- Vector2 s = r.size;
+ Size2 cell_size = node->get_cell_size();
- Vector2 center = (s / 2) - tile_ofs;
+ rect.position += tile_ofs;
if (p_flip_h)
- rect.position.x -= s.x - center.x;
+ rect.position.x -= cell_size.x / 2;
else
- rect.position.x -= center.x;
+ rect.position.x += cell_size.x / 2;
if (p_flip_v)
- rect.position.y -= s.y - center.y;
+ rect.position.y -= cell_size.y / 2;
else
- rect.position.y -= center.y;
+ rect.position.y += cell_size.y / 2;
}
rect.position = p_xform.xform(rect.position);
@@ -731,10 +727,8 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
tool = TOOL_PAINTING;
- paint_undo.clear();
- paint_undo[over_tile] = _get_op_from_cell(over_tile);
-
- _set_cell(over_tile, id, flip_h, flip_v, transpose);
+ undo_redo->create_action(TTR("Paint TileMap"));
+ undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
}
} else if (tool == TOOL_PICKING) {
@@ -755,15 +749,9 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
int id = get_selected_tile();
- if (id != TileMap::INVALID_CELL && paint_undo.size()) {
-
- undo_redo->create_action(TTR("Paint TileMap"));
- for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
+ if (id != TileMap::INVALID_CELL) {
- Point2 p = E->key();
- undo_redo->add_do_method(node, "set_cellv", p, id, flip_h, flip_v, transpose);
- undo_redo->add_undo_method(node, "set_cellv", p, E->get().idx, E->get().xf, E->get().yf, E->get().tr);
- }
+ undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
undo_redo->commit_action();
paint_undo.clear();
@@ -775,10 +763,12 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (id != TileMap::INVALID_CELL) {
undo_redo->create_action(TTR("Line Draw"));
+ undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
- _set_cell(E->key(), id, flip_h, flip_v, transpose, true);
+ _set_cell(E->key(), id, flip_h, flip_v, transpose);
}
+ undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
undo_redo->commit_action();
paint_undo.clear();
@@ -792,12 +782,14 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (id != TileMap::INVALID_CELL) {
undo_redo->create_action(TTR("Rectangle Paint"));
+ undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
- _set_cell(Point2i(j, i), id, flip_h, flip_v, transpose, true);
+ _set_cell(Point2i(j, i), id, flip_h, flip_v, transpose);
}
}
+ undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
undo_redo->commit_action();
canvas_item_editor->update();
@@ -807,10 +799,12 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Point2 ofs = over_tile - rectangle.position;
undo_redo->create_action(TTR("Duplicate"));
+ undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) {
- _set_cell(E->get().pos + ofs, E->get().cell, E->get().flip_h, E->get().flip_v, E->get().transpose, true);
+ _set_cell(E->get().pos + ofs, E->get().cell, E->get().flip_h, E->get().flip_v, E->get().transpose);
}
+ undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
undo_redo->commit_action();
copydata.clear();
@@ -823,28 +817,23 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
} else if (tool == TOOL_BUCKET) {
- Dictionary pop;
- pop["id"] = node->get_cell(over_tile.x, over_tile.y);
- pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y);
- pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y);
- pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y);
-
PoolVector<Vector2> points = _bucket_fill(over_tile);
if (points.size() == 0)
return false;
+ undo_redo->create_action(TTR("Bucket Fill"));
+ undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
+
Dictionary op;
op["id"] = get_selected_tile();
op["flip_h"] = flip_h;
op["flip_v"] = flip_v;
op["transpose"] = transpose;
- undo_redo->create_action(TTR("Bucket Fill"));
-
- undo_redo->add_do_method(this, "_fill_points", points, op);
- undo_redo->add_undo_method(this, "_fill_points", points, pop);
+ _fill_points(points, op);
+ undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
undo_redo->commit_action();
// We want to keep the bucket-tool active
@@ -886,6 +875,9 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Point2 local = node->world_to_map(xform_inv.xform(mb->get_position()));
+ undo_redo->create_action(TTR("Erase TileMap"));
+ undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
+
if (mb->get_shift()) {
if (mb->get_control())
@@ -899,7 +891,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
tool = TOOL_ERASING;
- paint_undo[local] = _get_op_from_cell(local);
_set_cell(local, TileMap::INVALID_CELL);
}
@@ -909,18 +900,8 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
} else {
if (tool == TOOL_ERASING || tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) {
- if (paint_undo.size()) {
- undo_redo->create_action(TTR("Erase TileMap"));
- for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
-
- Point2 p = E->key();
- undo_redo->add_do_method(node, "set_cellv", p, TileMap::INVALID_CELL, false, false, false);
- undo_redo->add_undo_method(node, "set_cellv", p, E->get().idx, E->get().xf, E->get().yf, E->get().tr);
- }
-
- undo_redo->commit_action();
- paint_undo.clear();
- }
+ undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
+ undo_redo->commit_action();
if (tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) {
canvas_item_editor->update();
@@ -1007,10 +988,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Point2i pos = points[i];
- if (!paint_undo.has(pos)) {
- paint_undo[pos] = _get_op_from_cell(pos);
- }
-
_set_cell(pos, TileMap::INVALID_CELL);
}
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index ce58cc9708..b5f2618576 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -167,7 +167,7 @@ class TileMapEditor : public VBoxContainer {
void _update_palette();
void _menu_option(int p_option);
- void _set_cell(const Point2i &p_pos, int p_value, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false, bool p_with_undo = false);
+ void _set_cell(const Point2i &p_pos, int p_value, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false);
void _canvas_mouse_enter();
void _canvas_mouse_exit();
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index bbed7ff98d..eb2faa1ab1 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -1015,21 +1015,47 @@ void AutotileEditor::_on_tool_clicked(int p_tool) {
tile_set->autotile_clear_bitmask_map(get_current_tile());
workspace->update();
} else if (p_tool == SHAPE_DELETE) {
- if (!edited_collision_shape.is_null()) {
- Vector<TileSet::ShapeData> sd = tile_set->tile_get_shapes(get_current_tile());
- int index;
- for (int i = 0; i < sd.size(); i++) {
- if (sd[i].shape == edited_collision_shape) {
- index = i;
- break;
- }
- }
- if (index >= 0) {
- sd.remove(index);
- tile_set->tile_set_shapes(get_current_tile(), sd);
- edited_collision_shape.unref();
- current_shape.resize(0);
- workspace->update();
+ if (creating_shape) {
+ creating_shape = false;
+ current_shape.resize(0);
+ workspace->update();
+ } else {
+ switch (edit_mode) {
+ case EDITMODE_COLLISION: {
+ if (!edited_collision_shape.is_null()) {
+ Vector<TileSet::ShapeData> sd = tile_set->tile_get_shapes(get_current_tile());
+ int index;
+ for (int i = 0; i < sd.size(); i++) {
+ if (sd[i].shape == edited_collision_shape) {
+ index = i;
+ break;
+ }
+ }
+ if (index >= 0) {
+ sd.remove(index);
+ tile_set->tile_set_shapes(get_current_tile(), sd);
+ edited_collision_shape = Ref<ConcavePolygonShape2D>();
+ current_shape.resize(0);
+ workspace->update();
+ }
+ }
+ } break;
+ case EDITMODE_NAVIGATION: {
+ if (!edited_navigation_shape.is_null()) {
+ tile_set->autotile_set_navigation_polygon(get_current_tile(), Ref<NavigationPolygon>(), edited_shape_coord);
+ edited_navigation_shape = Ref<NavigationPolygon>();
+ current_shape.resize(0);
+ workspace->update();
+ }
+ } break;
+ case EDITMODE_OCCLUSION: {
+ if (!edited_occlusion_shape.is_null()) {
+ tile_set->autotile_set_light_occluder(get_current_tile(), Ref<OccluderPolygon2D>(), edited_shape_coord);
+ edited_occlusion_shape = Ref<OccluderPolygon2D>();
+ current_shape.resize(0);
+ workspace->update();
+ }
+ } break;
}
}
} else if (p_tool == ZOOM_OUT) {
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 43c7f33cbe..60d7e59991 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -213,7 +213,7 @@ private:
}
String sp = p.simplify_path();
project_path->set_text(sp);
- set_message(TTR(" ")); // just so it does not disappear
+ set_message(" "); // just so it does not disappear
get_ok()->call_deferred("grab_focus");
}
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index d573a44cdd..6f9454be2c 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -3081,7 +3081,7 @@ void PropertyEditor::update_tree() {
item->set_text(1, type + " ID: " + itos(id));
item->add_button(1, get_icon("EditResource", "EditorIcons"));
} else {
- item->set_text(1, "[Empty]");
+ item->set_text(1, TTR("[Empty]"));
}
if (has_icon(p.hint_string, "EditorIcons")) {
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 7705e4e1b9..a1c1ec3351 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1853,7 +1853,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
inspect_scene_tree->connect("cell_selected", this, "_scene_tree_selected");
inspect_scene_tree->connect("item_collapsed", this, "_scene_tree_folded");
- auto_switch_remote_scene_tree = EDITOR_DEF("debugger/auto_switch_to_remote_scene_tree", true);
+ auto_switch_remote_scene_tree = EDITOR_DEF("debugger/auto_switch_to_remote_scene_tree", false);
inspect_scene_tree_timeout = EDITOR_DEF("debugger/remote_scene_tree_refresh_interval", 1.0);
inspect_edited_object_timeout = EDITOR_DEF("debugger/remote_inspect_refresh_interval", 0.2);
inspected_object_id = 0;
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 853761f689..fccd0c51aa 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -406,13 +406,13 @@ EditorSettingsDialog::EditorSettingsDialog() {
shortcut_clear_button->connect("pressed", this, "_clear_shortcut_search_box");
shortcuts = memnew(Tree);
- vbc->add_margin_child("Shortcut List:", shortcuts, true);
+ vbc->add_margin_child(TTR("Shortcut List:"), shortcuts, true);
shortcuts->set_columns(2);
shortcuts->set_hide_root(true);
//shortcuts->set_hide_folding(true);
shortcuts->set_column_titles_visible(true);
- shortcuts->set_column_title(0, "Name");
- shortcuts->set_column_title(1, "Binding");
+ shortcuts->set_column_title(0, TTR("Name"));
+ shortcuts->set_column_title(1, TTR("Binding"));
shortcuts->connect("button_pressed", this, "_shortcut_button_pressed");
press_a_key = memnew(ConfirmationDialog);
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 7f95d16ba6..6e9ed0e318 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -798,7 +798,7 @@ bool BulletPhysicsServer::body_is_omitting_force_integration(RID p_body) const {
void BulletPhysicsServer::body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata) {
RigidBodyBullet *body = rigid_body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->set_force_integration_callback(p_receiver->get_instance_id(), p_method, p_udata);
+ body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(0), p_method, p_udata);
}
void BulletPhysicsServer::body_set_ray_pickable(RID p_body, bool p_enable) {
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 0132ef3c5d..21c24fabd8 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -144,7 +144,7 @@ bool GDNative::initialize() {
}
}
- Error err = OS::get_singleton()->open_dynamic_library(path, native_handle);
+ Error err = OS::get_singleton()->open_dynamic_library(path, native_handle,true);
if (err != OK) {
return false;
}
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index dfa5e720ae..6fbc309fa3 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -1332,7 +1332,7 @@ bool CSharpScript::_update_exports() {
while (top && top != native) {
const Vector<GDMonoField *> &fields = top->get_all_fields();
- for (int i = 0; i < fields.size(); i++) {
+ for (int i = fields.size() - 1; i >= 0; i--) {
GDMonoField *field = fields[i];
if (field->is_static()) {
@@ -1382,7 +1382,7 @@ bool CSharpScript::_update_exports() {
PropertyInfo prop_info = PropertyInfo(type, name, hint, hint_string, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE);
member_info[cname] = prop_info;
- exported_members_cache.push_back(prop_info);
+ exported_members_cache.push_front(prop_info);
if (tmp_object) {
exported_members_defval_cache[cname] = GDMonoMarshal::mono_object_to_variant(field->get_value(tmp_object));
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 8ab1cbc435..b05bb9ab09 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -37,7 +37,7 @@
#include "io/zip_io.h"
#include "os/file_access.h"
#include "os/os.h"
-#include "platform/osx/logo.gen.h"
+#include "platform/iphone/logo.gen.h"
#include "project_settings.h"
#include "string.h"
#include "version.h"
@@ -977,9 +977,7 @@ bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset
EditorExportPlatformIOS::EditorExportPlatformIOS() {
- ///@TODO need to create the correct logo
- // Ref<Image> img = memnew(Image(_iphone_logo));
- Ref<Image> img = memnew(Image(_osx_logo));
+ Ref<Image> img = memnew(Image(_iphone_logo));
logo.instance();
logo->create_from_image(img);
}
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index fbe3bd310d..f06657cd7b 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -394,12 +394,12 @@ void OSIPhone::alert(const String &p_alert, const String &p_title) {
iOS::alert(utf8_alert.get_data(), utf8_title.get_data());
}
-Error OSIPhone::open_dynamic_library(const String p_path, void *&p_library_handle) {
+Error OSIPhone::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
if (p_path.length() == 0) {
p_library_handle = RTLD_SELF;
return OK;
}
- return OS_Unix::open_dynamic_library(p_path, p_library_handle);
+ return OS_Unix::open_dynamic_library(p_path, p_library_handle, p_also_set_library_path);
}
Error OSIPhone::close_dynamic_library(void *p_library_handle) {
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index 1ef673765a..3f989b49be 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -155,7 +155,7 @@ public:
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle);
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false);
virtual Error close_dynamic_library(void *p_library_handle);
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 781e8de1ab..732ec910c0 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1483,7 +1483,7 @@ void OS_OSX::make_rendering_thread() {
Error OS_OSX::shell_open(String p_uri) {
- [[NSWorkspace sharedWorkspace] openURL:[[NSURL alloc] initWithString:[NSString stringWithUTF8String:p_uri.utf8().get_data()]]];
+ [[NSWorkspace sharedWorkspace] openURL:[[NSURL alloc] initWithString:[[NSString stringWithUTF8String:p_uri.utf8().get_data()] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]]];
return OK;
}
diff --git a/platform/uwp/logo.png b/platform/uwp/logo.png
index 4376abd563..9017a30636 100644
--- a/platform/uwp/logo.png
+++ b/platform/uwp/logo.png
Binary files differ
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 7c1f733974..9bcbb6ddb6 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -69,8 +69,26 @@ __attribute__((visibility("default"))) DWORD NvOptimusEnablement = 0x00000001;
#define WM_TOUCH 576
#endif
+static String format_error_message(DWORD id) {
+
+ LPWSTR messageBuffer = NULL;
+ size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL);
+
+ String msg = "Error "+itos(id)+": "+String(messageBuffer,size);
+
+ LocalFree(messageBuffer);
+
+ return msg;
+
+}
+
+
+
extern HINSTANCE godot_hinstance;
+
+
void RedirectIOToConsole() {
int hConHandle;
@@ -1588,10 +1606,23 @@ void OS_Windows::_update_window_style(bool repaint) {
}
}
-Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle) {
- p_library_handle = (void *)LoadLibrary(p_path.utf8().get_data());
+Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
+
+
+ DLL_DIRECTORY_COOKIE cookie;
+
+ if (p_also_set_library_path) {
+ cookie = AddDllDirectory(p_path.get_base_dir().c_str());
+ }
+
+ p_library_handle = (void *)LoadLibraryExW(p_path.c_str(), NULL, p_also_set_library_path ? LOAD_LIBRARY_SEARCH_DEFAULT_DIRS : 0);
+
+ if (p_also_set_library_path) {
+ RemoveDllDirectory(cookie);
+ }
+
if (!p_library_handle) {
- ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + String::num(GetLastError()));
+ ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + format_error_message(GetLastError()));
ERR_FAIL_V(ERR_CANT_OPEN);
}
return OK;
@@ -1954,7 +1985,7 @@ void OS_Windows::set_icon(const Ref<Image> &p_icon) {
bool OS_Windows::has_environment(const String &p_var) const {
- return getenv(p_var.utf8().get_data()) != NULL;
+ return _wgetenv(p_var.c_str()) != NULL;
};
String OS_Windows::get_environment(const String &p_var) const {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 4367297262..e98f8277df 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -212,7 +212,7 @@ public:
virtual void set_borderless_window(int p_borderless);
virtual bool get_borderless_window();
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle);
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle,bool p_also_set_library_path=false);
virtual Error close_dynamic_library(void *p_library_handle);
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false);
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index 55c055e34f..e1c7331393 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -117,29 +117,27 @@ void PathFollow2D::_update_transform() {
Vector2 pos = c->interpolate_baked(o, cubic);
- Vector2 offset = Vector2(h_offset, v_offset);
-
- Transform2D t = get_transform();
- t.set_origin(pos);
+ Vector2 displacement_offset = Vector2(h_offset, v_offset);
if (rotate) {
Vector2 t_prev = (pos - c->interpolate_baked(o - delta_offset, cubic)).normalized();
- Vector2 t_cur = (c->interpolate_baked(o + delta_offset, cubic) - pos).normalized();
+ Vector2 t_next = (c->interpolate_baked(o + delta_offset, cubic) - pos).normalized();
- float dot = t_prev.dot(t_cur);
- float angle = Math::acos(CLAMP(dot, -1, 1));
+ float angle = t_prev.angle_to(t_next);
- t.rotate(angle);
+ set_rotation(get_rotation() + angle);
- t.translate(offset);
+ Vector2 n = t_next;
+ Vector2 t = -n.tangent();
+ pos += n * h_offset + t * v_offset;
} else {
- t.set_origin(t.get_origin() + offset);
+ pos += displacement_offset;
}
- set_transform(t);
+ set_position(pos);
}
void PathFollow2D::_notification(int p_what) {
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index 6ab20efdcc..a809023083 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -120,11 +120,11 @@ void RayCast2D::set_exclude_parent_body(bool p_exclude_parent_body) {
if (!is_inside_tree())
return;
- if (Object::cast_to<PhysicsBody2D>(get_parent())) {
+ if (Object::cast_to<CollisionObject2D>(get_parent())) {
if (exclude_parent_body)
- exclude.insert(Object::cast_to<PhysicsBody2D>(get_parent())->get_rid());
+ exclude.insert(Object::cast_to<CollisionObject2D>(get_parent())->get_rid());
else
- exclude.erase(Object::cast_to<PhysicsBody2D>(get_parent())->get_rid());
+ exclude.erase(Object::cast_to<CollisionObject2D>(get_parent())->get_rid());
}
}
@@ -144,11 +144,11 @@ void RayCast2D::_notification(int p_what) {
else
set_physics_process(false);
- if (Object::cast_to<PhysicsBody2D>(get_parent())) {
+ if (Object::cast_to<CollisionObject2D>(get_parent())) {
if (exclude_parent_body)
- exclude.insert(Object::cast_to<PhysicsBody2D>(get_parent())->get_rid());
+ exclude.insert(Object::cast_to<CollisionObject2D>(get_parent())->get_rid());
else
- exclude.erase(Object::cast_to<PhysicsBody2D>(get_parent())->get_rid());
+ exclude.erase(Object::cast_to<CollisionObject2D>(get_parent())->get_rid());
}
} break;
case NOTIFICATION_EXIT_TREE: {
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 2329ce8644..c0d0a6e011 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -215,6 +215,9 @@ void TileMap::_fix_cell_transform(Transform2D &xform, const Cell &p_cell, const
if (tile_origin == TILE_ORIGIN_BOTTOM_LEFT)
offset.y += cell_size.y;
+ else if (tile_origin == TILE_ORIGIN_CENTER) {
+ offset += cell_size / 2;
+ }
if (s.y > s.x) {
if ((p_cell.flip_h && (p_cell.flip_v || p_cell.transpose)) || (p_cell.flip_v && !p_cell.transpose))
@@ -235,6 +238,8 @@ void TileMap::_fix_cell_transform(Transform2D &xform, const Cell &p_cell, const
xform.elements[1].x = -xform.elements[1].x;
if (tile_origin == TILE_ORIGIN_TOP_LEFT || tile_origin == TILE_ORIGIN_BOTTOM_LEFT)
offset.x = s.x - offset.x;
+ else if (tile_origin == TILE_ORIGIN_CENTER)
+ offset.x = s.x - offset.x / 2;
}
if (p_cell.flip_v) {
xform.elements[0].y = -xform.elements[0].y;
@@ -242,10 +247,9 @@ void TileMap::_fix_cell_transform(Transform2D &xform, const Cell &p_cell, const
if (tile_origin == TILE_ORIGIN_TOP_LEFT)
offset.y = s.y - offset.y;
else if (tile_origin == TILE_ORIGIN_BOTTOM_LEFT) {
- if (p_cell.transpose)
- offset.y += s.y;
- else
- offset.y -= s.y;
+ offset.y += s.y;
+ } else if (tile_origin == TILE_ORIGIN_CENTER) {
+ offset.y += s.y;
}
}
xform.elements[2].x += offset.x;
@@ -429,20 +433,18 @@ void TileMap::_update_dirty_quadrants() {
}
} else if (tile_origin == TILE_ORIGIN_CENTER) {
- rect.position += tcenter;
- Vector2 center = (s / 2) - tile_ofs;
- center_ofs = tcenter - (s / 2);
+ rect.position += tile_ofs;
if (c.flip_h)
- rect.position.x -= s.x - center.x;
+ rect.position.x -= cell_size.x / 2;
else
- rect.position.x -= center.x;
+ rect.position.x += cell_size.x / 2;
if (c.flip_v)
- rect.position.y -= s.y - center.y;
+ rect.position.y -= cell_size.y / 2;
else
- rect.position.y -= center.y;
+ rect.position.y += cell_size.y / 2;
}
Ref<Texture> normal_map = tile_set->tile_get_normal_map(c.id);
@@ -714,7 +716,7 @@ void TileMap::set_cell(int p_x, int p_y, int p_tile, bool p_flip_x, bool p_flip_
} else {
ERR_FAIL_COND(!Q); // quadrant should exist...
- if (E->get().id == p_tile && E->get().flip_h == p_flip_x && E->get().flip_v == p_flip_y && E->get().transpose == p_transpose)
+ if (E->get().id == p_tile && E->get().flip_h == p_flip_x && E->get().flip_v == p_flip_y && E->get().transpose == p_transpose && E->get().autotile_coord_x == (uint16_t)p_autotile_coord.x && E->get().autotile_coord_y == (uint16_t)p_autotile_coord.y)
return; //nothing changed
}
@@ -739,7 +741,7 @@ int TileMap::get_cellv(const Vector2 &p_pos) const {
void TileMap::make_bitmask_area_dirty(const Vector2 &p_pos) {
for (int x = p_pos.x - 1; x <= p_pos.x + 1; x++) {
- for (int y = p_pos.y - 1; x <= p_pos.y + 1; y++) {
+ for (int y = p_pos.y - 1; y <= p_pos.y + 1; y++) {
PosKey p(x, y);
if (dirty_bitmask.find(p) == NULL) {
dirty_bitmask.push_back(p);
@@ -808,6 +810,10 @@ void TileMap::update_cell_bitmask(int p_x, int p_y) {
Vector2 coord = tile_set->autotile_get_subtile_for_bitmask(id, mask, this, Vector2(p_x, p_y));
E->get().autotile_coord_x = (int)coord.x;
E->get().autotile_coord_y = (int)coord.y;
+
+ PosKey qk(p_x / _get_quadrant_size(), p_y / _get_quadrant_size());
+ Map<PosKey, Quadrant>::Element *Q = quadrant_map.find(qk);
+ _make_quadrant_dirty(Q);
} else {
E->get().autotile_coord_x = 0;
E->get().autotile_coord_y = 0;
@@ -868,28 +874,31 @@ bool TileMap::is_cell_transposed(int p_x, int p_y) const {
return E->get().transpose;
}
-int TileMap::get_cell_autotile_coord_x(int p_x, int p_y) const {
+void TileMap::set_cell_autotile_coord(int p_x, int p_y, const Vector2 &p_coord) {
PosKey pk(p_x, p_y);
const Map<PosKey, Cell>::Element *E = tile_map.find(pk);
if (!E)
- return 0;
+ return;
- return E->get().autotile_coord_x;
+ Cell c = E->get();
+ c.autotile_coord_x = p_coord.x;
+ c.autotile_coord_y = p_coord.y;
+ tile_map[pk] = c;
}
-int TileMap::get_cell_autotile_coord_y(int p_x, int p_y) const {
+Vector2 TileMap::get_cell_autotile_coord(int p_x, int p_y) const {
PosKey pk(p_x, p_y);
const Map<PosKey, Cell>::Element *E = tile_map.find(pk);
if (!E)
- return 0;
+ return Vector2();
- return E->get().autotile_coord_y;
+ return Vector2(E->get().autotile_coord_x, E->get().autotile_coord_y);
}
void TileMap::_recreate_quadrants() {
@@ -961,6 +970,7 @@ void TileMap::_set_tile_data(const PoolVector<int> &p_data) {
int offset = (format == FORMAT_2_1_5) ? 3 : 2;
+ clear();
for (int i = 0; i < c; i += offset) {
const uint8_t *ptr = (const uint8_t *)&r[i];
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index a0ca2e6a35..8eecf48df2 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -241,8 +241,8 @@ public:
bool is_cell_x_flipped(int p_x, int p_y) const;
bool is_cell_y_flipped(int p_x, int p_y) const;
bool is_cell_transposed(int p_x, int p_y) const;
- int get_cell_autotile_coord_x(int p_x, int p_y) const;
- int get_cell_autotile_coord_y(int p_x, int p_y) const;
+ void set_cell_autotile_coord(int p_x, int p_y, const Vector2 &p_coord);
+ Vector2 get_cell_autotile_coord(int p_x, int p_y) const;
void set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x = false, bool p_flip_y = false, bool p_transpose = false);
int get_cellv(const Vector2 &p_pos) const;
diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp
index aebdcaf183..faeb18691a 100644
--- a/scene/3d/ray_cast.cpp
+++ b/scene/3d/ray_cast.cpp
@@ -119,6 +119,29 @@ bool RayCast::is_enabled() const {
return enabled;
}
+void RayCast::set_exclude_parent_body(bool p_exclude_parent_body) {
+
+ if (exclude_parent_body == p_exclude_parent_body)
+ return;
+
+ exclude_parent_body = p_exclude_parent_body;
+
+ if (!is_inside_tree())
+ return;
+
+ if (Object::cast_to<CollisionObject>(get_parent())) {
+ if (exclude_parent_body)
+ exclude.insert(Object::cast_to<CollisionObject>(get_parent())->get_rid());
+ else
+ exclude.erase(Object::cast_to<CollisionObject>(get_parent())->get_rid());
+ }
+}
+
+bool RayCast::get_exclude_parent_body() const {
+
+ return exclude_parent_body;
+}
+
void RayCast::_notification(int p_what) {
switch (p_what) {
@@ -133,6 +156,13 @@ void RayCast::_notification(int p_what) {
} else
set_physics_process(false);
+ if (Object::cast_to<CollisionObject>(get_parent())) {
+ if (exclude_parent_body)
+ exclude.insert(Object::cast_to<CollisionObject>(get_parent())->get_rid());
+ else
+ exclude.erase(Object::cast_to<CollisionObject>(get_parent())->get_rid());
+ }
+
} break;
case NOTIFICATION_EXIT_TREE: {
@@ -256,7 +286,11 @@ void RayCast::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &RayCast::set_collision_mask_bit);
ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &RayCast::get_collision_mask_bit);
+ ClassDB::bind_method(D_METHOD("set_exclude_parent_body", "mask"), &RayCast::set_exclude_parent_body);
+ ClassDB::bind_method(D_METHOD("get_exclude_parent_body"), &RayCast::get_exclude_parent_body);
+
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "exclude_parent"), "set_exclude_parent_body", "get_exclude_parent_body");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "cast_to"), "set_cast_to", "get_cast_to");
ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
}
@@ -332,4 +366,5 @@ RayCast::RayCast() {
collision_mask = 1;
cast_to = Vector3(0, -1, 0);
debug_shape = NULL;
+ exclude_parent_body = true;
}
diff --git a/scene/3d/ray_cast.h b/scene/3d/ray_cast.h
index ca94580271..9fb1a1be67 100644
--- a/scene/3d/ray_cast.h
+++ b/scene/3d/ray_cast.h
@@ -48,6 +48,7 @@ class RayCast : public Spatial {
Set<RID> exclude;
uint32_t collision_mask;
+ bool exclude_parent_body;
Node *debug_shape;
Ref<Material> debug_material;
@@ -74,6 +75,9 @@ public:
void set_collision_mask_bit(int p_bit, bool p_value);
bool get_collision_mask_bit(int p_bit) const;
+ void set_exclude_parent_body(bool p_exclude_parent_body);
+ bool get_exclude_parent_body() const;
+
void force_raycast_update();
bool is_colliding() const;
Object *get_collider() const;
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 9bfb70bf42..8af499fd96 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -47,13 +47,7 @@ void FileDialog::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
refresh->set_icon(get_icon("reload"));
- dir_up->set_icon(get_icon("ArrowUp", "EditorIcons"));
- }
-
- if (p_what == NOTIFICATION_DRAW) {
-
- //RID ci = get_canvas_item();
- //get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
+ dir_up->set_icon(get_icon("parent_folder"));
}
if (p_what == NOTIFICATION_POPUP_HIDE) {
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index d8baa7834d..cae368aeca 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2121,7 +2121,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
for (int i = 0; i < N->get()->get_child_count(); ++i) {
// Skip nodes not really belonging to the instanced hierarchy; they'll be processed normally later
- if (get_child(i)->data.owner != this)
+ if (N->get()->get_child(i)->data.owner != this)
continue;
node_tree.push_back(N->get()->get_child(i));
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 36988e0c4c..c5feecd7c4 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -556,6 +556,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
// File Dialog
theme->set_icon("reload", "FileDialog", make_icon(icon_reload_png));
+ theme->set_icon("parent_folder", "FileDialog", make_icon(icon_parent_folder_png));
// Popup
diff --git a/scene/resources/default_theme/icon_parent_folder.png b/scene/resources/default_theme/icon_parent_folder.png
new file mode 100644
index 0000000000..47fee1ad81
--- /dev/null
+++ b/scene/resources/default_theme/icon_parent_folder.png
Binary files differ
diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h
index 38e5f58b0d..255bb4c6dd 100644
--- a/scene/resources/default_theme/theme_data.h
+++ b/scene/resources/default_theme/theme_data.h
@@ -174,6 +174,10 @@ static const unsigned char icon_folder_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x6, 0x0, 0x0, 0x0, 0x1f, 0xf3, 0xff, 0x61, 0x0, 0x0, 0x0, 0x6, 0x62, 0x4b, 0x47, 0x44, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0xa0, 0xbd, 0xa7, 0x93, 0x0, 0x0, 0x0, 0x5f, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xed, 0x8f, 0xc1, 0xd, 0x80, 0x30, 0x8, 0x45, 0x9f, 0x9d, 0x84, 0x39, 0x4c, 0x3b, 0xbd, 0x75, 0x8f, 0x32, 0x9, 0x5e, 0xec, 0xa5, 0x9, 0xa4, 0xc6, 0x26, 0x5e, 0x7c, 0x17, 0xe, 0xc0, 0xe3, 0x3, 0x5f, 0xb3, 0x1, 0xb4, 0xd6, 0x4e, 0x60, 0x77, 0x66, 0xaa, 0x88, 0x14, 0x4f, 0x90, 0xee, 0xea, 0x2d, 0x3, 0xe4, 0x28, 0x41, 0x8a, 0x9a, 0x1d, 0x55, 0x75, 0x25, 0xfd, 0x5, 0x9b, 0x11, 0xd, 0x54, 0x11, 0x29, 0x53, 0x9, 0x1c, 0x32, 0x4c, 0xbe, 0x10, 0xf1, 0xb, 0x16, 0xa, 0xea, 0xd3, 0x45, 0x33, 0x3b, 0xde, 0x1e, 0x5f, 0xc3, 0x5, 0x1f, 0xc5, 0x12, 0x2c, 0xc5, 0x88, 0xe1, 0xb4, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
+static const unsigned char icon_parent_folder_png[] = {
+ 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x6, 0x0, 0x0, 0x0, 0x1f, 0xf3, 0xff, 0x61, 0x0, 0x0, 0x0, 0x4, 0x73, 0x42, 0x49, 0x54, 0x8, 0x8, 0x8, 0x8, 0x7c, 0x8, 0x64, 0x88, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xe, 0xc4, 0x0, 0x0, 0xe, 0xc4, 0x1, 0x95, 0x2b, 0xe, 0x1b, 0x0, 0x0, 0x0, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x0, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63, 0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, 0xee, 0x3c, 0x1a, 0x0, 0x0, 0x0, 0xc6, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xdd, 0x90, 0xbd, 0x6a, 0x2, 0x51, 0x10, 0x46, 0xcf, 0x8c, 0xbb, 0xaf, 0x10, 0xdb, 0xcb, 0x2e, 0x4b, 0x40, 0xf2, 0x14, 0x51, 0x8b, 0x3c, 0x70, 0x44, 0x48, 0x48, 0x15, 0x4c, 0x61, 0x67, 0xd2, 0x4, 0x96, 0xb, 0x5b, 0x89, 0x58, 0x59, 0xee, 0x8f, 0x3b, 0x36, 0xbb, 0x8d, 0x78, 0xa3, 0x92, 0x4a, 0x4f, 0xf9, 0xcd, 0xcc, 0x99, 0x61, 0xe0, 0xe6, 0x91, 0x50, 0xc1, 0x7b, 0x3f, 0x54, 0xd5, 0x39, 0x60, 0x6d, 0xdb, 0xbe, 0x24, 0x49, 0xb2, 0xb9, 0x58, 0x90, 0xe7, 0xf9, 0x43, 0x1c, 0xc7, 0xef, 0x66, 0xf6, 0xd4, 0x45, 0xbf, 0xc0, 0xb3, 0x73, 0x6e, 0x7d, 0x56, 0x70, 0x62, 0xb8, 0xe7, 0xa4, 0x44, 0x8f, 0xcf, 0x8e, 0xa2, 0xe8, 0xa3, 0x1b, 0xfe, 0xee, 0x62, 0x13, 0x91, 0x1f, 0xe0, 0x11, 0x78, 0xf3, 0xde, 0xf, 0x83, 0x2, 0x55, 0x9d, 0x1, 0x23, 0x60, 0xd5, 0x34, 0xcd, 0xb4, 0xcf, 0xab, 0xaa, 0x1a, 0x77, 0xc2, 0x91, 0xaa, 0xbe, 0x6, 0x5, 0xc0, 0xe, 0xf8, 0x2a, 0xcb, 0x72, 0x92, 0xa6, 0xe9, 0xb6, 0xf, 0xb3, 0x2c, 0xdb, 0xd6, 0x75, 0x3d, 0x11, 0x91, 0x25, 0x50, 0xfe, 0xf9, 0x83, 0x1e, 0x33, 0x93, 0xa2, 0x28, 0xf6, 0x80, 0x39, 0xe7, 0x6, 0xa1, 0xbe, 0xe3, 0xb, 0xae, 0x26, 0x28, 0x10, 0x11, 0x3, 0x16, 0x22, 0xf2, 0xf9, 0xdf, 0x25, 0xf7, 0xce, 0x1, 0x9e, 0x13, 0x48, 0xe9, 0x87, 0xc5, 0x3a, 0xd2, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+};
+
static const unsigned char icon_play_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x6, 0x0, 0x0, 0x0, 0x1f, 0xf3, 0xff, 0x61, 0x0, 0x0, 0x0, 0x6, 0x62, 0x4b, 0x47, 0x44, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0xa0, 0xbd, 0xa7, 0x93, 0x0, 0x0, 0x0, 0xa2, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x60, 0x18, 0xf2, 0x80, 0x11, 0x99, 0xf3, 0xe0, 0xc1, 0x83, 0xc3, 0xc, 0xc, 0xc, 0xc2, 0xc, 0xc, 0xc, 0xa5, 0xa, 0xa, 0xa, 0x5b, 0xc9, 0x31, 0xe0, 0x3f, 0x5c, 0x82, 0x91, 0x71, 0x27, 0x3, 0x3, 0x43, 0x91, 0xbc, 0xbc, 0xfc, 0x35, 0x7c, 0x6, 0x30, 0xe1, 0x92, 0xf8, 0xff, 0xff, 0xbf, 0xfb, 0xff, 0xff, 0xff, 0x2f, 0x3e, 0x78, 0xf0, 0x60, 0xca, 0x93, 0x27, 0x4f, 0x84, 0x49, 0x76, 0x1, 0x1a, 0xf8, 0xc0, 0xc8, 0xc8, 0xd8, 0xf1, 0xeb, 0xd7, 0xaf, 0x9, 0xaa, 0xaa, 0xaa, 0x3f, 0x89, 0x72, 0x1, 0x1a, 0x10, 0xf8, 0xff, 0xff, 0x7f, 0x7, 0x2b, 0x2b, 0xeb, 0x1e, 0x74, 0x9, 0x62, 0xd, 0xc0, 0x9, 0x88, 0x35, 0xe0, 0x3d, 0x23, 0x23, 0x63, 0xc5, 0xef, 0xdf, 0xbf, 0x5d, 0xd0, 0x25, 0x58, 0x8, 0x68, 0xfc, 0xc3, 0xc0, 0xc0, 0x30, 0x93, 0x85, 0x85, 0xa5, 0x5e, 0x46, 0x46, 0xe6, 0x2d, 0x36, 0x5, 0x38, 0xd, 0x20, 0x36, 0x1a, 0xd1, 0xd, 0x38, 0xc2, 0x0, 0x4d, 0x48, 0xf2, 0xf2, 0xf2, 0x44, 0x25, 0xa4, 0x61, 0x0, 0x0, 0x1e, 0x57, 0x33, 0x3c, 0xcc, 0xe7, 0x34, 0x69, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 49f974790f..1573fab7b6 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -86,7 +86,7 @@ Files extracted from upstream source:
## glad
- Upstream: https://github.com/Dav1dde/glad
-- Version: 0.1.14a0
+- Version: 0.1.16a0
- License: MIT
The files we package are automatically generated.
diff --git a/thirdparty/glad/KHR/khrplatform.h b/thirdparty/glad/KHR/khrplatform.h
index 07b61b9bd6..1ad3554a76 100644
--- a/thirdparty/glad/KHR/khrplatform.h
+++ b/thirdparty/glad/KHR/khrplatform.h
@@ -102,8 +102,7 @@
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#elif defined(__ANDROID__)
-# include <sys/cdefs.h>
-# define KHRONOS_APICALL __attribute__((visibility("default"))) __NDK_FPABI__
+# define KHRONOS_APICALL __attribute__((visibility("default")))
#else
# define KHRONOS_APICALL
#endif
diff --git a/thirdparty/glad/glad.c b/thirdparty/glad/glad.c
index 2d756ec3f6..f87ec8cf93 100644
--- a/thirdparty/glad/glad.c
+++ b/thirdparty/glad/glad.c
@@ -1,6 +1,6 @@
/*
- OpenGL loader generated by glad 0.1.14a0 on Wed Jun 14 20:12:45 2017.
+ OpenGL loader generated by glad 0.1.16a0 on Thu Nov 30 06:21:28 2017.
Language/Generator: C/C++
Specification: gl
@@ -92,7 +92,7 @@ int open_gl(void) {
}
static
-void close_gl() {
+void close_gl(void) {
if(libGL != NULL) {
dlclose(libGL);
libGL = NULL;
@@ -165,7 +165,18 @@ static int get_exts(void) {
}
for(index = 0; index < (unsigned)num_exts_i; index++) {
- exts_i[index] = (const char*)glGetStringi(GL_EXTENSIONS, index);
+ const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index);
+ size_t len = strlen(gl_str_tmp);
+
+ char *local_str = (char*)malloc((len+1) * sizeof(*exts_i));
+ if(local_str != NULL) {
+#if _MSC_VER >= 1400
+ strncpy_s(local_str, len+1, gl_str_tmp, len);
+#else
+ strncpy(local_str, gl_str_tmp, len+1);
+#endif
+ }
+ exts_i[index] = local_str;
}
}
#endif
@@ -174,6 +185,10 @@ static int get_exts(void) {
static void free_exts(void) {
if (exts_i != NULL) {
+ int index;
+ for(index = 0; index < num_exts_i; index++) {
+ free((char *)exts_i[index]);
+ }
free((void *)exts_i);
exts_i = NULL;
}
@@ -207,11 +222,11 @@ static int has_ext(const char *ext) {
#ifdef _GLAD_IS_SOME_NEW_VERSION
} else {
int index;
-
+ if(exts_i == NULL) return 0;
for(index = 0; index < num_exts_i; index++) {
const char *e = exts_i[index];
- if(strcmp(e, ext) == 0) {
+ if(exts_i[index] != NULL && strcmp(e, ext) == 0) {
return 1;
}
}
diff --git a/thirdparty/glad/glad/glad.h b/thirdparty/glad/glad/glad.h
index cb78df071e..69413ef65f 100644
--- a/thirdparty/glad/glad/glad.h
+++ b/thirdparty/glad/glad/glad.h
@@ -1,6 +1,6 @@
/*
- OpenGL loader generated by glad 0.1.14a0 on Wed Jun 14 20:12:45 2017.
+ OpenGL loader generated by glad 0.1.16a0 on Thu Nov 30 06:21:28 2017.
Language/Generator: C/C++
Specification: gl
@@ -31,6 +31,9 @@
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
+#ifndef NOMINMAX
+#define NOMINMAX 1
+#endif
#include <windows.h>
#endif
@@ -139,6 +142,7 @@ typedef float GLfloat;
typedef float GLclampf;
typedef double GLdouble;
typedef double GLclampd;
+typedef void *GLeglClientBufferEXT;
typedef void *GLeglImageOES;
typedef char GLchar;
typedef char GLcharARB;
@@ -888,15 +892,17 @@ typedef void (APIENTRY *GLVULKANPROCNV)(void);
#define GL_TEXTURE_FILTER_CONTROL 0x8500
#define GL_DEPTH_TEXTURE_MODE 0x884B
#define GL_COMPARE_R_TO_TEXTURE 0x884E
-#define GL_FUNC_ADD 0x8006
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#define GL_MIN 0x8007
-#define GL_MAX 0x8008
+#define GL_BLEND_COLOR 0x8005
+#define GL_BLEND_EQUATION 0x8009
#define GL_CONSTANT_COLOR 0x8001
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
#define GL_CONSTANT_ALPHA 0x8003
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_FUNC_ADD 0x8006
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
#define GL_BUFFER_SIZE 0x8764
#define GL_BUFFER_USAGE 0x8765
#define GL_QUERY_COUNTER_BITS 0x8864
@@ -1504,10 +1510,10 @@ GLAPI PFNGLDISABLEPROC glad_glDisable;
typedef void (APIENTRYP PFNGLENABLEPROC)(GLenum cap);
GLAPI PFNGLENABLEPROC glad_glEnable;
#define glEnable glad_glEnable
-typedef void (APIENTRYP PFNGLFINISHPROC)();
+typedef void (APIENTRYP PFNGLFINISHPROC)(void);
GLAPI PFNGLFINISHPROC glad_glFinish;
#define glFinish glad_glFinish
-typedef void (APIENTRYP PFNGLFLUSHPROC)();
+typedef void (APIENTRYP PFNGLFLUSHPROC)(void);
GLAPI PFNGLFLUSHPROC glad_glFlush;
#define glFlush glad_glFlush
typedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor);
@@ -1543,7 +1549,7 @@ GLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv;
typedef void (APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble *data);
GLAPI PFNGLGETDOUBLEVPROC glad_glGetDoublev;
#define glGetDoublev glad_glGetDoublev
-typedef GLenum (APIENTRYP PFNGLGETERRORPROC)();
+typedef GLenum (APIENTRYP PFNGLGETERRORPROC)(void);
GLAPI PFNGLGETERRORPROC glad_glGetError;
#define glGetError glad_glGetError
typedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data);
@@ -1582,7 +1588,7 @@ GLAPI PFNGLVIEWPORTPROC glad_glViewport;
typedef void (APIENTRYP PFNGLNEWLISTPROC)(GLuint list, GLenum mode);
GLAPI PFNGLNEWLISTPROC glad_glNewList;
#define glNewList glad_glNewList
-typedef void (APIENTRYP PFNGLENDLISTPROC)();
+typedef void (APIENTRYP PFNGLENDLISTPROC)(void);
GLAPI PFNGLENDLISTPROC glad_glEndList;
#define glEndList glad_glEndList
typedef void (APIENTRYP PFNGLCALLLISTPROC)(GLuint list);
@@ -1708,7 +1714,7 @@ GLAPI PFNGLEDGEFLAGPROC glad_glEdgeFlag;
typedef void (APIENTRYP PFNGLEDGEFLAGVPROC)(const GLboolean *flag);
GLAPI PFNGLEDGEFLAGVPROC glad_glEdgeFlagv;
#define glEdgeFlagv glad_glEdgeFlagv
-typedef void (APIENTRYP PFNGLENDPROC)();
+typedef void (APIENTRYP PFNGLENDPROC)(void);
GLAPI PFNGLENDPROC glad_glEnd;
#define glEnd glad_glEnd
typedef void (APIENTRYP PFNGLINDEXDPROC)(GLdouble c);
@@ -2131,7 +2137,7 @@ GLAPI PFNGLSELECTBUFFERPROC glad_glSelectBuffer;
typedef GLint (APIENTRYP PFNGLRENDERMODEPROC)(GLenum mode);
GLAPI PFNGLRENDERMODEPROC glad_glRenderMode;
#define glRenderMode glad_glRenderMode
-typedef void (APIENTRYP PFNGLINITNAMESPROC)();
+typedef void (APIENTRYP PFNGLINITNAMESPROC)(void);
GLAPI PFNGLINITNAMESPROC glad_glInitNames;
#define glInitNames glad_glInitNames
typedef void (APIENTRYP PFNGLLOADNAMEPROC)(GLuint name);
@@ -2140,7 +2146,7 @@ GLAPI PFNGLLOADNAMEPROC glad_glLoadName;
typedef void (APIENTRYP PFNGLPASSTHROUGHPROC)(GLfloat token);
GLAPI PFNGLPASSTHROUGHPROC glad_glPassThrough;
#define glPassThrough glad_glPassThrough
-typedef void (APIENTRYP PFNGLPOPNAMEPROC)();
+typedef void (APIENTRYP PFNGLPOPNAMEPROC)(void);
GLAPI PFNGLPOPNAMEPROC glad_glPopName;
#define glPopName glad_glPopName
typedef void (APIENTRYP PFNGLPUSHNAMEPROC)(GLuint name);
@@ -2158,7 +2164,7 @@ GLAPI PFNGLINDEXMASKPROC glad_glIndexMask;
typedef void (APIENTRYP PFNGLACCUMPROC)(GLenum op, GLfloat value);
GLAPI PFNGLACCUMPROC glad_glAccum;
#define glAccum glad_glAccum
-typedef void (APIENTRYP PFNGLPOPATTRIBPROC)();
+typedef void (APIENTRYP PFNGLPOPATTRIBPROC)(void);
GLAPI PFNGLPOPATTRIBPROC glad_glPopAttrib;
#define glPopAttrib glad_glPopAttrib
typedef void (APIENTRYP PFNGLPUSHATTRIBPROC)(GLbitfield mask);
@@ -2308,7 +2314,7 @@ GLAPI PFNGLISLISTPROC glad_glIsList;
typedef void (APIENTRYP PFNGLFRUSTUMPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
GLAPI PFNGLFRUSTUMPROC glad_glFrustum;
#define glFrustum glad_glFrustum
-typedef void (APIENTRYP PFNGLLOADIDENTITYPROC)();
+typedef void (APIENTRYP PFNGLLOADIDENTITYPROC)(void);
GLAPI PFNGLLOADIDENTITYPROC glad_glLoadIdentity;
#define glLoadIdentity glad_glLoadIdentity
typedef void (APIENTRYP PFNGLLOADMATRIXFPROC)(const GLfloat *m);
@@ -2329,10 +2335,10 @@ GLAPI PFNGLMULTMATRIXDPROC glad_glMultMatrixd;
typedef void (APIENTRYP PFNGLORTHOPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
GLAPI PFNGLORTHOPROC glad_glOrtho;
#define glOrtho glad_glOrtho
-typedef void (APIENTRYP PFNGLPOPMATRIXPROC)();
+typedef void (APIENTRYP PFNGLPOPMATRIXPROC)(void);
GLAPI PFNGLPOPMATRIXPROC glad_glPopMatrix;
#define glPopMatrix glad_glPopMatrix
-typedef void (APIENTRYP PFNGLPUSHMATRIXPROC)();
+typedef void (APIENTRYP PFNGLPUSHMATRIXPROC)(void);
GLAPI PFNGLPUSHMATRIXPROC glad_glPushMatrix;
#define glPushMatrix glad_glPushMatrix
typedef void (APIENTRYP PFNGLROTATEDPROC)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
@@ -2441,7 +2447,7 @@ GLAPI PFNGLINDEXUBPROC glad_glIndexub;
typedef void (APIENTRYP PFNGLINDEXUBVPROC)(const GLubyte *c);
GLAPI PFNGLINDEXUBVPROC glad_glIndexubv;
#define glIndexubv glad_glIndexubv
-typedef void (APIENTRYP PFNGLPOPCLIENTATTRIBPROC)();
+typedef void (APIENTRYP PFNGLPOPCLIENTATTRIBPROC)(void);
GLAPI PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib;
#define glPopClientAttrib glad_glPopClientAttrib
typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBPROC)(GLbitfield mask);
@@ -2839,7 +2845,7 @@ GLAPI PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation;
typedef void (APIENTRYP PFNGLCOMPILESHADERPROC)(GLuint shader);
GLAPI PFNGLCOMPILESHADERPROC glad_glCompileShader;
#define glCompileShader glad_glCompileShader
-typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC)();
+typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC)(void);
GLAPI PFNGLCREATEPROGRAMPROC glad_glCreateProgram;
#define glCreateProgram glad_glCreateProgram
typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC)(GLenum type);
@@ -3141,7 +3147,7 @@ GLAPI PFNGLISENABLEDIPROC glad_glIsEnabledi;
typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode);
GLAPI PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback;
#define glBeginTransformFeedback glad_glBeginTransformFeedback
-typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC)();
+typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC)(void);
GLAPI PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback;
#define glEndTransformFeedback glad_glEndTransformFeedback
typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
@@ -3162,7 +3168,7 @@ GLAPI PFNGLCLAMPCOLORPROC glad_glClampColor;
typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC)(GLuint id, GLenum mode);
GLAPI PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender;
#define glBeginConditionalRender glad_glBeginConditionalRender
-typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC)();
+typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC)(void);
GLAPI PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender;
#define glEndConditionalRender glad_glEndConditionalRender
typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);