summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp6
-rw-r--r--core/bind/core_bind.h2
-rw-r--r--core/image.cpp20
-rw-r--r--core/io/http_client.cpp14
-rw-r--r--core/script_language.h2
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp9
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp170
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h10
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp8
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h1
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp1
-rw-r--r--drivers/gles3/shaders/canvas.glsl6
-rw-r--r--drivers/gles3/shaders/scene.glsl2
-rw-r--r--drivers/gles3/shaders/ssao.glsl16
-rw-r--r--editor/editor_export.cpp9
-rw-r--r--editor/editor_file_dialog.cpp5
-rw-r--r--editor/editor_node.cpp4
-rw-r--r--editor/editor_run.cpp3
-rw-r--r--editor/editor_settings.cpp25
-rw-r--r--editor/editor_settings.h2
-rw-r--r--editor/icons/icon_h_button_array.pngbin163 -> 0 bytes
-rw-r--r--editor/icons/icon_v_button_array.pngbin147 -> 0 bytes
-rw-r--r--editor/plugins/gradient_editor_plugin.cpp (renamed from editor/plugins/color_ramp_editor_plugin.cpp)50
-rw-r--r--editor/plugins/gradient_editor_plugin.h (renamed from editor/plugins/color_ramp_editor_plugin.h)16
-rw-r--r--editor/script_create_dialog.cpp50
-rw-r--r--editor/script_create_dialog.h3
-rw-r--r--editor/script_editor_debugger.cpp7
-rw-r--r--main/main.cpp3
-rw-r--r--modules/gdscript/gd_editor.cpp13
-rw-r--r--modules/gdscript/gd_script.cpp5
-rw-r--r--modules/gdscript/gd_script.h2
-rw-r--r--modules/visual_script/visual_script.cpp11
-rw-r--r--modules/visual_script/visual_script.h2
-rw-r--r--platform/android/export/export.cpp4
-rw-r--r--platform/osx/os_osx.mm10
-rw-r--r--platform/windows/os_windows.cpp4
-rw-r--r--scene/2d/area_2d.cpp36
-rw-r--r--scene/2d/area_2d.h10
-rw-r--r--scene/2d/line_2d.cpp2
-rw-r--r--scene/2d/particles_2d.cpp48
-rw-r--r--scene/2d/particles_2d.h6
-rw-r--r--scene/2d/physics_body_2d.cpp20
-rw-r--r--scene/2d/physics_body_2d.h4
-rw-r--r--scene/2d/ray_cast_2d.cpp18
-rw-r--r--scene/2d/ray_cast_2d.h6
-rw-r--r--scene/2d/screen_button.cpp102
-rw-r--r--scene/2d/screen_button.h2
-rw-r--r--scene/2d/tile_map.cpp6
-rw-r--r--scene/3d/area.cpp36
-rw-r--r--scene/3d/area.h10
-rw-r--r--scene/3d/light.cpp11
-rw-r--r--scene/3d/light.h1
-rw-r--r--scene/3d/physics_body.cpp10
-rw-r--r--scene/3d/physics_body.h4
-rw-r--r--scene/3d/ray_cast.cpp18
-rw-r--r--scene/3d/ray_cast.h6
-rw-r--r--scene/gui/button_array.cpp546
-rw-r--r--scene/gui/button_array.h131
-rw-r--r--scene/gui/color_picker.cpp19
-rw-r--r--scene/gui/gradient_edit.cpp (renamed from scene/gui/color_ramp_edit.cpp)36
-rw-r--r--scene/gui/gradient_edit.h (renamed from scene/gui/color_ramp_edit.h)8
-rw-r--r--scene/register_scene_types.cpp5
-rw-r--r--scene/resources/material.cpp2
-rw-r--r--servers/physics/collision_object_sw.cpp2
-rw-r--r--servers/physics/collision_object_sw.h8
-rw-r--r--servers/physics/physics_server_sw.cpp16
-rw-r--r--servers/physics/physics_server_sw.h10
-rw-r--r--servers/physics/space_sw.cpp24
-rw-r--r--servers/physics/space_sw.h10
-rw-r--r--servers/physics_2d/collision_object_2d_sw.cpp2
-rw-r--r--servers/physics_2d/collision_object_2d_sw.h8
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp12
-rw-r--r--servers/physics_2d/physics_2d_server_sw.h6
-rw-r--r--servers/physics_2d/physics_2d_server_wrap_mt.h6
-rw-r--r--servers/physics_2d/space_2d_sw.cpp28
-rw-r--r--servers/physics_2d/space_2d_sw.h12
-rw-r--r--servers/physics_2d_server.cpp32
-rw-r--r--servers/physics_2d_server.h24
-rw-r--r--servers/physics_server.cpp30
-rw-r--r--servers/physics_server.h26
-rw-r--r--servers/visual/rasterizer.h2
-rw-r--r--servers/visual/shader_types.cpp2
-rw-r--r--servers/visual/visual_server_scene.cpp23
-rw-r--r--servers/visual_server.h1
-rw-r--r--thirdparty/README.md2
-rw-r--r--thirdparty/glad/glad.c14
-rw-r--r--thirdparty/glad/glad/glad.h175
87 files changed, 706 insertions, 1367 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 2752391901..d81ccf0265 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -2532,6 +2532,10 @@ Dictionary _Engine::get_version_info() const {
return Engine::get_singleton()->get_version_info();
}
+bool _Engine::is_in_fixed_frame() const {
+ return Engine::get_singleton()->is_in_fixed_frame();
+}
+
void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_iterations_per_second", "iterations_per_second"), &_Engine::set_iterations_per_second);
@@ -2550,6 +2554,8 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_main_loop:MainLoop"), &_Engine::get_main_loop);
ClassDB::bind_method(D_METHOD("get_version_info"), &_Engine::get_version_info);
+
+ ClassDB::bind_method(D_METHOD("is_in_fixed_frame"), &_Engine::is_in_fixed_frame);
}
_Engine *_Engine::singleton = NULL;
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index e48b5c85ad..a2fb6c966c 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -634,6 +634,8 @@ public:
Dictionary get_version_info() const;
+ bool is_in_fixed_frame() const;
+
_Engine();
};
diff --git a/core/image.cpp b/core/image.cpp
index 94b01d9332..380b307020 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -1612,11 +1612,11 @@ void Image::blit_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Po
ERR_FAIL_COND(srcdsize == 0);
ERR_FAIL_COND(format != p_src->format);
- Rect2i local_src_rect = Rect2i(0, 0, width, height).clip(Rect2i(p_dest + p_src_rect.position, p_src_rect.size));
-
- if (local_src_rect.size.x <= 0 || local_src_rect.size.y <= 0)
+ Rect2i clipped_src_rect = Rect2i(0, 0, p_src->width, p_src->height).clip(p_src_rect);
+ if (clipped_src_rect.size.x <= 0 || clipped_src_rect.size.y <= 0)
return;
- Rect2i src_rect(p_src_rect.position + (local_src_rect.position - p_dest), local_src_rect.size);
+
+ Rect2i dest_rect = Rect2i(0, 0, width, height).clip(Rect2i(p_dest, clipped_src_rect.size));
PoolVector<uint8_t>::Write wp = data.write();
uint8_t *dst_data_ptr = wp.ptr();
@@ -1626,15 +1626,15 @@ void Image::blit_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Po
int pixel_size = get_format_pixel_size(format);
- for (int i = 0; i < src_rect.size.y; i++) {
+ for (int i = 0; i < dest_rect.size.y; i++) {
- for (int j = 0; j < src_rect.size.x; j++) {
+ for (int j = 0; j < dest_rect.size.x; j++) {
- int src_x = src_rect.position.x + j;
- int src_y = src_rect.position.y + i;
+ int src_x = clipped_src_rect.position.x + j;
+ int src_y = clipped_src_rect.position.y + i;
- int dst_x = local_src_rect.position.x + j;
- int dst_y = local_src_rect.position.y + i;
+ int dst_x = dest_rect.position.x + j;
+ int dst_y = dest_rect.position.y + i;
const uint8_t *src = &src_data_ptr[(src_y * p_src->width + src_x) * pixel_size];
uint8_t *dst = &dst_data_ptr[(dst_y * width + dst_x) * pixel_size];
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 899f3b3b2d..0c84a5213f 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -96,7 +96,12 @@ Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector
};
String request = String(_methods[p_method]) + " " + p_url + " HTTP/1.1\r\n";
- request += "Host: " + conn_host + ":" + itos(conn_port) + "\r\n";
+ if ((ssl && conn_port == 443) || (!ssl && conn_port == 80)) {
+ // don't append the standard ports
+ request += "Host: " + conn_host + "\r\n";
+ } else {
+ request += "Host: " + conn_host + ":" + itos(conn_port) + "\r\n";
+ }
bool add_clen = p_body.size() > 0;
for (int i = 0; i < p_headers.size(); i++) {
request += p_headers[i] + "\r\n";
@@ -151,7 +156,12 @@ Error HTTPClient::request(Method p_method, const String &p_url, const Vector<Str
};
String request = String(_methods[p_method]) + " " + p_url + " HTTP/1.1\r\n";
- request += "Host: " + conn_host + ":" + itos(conn_port) + "\r\n";
+ if ((ssl && conn_port == 443) || (!ssl && conn_port == 80)) {
+ // don't append the standard ports
+ request += "Host: " + conn_host + "\r\n";
+ } else {
+ request += "Host: " + conn_host + ":" + itos(conn_port) + "\r\n";
+ }
bool add_clen = p_body.length() > 0;
for (int i = 0; i < p_headers.size(); i++) {
request += p_headers[i] + "\r\n";
diff --git a/core/script_language.h b/core/script_language.h
index 115ab59dca..6e39593a89 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -196,6 +196,8 @@ public:
virtual void get_comment_delimiters(List<String> *p_delimiters) const = 0;
virtual void get_string_delimiters(List<String> *p_delimiters) const = 0;
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const = 0;
+ virtual void make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script) {}
+ virtual bool is_using_templates() { return false; }
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const = 0;
virtual Script *create_script() const = 0;
virtual bool has_named_classes() const = 0;
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 8123feccdc..e88687eb28 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -257,7 +257,7 @@ void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_coun
//vertex
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_vertices);
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
- glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, false, sizeof(Vector2), ((float *)0) + buffer_ofs);
+ glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, false, sizeof(Vector2), ((uint8_t *)0) + buffer_ofs);
buffer_ofs += sizeof(Vector2) * p_vertex_count;
//color
@@ -272,7 +272,7 @@ void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_coun
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Color) * p_vertex_count, p_colors);
glEnableVertexAttribArray(VS::ARRAY_COLOR);
- glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, false, sizeof(Color), ((float *)0) + buffer_ofs);
+ glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, false, sizeof(Color), ((uint8_t *)0) + buffer_ofs);
buffer_ofs += sizeof(Color) * p_vertex_count;
}
@@ -280,7 +280,7 @@ void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_coun
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_uvs);
glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
- glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, false, sizeof(Vector2), ((float *)0) + buffer_ofs);
+ glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, false, sizeof(Vector2), ((uint8_t *)0) + buffer_ofs);
buffer_ofs += sizeof(Vector2) * p_vertex_count;
} else {
@@ -1240,9 +1240,6 @@ void RasterizerCanvasGLES3::reset_canvas() {
//glLineWidth(1.0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
- for (int i = 0; i < VS::ARRAY_MAX; i++) {
- glDisableVertexAttribArray(i);
- }
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex);
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 87a2ca8bb9..432666fffa 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1004,7 +1004,7 @@ void RasterizerSceneGLES3::light_instance_set_transform(RID p_light_instance, co
light_instance->transform = p_transform;
}
-void RasterizerSceneGLES3::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) {
+void RasterizerSceneGLES3::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) {
LightInstance *light_instance = light_instance_owner.getornull(p_light_instance);
ERR_FAIL_COND(!light_instance);
@@ -1019,6 +1019,7 @@ void RasterizerSceneGLES3::light_instance_set_shadow_transform(RID p_light_insta
light_instance->shadow_transform[p_pass].transform = p_transform;
light_instance->shadow_transform[p_pass].farplane = p_far;
light_instance->shadow_transform[p_pass].split = p_split;
+ light_instance->shadow_transform[p_pass].bias_scale = p_bias_scale;
}
void RasterizerSceneGLES3::light_instance_mark_visible(RID p_light_instance) {
@@ -1905,7 +1906,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
if (!p_shadow) {
if (p_directional_add) {
- if (e->sort_key & RenderList::SORT_KEY_UNSHADED_FLAG || !(e->instance->layer_mask & directional_light->light_ptr->cull_mask)) {
+ if (e->sort_key & SORT_KEY_UNSHADED_FLAG || !(e->instance->layer_mask & directional_light->light_ptr->cull_mask)) {
continue;
}
@@ -1914,7 +1915,8 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
if (shading != prev_shading) {
- if (e->sort_key & RenderList::SORT_KEY_UNSHADED_FLAG) {
+ if (e->sort_key & SORT_KEY_UNSHADED_FLAG) {
+
state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS, true);
state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING, false);
@@ -1943,7 +1945,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_5, shadow_filter_mode == SHADOW_FILTER_PCF5);
state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_13, shadow_filter_mode == SHADOW_FILTER_PCF13);
- if (p_directional_add || (directional_light && (e->sort_key & RenderList::SORT_KEY_NO_DIRECTIONAL_FLAG) == 0)) {
+ if (p_directional_add || (directional_light && (e->sort_key & SORT_KEY_NO_DIRECTIONAL_FLAG) == 0)) {
state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL, true);
if (p_directional_shadows && directional_light->light_ptr->shadow) {
@@ -2047,7 +2049,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
}
}
- if (!(e->sort_key & RenderList::SORT_KEY_UNSHADED_FLAG) && !p_directional_add && !p_shadow) {
+ if (!(e->sort_key & SORT_KEY_UNSHADED_FLAG) && !p_directional_add && !p_shadow) {
_setup_light(e, p_view_transform);
}
@@ -2176,7 +2178,7 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo
}
if (!p_shadow && directional_light && (directional_light->light_ptr->cull_mask & e->instance->layer_mask) == 0) {
- e->sort_key |= RenderList::SORT_KEY_NO_DIRECTIONAL_FLAG;
+ e->sort_key |= SORT_KEY_NO_DIRECTIONAL_FLAG;
}
e->sort_key |= uint64_t(e->geometry->index) << RenderList::SORT_KEY_GEOMETRY_INDEX_SHIFT;
@@ -2204,7 +2206,7 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo
}
if (e->instance->gi_probe_instances.size()) {
- e->sort_key |= RenderList::SORT_KEY_GI_PROBES_FLAG;
+ e->sort_key |= SORT_KEY_GI_PROBES_FLAG;
}
}
@@ -2221,7 +2223,8 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo
if (shadow || m->shader->spatial.unshaded || state.debug_draw == VS::VIEWPORT_DEBUG_DRAW_UNSHADED) {
- e->sort_key |= RenderList::SORT_KEY_UNSHADED_FLAG;
+ e->sort_key |= SORT_KEY_UNSHADED_FLAG;
+
}
}
@@ -4161,151 +4164,6 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glBindTexture(GL_TEXTURE_2D, env_radiance_tex);
storage->canvas->draw_generic_textured_rect(Rect2(0, 0, storage->frame.current_rt->width / 2, storage->frame.current_rt->height / 2), Rect2(0, 0, 1, 1));
}
-
-#if 0
- if (use_fb) {
-
-
-
- for(int i=0;i<VS::ARRAY_MAX;i++) {
- glDisableVertexAttribArray(i);
- }
- glBindBuffer(GL_ARRAY_BUFFER,0);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0);
- glDisable(GL_BLEND);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_CULL_FACE);
- glDisable(GL_SCISSOR_TEST);
- glDepthMask(false);
-
- if (current_env && current_env->fx_enabled[VS::ENV_FX_HDR]) {
-
- int hdr_tm = current_env->fx_param[VS::ENV_FX_PARAM_HDR_TONEMAPPER];
- switch(hdr_tm) {
- case VS::ENV_FX_HDR_TONE_MAPPER_LINEAR: {
-
-
- } break;
- case VS::ENV_FX_HDR_TONE_MAPPER_LOG: {
- copy_shader.set_conditional(CopyShaderGLES2::USE_LOG_TONEMAPPER,true);
-
- } break;
- case VS::ENV_FX_HDR_TONE_MAPPER_REINHARDT: {
- copy_shader.set_conditional(CopyShaderGLES2::USE_REINHARDT_TONEMAPPER,true);
- } break;
- case VS::ENV_FX_HDR_TONE_MAPPER_REINHARDT_AUTOWHITE: {
-
- copy_shader.set_conditional(CopyShaderGLES2::USE_REINHARDT_TONEMAPPER,true);
- copy_shader.set_conditional(CopyShaderGLES2::USE_AUTOWHITE,true);
- } break;
- }
-
-
- _process_hdr();
- }
- if (current_env && current_env->fx_enabled[VS::ENV_FX_GLOW]) {
- _process_glow_bloom();
- int glow_transfer_mode=current_env->fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_BLEND_MODE];
- if (glow_transfer_mode==1)
- copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW_SCREEN,true);
- if (glow_transfer_mode==2)
- copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW_SOFTLIGHT,true);
- }
-
- glBindFramebuffer(GL_FRAMEBUFFER, current_rt?current_rt->fbo:base_framebuffer);
-
- Size2 size;
- if (current_rt) {
- glBindFramebuffer(GL_FRAMEBUFFER, current_rt->fbo);
- glViewport( 0,0,viewport.width,viewport.height);
- size=Size2(viewport.width,viewport.height);
- } else {
- glBindFramebuffer(GL_FRAMEBUFFER, base_framebuffer);
- glViewport( viewport.x, window_size.height-(viewport.height+viewport.y), viewport.width,viewport.height );
- size=Size2(viewport.width,viewport.height);
- }
-
- //time to copy!!!
- copy_shader.set_conditional(CopyShaderGLES2::USE_BCS,current_env && current_env->fx_enabled[VS::ENV_FX_BCS]);
- copy_shader.set_conditional(CopyShaderGLES2::USE_SRGB,current_env && current_env->fx_enabled[VS::ENV_FX_SRGB]);
- copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW,current_env && current_env->fx_enabled[VS::ENV_FX_GLOW]);
- copy_shader.set_conditional(CopyShaderGLES2::USE_HDR,current_env && current_env->fx_enabled[VS::ENV_FX_HDR]);
- copy_shader.set_conditional(CopyShaderGLES2::USE_NO_ALPHA,true);
- copy_shader.set_conditional(CopyShaderGLES2::USE_FXAA,current_env && current_env->fx_enabled[VS::ENV_FX_FXAA]);
-
- copy_shader.bind();
- //copy_shader.set_uniform(CopyShaderGLES2::SOURCE,0);
-
- if (current_env && current_env->fx_enabled[VS::ENV_FX_GLOW]) {
-
- glActiveTexture(GL_TEXTURE1);
- glBindTexture(GL_TEXTURE_2D, framebuffer.blur[0].color );
- glUniform1i(copy_shader.get_uniform_location(CopyShaderGLES2::GLOW_SOURCE),1);
-
- }
-
- if (current_env && current_env->fx_enabled[VS::ENV_FX_HDR]) {
-
- glActiveTexture(GL_TEXTURE2);
- glBindTexture(GL_TEXTURE_2D, current_vd->lum_color );
- glUniform1i(copy_shader.get_uniform_location(CopyShaderGLES2::HDR_SOURCE),2);
- copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_EXPOSURE,float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_EXPOSURE]));
- copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_WHITE,float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_WHITE]));
-
- }
-
- if (current_env && current_env->fx_enabled[VS::ENV_FX_FXAA])
- copy_shader.set_uniform(CopyShaderGLES2::PIXEL_SIZE,Size2(1.0/size.x,1.0/size.y));
-
-
- if (current_env && current_env->fx_enabled[VS::ENV_FX_BCS]) {
-
- Vector3 bcs;
- bcs.x=current_env->fx_param[VS::ENV_FX_PARAM_BCS_BRIGHTNESS];
- bcs.y=current_env->fx_param[VS::ENV_FX_PARAM_BCS_CONTRAST];
- bcs.z=current_env->fx_param[VS::ENV_FX_PARAM_BCS_SATURATION];
- copy_shader.set_uniform(CopyShaderGLES2::BCS,bcs);
- }
-
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, framebuffer.color );
- glUniform1i(copy_shader.get_uniform_location(CopyShaderGLES2::SOURCE),0);
-
- _copy_screen_quad();
-
- copy_shader.set_conditional(CopyShaderGLES2::USE_BCS,false);
- copy_shader.set_conditional(CopyShaderGLES2::USE_SRGB,false);
- copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW,false);
- copy_shader.set_conditional(CopyShaderGLES2::USE_HDR,false);
- copy_shader.set_conditional(CopyShaderGLES2::USE_NO_ALPHA,false);
- copy_shader.set_conditional(CopyShaderGLES2::USE_FXAA,false);
- copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW_SCREEN,false);
- copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW_SOFTLIGHT,false);
- copy_shader.set_conditional(CopyShaderGLES2::USE_REINHARDT_TONEMAPPER,false);
- copy_shader.set_conditional(CopyShaderGLES2::USE_AUTOWHITE,false);
- copy_shader.set_conditional(CopyShaderGLES2::USE_LOG_TONEMAPPER,false);
-
- state.scene_shader.set_conditional(SceneShaderGLES3::USE_8BIT_HDR,false);
-
-
- if (current_env && current_env->fx_enabled[VS::ENV_FX_HDR] && GLOBAL_DEF("rasterizer/debug_hdr",false)) {
- _debug_luminances();
- }
- }
-
- current_env=NULL;
- current_debug=VS::SCENARIO_DEBUG_DISABLED;
- if (GLOBAL_DEF("rasterizer/debug_shadow_maps",false)) {
- _debug_shadows();
- }
- //_debug_luminances();
- //_debug_samplers();
-
- if (using_canvas_bg) {
- using_canvas_bg=false;
- glColorMask(1,1,1,1); //don't touch alpha
- }
-#endif
}
void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count) {
@@ -4395,8 +4253,8 @@ void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_
}
zfar = light->param[VS::LIGHT_PARAM_RANGE];
- bias = light->param[VS::LIGHT_PARAM_SHADOW_BIAS];
- normal_bias = light->param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS];
+ bias = light->param[VS::LIGHT_PARAM_SHADOW_BIAS] * light_instance->shadow_transform[p_pass].bias_scale;
+ normal_bias = light->param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS] * light_instance->shadow_transform[p_pass].bias_scale;
fbo = directional_shadow.fbo;
vp_height = directional_shadow.size;
@@ -4745,7 +4603,7 @@ void RasterizerSceneGLES3::initialize() {
{
//directional light shadow
directional_shadow.light_count = 0;
- directional_shadow.size = nearest_power_of_2(GLOBAL_DEF("rendering/shadows/directional_shadow_size", 2048));
+ directional_shadow.size = nearest_power_of_2(GLOBAL_DEF("rendering/shadows/directional_shadow_size", 4096));
glGenFramebuffers(1, &directional_shadow.fbo);
glBindFramebuffer(GL_FRAMEBUFFER, directional_shadow.fbo);
glGenTextures(1, &directional_shadow.depth);
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index f9953f83db..c4e6de058c 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -563,6 +563,7 @@ public:
Transform transform;
float farplane;
float split;
+ float bias_scale;
};
ShadowTransform shadow_transform[4];
@@ -598,7 +599,7 @@ public:
virtual RID light_instance_create(RID p_light);
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);
+ 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);
/* REFLECTION INSTANCE */
@@ -637,9 +638,10 @@ public:
MAX_REFLECTIONS = 1024,
SORT_KEY_DEPTH_LAYER_SHIFT = 60,
- SORT_KEY_UNSHADED_FLAG = uint64_t(1) << 59,
- SORT_KEY_NO_DIRECTIONAL_FLAG = uint64_t(1) << 58,
- SORT_KEY_GI_PROBES_FLAG = uint64_t(1) << 57,
+//64 bits unsupported in MSVC
+#define SORT_KEY_UNSHADED_FLAG (uint64_t(1) << 59)
+#define SORT_KEY_NO_DIRECTIONAL_FLAG (uint64_t(1) << 58)
+#define SORT_KEY_GI_PROBES_FLAG (uint64_t(1) << 57)
SORT_KEY_SHADING_SHIFT = 57,
SORT_KEY_SHADING_MASK = 7,
SORT_KEY_MATERIAL_INDEX_SHIFT = 40,
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index cf540c1577..a38e149aff 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -4273,7 +4273,6 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type) {
light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET] = 0.3;
light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET] = 0.6;
light->param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS] = 0.1;
- light->param[VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE] = 0.1;
light->color = Color(1, 1, 1, 1);
light->shadow = false;
@@ -4310,8 +4309,7 @@ void RasterizerStorageGLES3::light_set_param(RID p_light, VS::LightParam p_param
case VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET:
case VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET:
case VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS:
- case VS::LIGHT_PARAM_SHADOW_BIAS:
- case VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE: {
+ case VS::LIGHT_PARAM_SHADOW_BIAS: {
light->version++;
light->instance_change_notify();
@@ -5449,9 +5447,7 @@ void RasterizerStorageGLES3::update_particles() {
glDisable(GL_RASTERIZER_DISCARD);
- for (int i = 0; i < 6; i++) {
- glDisableVertexAttribArray(i);
- }
+
}
////////
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 1f101b8b61..e4bde96443 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -448,6 +448,7 @@ public:
: dirty_list(this) {
shader = NULL;
+ ubo_size = 0;
valid = false;
custom_code_id = 0;
version = 1;
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index b1f7b4c9bd..3376f99112 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -668,6 +668,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix";
actions[VS::SHADER_CANVAS_ITEM].renames["EXTRA_MATRIX"] == "extra_matrix";
actions[VS::SHADER_CANVAS_ITEM].renames["TIME"] = "time";
+ actions[VS::SHADER_CANVAS_ITEM].renames["AT_LIGHT_PASS"] = "at_light_pass";
actions[VS::SHADER_CANVAS_ITEM].renames["COLOR"] = "color";
actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL"] = "normal";
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl
index d6850b535e..de4dbf6e6f 100644
--- a/drivers/gles3/shaders/canvas.glsl
+++ b/drivers/gles3/shaders/canvas.glsl
@@ -59,6 +59,9 @@ out vec4 local_rot;
out highp vec2 pos;
#endif
+const bool at_light_pass = true;
+#else
+const bool at_light_pass = false;
#endif
@@ -191,6 +194,9 @@ in highp vec2 pos;
#endif
+const bool at_light_pass = true;
+#else
+const bool at_light_pass = false;
#endif
uniform mediump vec4 final_modulate;
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 0f1a7458d7..9a2cd577ef 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1543,7 +1543,7 @@ FRAGMENT_SHADER_CODE
#if defined(LIGHT_USE_PSSM_BLEND)
if (use_blend) {
- shadow=mix(shadow, sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord2.xy,pssm_coord2.z,light_clamp));
+ shadow=mix(shadow, sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord2.xy,pssm_coord2.z,light_clamp),pssm_blend);
}
#endif
diff --git a/drivers/gles3/shaders/ssao.glsl b/drivers/gles3/shaders/ssao.glsl
index ba29ec52c7..d8302bd46e 100644
--- a/drivers/gles3/shaders/ssao.glsl
+++ b/drivers/gles3/shaders/ssao.glsl
@@ -12,7 +12,7 @@ void main() {
[fragment]
-#define NUM_SAMPLES (11)
+#define NUM_SAMPLES (15)
// If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower
// miplevel to maintain reasonable spatial locality in the cache
@@ -25,8 +25,20 @@ void main() {
// This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent
// taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9
-#define NUM_SPIRAL_TURNS (7)
+const int ROTATIONS[] = int[]( 1, 1, 2, 3, 2, 5, 2, 3, 2,
+3, 3, 5, 5, 3, 4, 7, 5, 5, 7,
+9, 8, 5, 5, 7, 7, 7, 8, 5, 8,
+11, 12, 7, 10, 13, 8, 11, 8, 7, 14,
+11, 11, 13, 12, 13, 19, 17, 13, 11, 18,
+19, 11, 11, 14, 17, 21, 15, 16, 17, 18,
+13, 17, 11, 17, 19, 18, 25, 18, 19, 19,
+29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
+31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
+19, 27, 21, 25, 39, 29, 17, 21, 27 );
+
+//#define NUM_SPIRAL_TURNS (7)
+const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES-1];
uniform sampler2D source_depth; //texunit:0
uniform highp usampler2D source_depth_mipmaps; //texunit:1
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index cb1b958cca..a19819a1f8 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -211,6 +211,7 @@ EditorExportPreset::EditorExportPreset() {
void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags) {
String host = EditorSettings::get_singleton()->get("network/debug/remote_host");
+ int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST)
host = "localhost";
@@ -230,7 +231,7 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
r_flags.push_back("-rdebug");
- r_flags.push_back(host + ":" + String::num(GLOBAL_DEF("network/debug/remote_port", 6007)));
+ r_flags.push_back(host + ":" + String::num(remote_port));
List<String> breakpoints;
ScriptEditor::get_singleton()->get_breakpoints(&breakpoints);
@@ -621,6 +622,7 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co
void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags) {
String host = EditorSettings::get_singleton()->get("network/debug/remote_host");
+ int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST)
host = "localhost";
@@ -640,7 +642,7 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
r_flags.push_back("-rdebug");
- r_flags.push_back(host + ":" + String::num(GLOBAL_DEF("network/debug/remote_port", 6007)));
+ r_flags.push_back(host + ":" + String::num(remote_port));
List<String> breakpoints;
ScriptEditor::get_singleton()->get_breakpoints(&breakpoints);
@@ -2109,6 +2111,7 @@ static int _get_pad(int p_alignment, int p_n) {
void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags) {
String host = EditorSettings::get_singleton()->get("network/debug/remote_host");
+ int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
if (p_flags&EXPORT_REMOTE_DEBUG_LOCALHOST)
host="localhost";
@@ -2128,7 +2131,7 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
r_flags.push_back("-rdebug");
- r_flags.push_back(host+":"+String::num(GLOBAL_DEF("network/debug/remote_port", 6007)));
+ r_flags.push_back(host+":"+String::num(remote_port));
List<String> breakpoints;
ScriptEditor::get_singleton()->get_breakpoints(&breakpoints);
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 25fade46d6..c2a408e8ab 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -1300,16 +1300,21 @@ EditorFileDialog::EditorFileDialog() {
favorite->connect("toggled", this, "_favorite_toggled");
pathhb->add_child(favorite);
+ Ref<ButtonGroup> view_mode_group;
+ view_mode_group.instance();
+
mode_thumbnails = memnew(ToolButton);
mode_thumbnails->connect("pressed", this, "set_display_mode", varray(DISPLAY_THUMBNAILS));
mode_thumbnails->set_toggle_mode(true);
mode_thumbnails->set_pressed(display_mode == DISPLAY_THUMBNAILS);
+ mode_thumbnails->set_button_group(view_mode_group);
pathhb->add_child(mode_thumbnails);
mode_list = memnew(ToolButton);
mode_list->connect("pressed", this, "set_display_mode", varray(DISPLAY_LIST));
mode_list->set_toggle_mode(true);
mode_list->set_pressed(display_mode == DISPLAY_LIST);
+ mode_list->set_button_group(view_mode_group);
pathhb->add_child(mode_list);
drives = memnew(OptionButton);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 6587e4fe09..94e061b700 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -73,10 +73,10 @@
#include "plugins/collision_polygon_2d_editor_plugin.h"
#include "plugins/collision_polygon_editor_plugin.h"
#include "plugins/collision_shape_2d_editor_plugin.h"
-#include "plugins/color_ramp_editor_plugin.h"
#include "plugins/cube_grid_theme_editor_plugin.h"
#include "plugins/curve_editor_plugin.h"
#include "plugins/gi_probe_editor_plugin.h"
+#include "plugins/gradient_editor_plugin.h"
#include "plugins/gradient_texture_editor_plugin.h"
#include "plugins/item_list_editor_plugin.h"
#include "plugins/light_occluder_2d_editor_plugin.h"
@@ -6042,7 +6042,7 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(Polygon2DEditorPlugin(this)));
add_editor_plugin(memnew(LightOccluder2DEditorPlugin(this)));
add_editor_plugin(memnew(NavigationPolygonEditorPlugin(this)));
- add_editor_plugin(memnew(ColorRampEditorPlugin(this)));
+ add_editor_plugin(memnew(GradientEditorPlugin(this)));
add_editor_plugin(memnew(GradientTextureEditorPlugin(this)));
add_editor_plugin(memnew(CollisionShape2DEditorPlugin(this)));
add_editor_plugin(memnew(CurveTextureEditorPlugin(this)));
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index c97dc9a88e..a8106b4eec 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -42,6 +42,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
String resource_path = GlobalConfig::get_singleton()->get_resource_path();
String remote_host = EditorSettings::get_singleton()->get("network/debug/remote_host");
+ int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
if (resource_path != "") {
args.push_back("-path");
@@ -50,7 +51,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
if (true) {
args.push_back("-rdebug");
- args.push_back(remote_host + ":" + String::num(GLOBAL_GET("network/debug/remote_port")));
+ args.push_back(remote_host + ":" + String::num(remote_port));
}
args.push_back("-epid");
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 07c7fe97e4..3627a43279 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -292,6 +292,12 @@ void EditorSettings::create() {
dir->change_dir("..");
}
+ if (dir->change_dir("script_templates") != OK) {
+ dir->make_dir("script_templates");
+ } else {
+ dir->change_dir("..");
+ }
+
if (dir->change_dir("tmp") != OK) {
dir->make_dir("tmp");
} else {
@@ -946,6 +952,25 @@ bool EditorSettings::save_text_editor_theme_as(String p_file) {
return false;
}
+Vector<String> EditorSettings::get_script_templates(const String &p_extension) {
+
+ Vector<String> templates;
+ DirAccess *d = DirAccess::open(settings_path + "/script_templates");
+ if (d) {
+ d->list_dir_begin();
+ String file = d->get_next();
+ while (file != String()) {
+ if (file.get_extension() == p_extension) {
+ templates.push_back(file.get_basename());
+ }
+ file = d->get_next();
+ }
+ d->list_dir_end();
+ memdelete(d);
+ }
+ return templates;
+}
+
bool EditorSettings::_save_text_editor_theme(String p_file) {
String theme_section = "color_theme";
Ref<ConfigFile> cf = memnew(ConfigFile); // hex is better?
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index 7b45e28350..d5adb84b63 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -159,6 +159,8 @@ public:
bool save_text_editor_theme();
bool save_text_editor_theme_as(String p_file);
+ Vector<String> get_script_templates(const String &p_extension);
+
void add_shortcut(const String &p_name, Ref<ShortCut> &p_shortcut);
bool is_shortcut(const String &p_name, const Ref<InputEvent> &p_event) const;
Ref<ShortCut> get_shortcut(const String &p_name) const;
diff --git a/editor/icons/icon_h_button_array.png b/editor/icons/icon_h_button_array.png
deleted file mode 100644
index baf3386801..0000000000
--- a/editor/icons/icon_h_button_array.png
+++ /dev/null
Binary files differ
diff --git a/editor/icons/icon_v_button_array.png b/editor/icons/icon_v_button_array.png
deleted file mode 100644
index d7ea9cc375..0000000000
--- a/editor/icons/icon_v_button_array.png
+++ /dev/null
Binary files differ
diff --git a/editor/plugins/color_ramp_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp
index e4172db415..9884db934b 100644
--- a/editor/plugins/color_ramp_editor_plugin.cpp
+++ b/editor/plugins/gradient_editor_plugin.cpp
@@ -27,15 +27,15 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "color_ramp_editor_plugin.h"
+#include "gradient_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
#include "spatial_editor_plugin.h"
-ColorRampEditorPlugin::ColorRampEditorPlugin(EditorNode *p_node) {
+GradientEditorPlugin::GradientEditorPlugin(EditorNode *p_node) {
editor = p_node;
- ramp_editor = memnew(ColorRampEdit);
+ ramp_editor = memnew(GradientEdit);
add_control_to_container(CONTAINER_PROPERTY_EDITOR_BOTTOM, ramp_editor);
@@ -44,21 +44,21 @@ ColorRampEditorPlugin::ColorRampEditorPlugin(EditorNode *p_node) {
ramp_editor->connect("ramp_changed", this, "ramp_changed");
}
-void ColorRampEditorPlugin::edit(Object *p_object) {
+void GradientEditorPlugin::edit(Object *p_object) {
- Gradient *color_ramp = p_object->cast_to<Gradient>();
- if (!color_ramp)
+ Gradient *gradient = p_object->cast_to<Gradient>();
+ if (!gradient)
return;
- color_ramp_ref = Ref<Gradient>(color_ramp);
- ramp_editor->set_points(color_ramp_ref->get_points());
+ gradient_ref = Ref<Gradient>(gradient);
+ ramp_editor->set_points(gradient_ref->get_points());
}
-bool ColorRampEditorPlugin::handles(Object *p_object) const {
+bool GradientEditorPlugin::handles(Object *p_object) const {
- return p_object->is_class("ColorRamp");
+ return p_object->is_class("Gradient");
}
-void ColorRampEditorPlugin::make_visible(bool p_visible) {
+void GradientEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
ramp_editor->show();
@@ -67,43 +67,43 @@ void ColorRampEditorPlugin::make_visible(bool p_visible) {
}
}
-void ColorRampEditorPlugin::_ramp_changed() {
+void GradientEditorPlugin::_ramp_changed() {
- if (color_ramp_ref.is_valid()) {
+ if (gradient_ref.is_valid()) {
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
//Not sure if I should convert this data to PoolVector
Vector<float> new_offsets = ramp_editor->get_offsets();
Vector<Color> new_colors = ramp_editor->get_colors();
- Vector<float> old_offsets = color_ramp_ref->get_offsets();
- Vector<Color> old_colors = color_ramp_ref->get_colors();
+ Vector<float> old_offsets = gradient_ref->get_offsets();
+ Vector<Color> old_colors = gradient_ref->get_colors();
if (old_offsets.size() != new_offsets.size())
ur->create_action(TTR("Add/Remove Color Ramp Point"));
else
ur->create_action(TTR("Modify Color Ramp"), UndoRedo::MERGE_ENDS);
- ur->add_do_method(this, "undo_redo_color_ramp", new_offsets, new_colors);
- ur->add_undo_method(this, "undo_redo_color_ramp", old_offsets, old_colors);
+ ur->add_do_method(this, "undo_redo_gradient", new_offsets, new_colors);
+ ur->add_undo_method(this, "undo_redo_gradient", old_offsets, old_colors);
ur->commit_action();
//color_ramp_ref->set_points(ramp_editor->get_points());
}
}
-void ColorRampEditorPlugin::_undo_redo_color_ramp(const Vector<float> &offsets,
+void GradientEditorPlugin::_undo_redo_gradient(const Vector<float> &offsets,
const Vector<Color> &colors) {
- color_ramp_ref->set_offsets(offsets);
- color_ramp_ref->set_colors(colors);
- ramp_editor->set_points(color_ramp_ref->get_points());
+ gradient_ref->set_offsets(offsets);
+ gradient_ref->set_colors(colors);
+ ramp_editor->set_points(gradient_ref->get_points());
ramp_editor->update();
}
-ColorRampEditorPlugin::~ColorRampEditorPlugin() {
+GradientEditorPlugin::~GradientEditorPlugin() {
}
-void ColorRampEditorPlugin::_bind_methods() {
- ClassDB::bind_method(D_METHOD("ramp_changed"), &ColorRampEditorPlugin::_ramp_changed);
- ClassDB::bind_method(D_METHOD("undo_redo_color_ramp", "offsets", "colors"), &ColorRampEditorPlugin::_undo_redo_color_ramp);
+void GradientEditorPlugin::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("ramp_changed"), &GradientEditorPlugin::_ramp_changed);
+ ClassDB::bind_method(D_METHOD("undo_redo_gradient", "offsets", "colors"), &GradientEditorPlugin::_undo_redo_gradient);
}
diff --git a/editor/plugins/color_ramp_editor_plugin.h b/editor/plugins/gradient_editor_plugin.h
index 35446062b5..843e98a917 100644
--- a/editor/plugins/color_ramp_editor_plugin.h
+++ b/editor/plugins/gradient_editor_plugin.h
@@ -32,21 +32,21 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
-#include "scene/gui/color_ramp_edit.h"
+#include "scene/gui/gradient_edit.h"
-class ColorRampEditorPlugin : public EditorPlugin {
+class GradientEditorPlugin : public EditorPlugin {
- GDCLASS(ColorRampEditorPlugin, EditorPlugin);
+ GDCLASS(GradientEditorPlugin, EditorPlugin);
bool _2d;
- Ref<Gradient> color_ramp_ref;
- ColorRampEdit *ramp_editor;
+ Ref<Gradient> gradient_ref;
+ GradientEdit *ramp_editor;
EditorNode *editor;
protected:
static void _bind_methods();
void _ramp_changed();
- void _undo_redo_color_ramp(const Vector<float> &offsets, const Vector<Color> &colors);
+ void _undo_redo_gradient(const Vector<float> &offsets, const Vector<Color> &colors);
public:
virtual String get_name() const { return "ColorRamp"; }
@@ -55,8 +55,8 @@ public:
virtual bool handles(Object *p_node) const;
virtual void make_visible(bool p_visible);
- ColorRampEditorPlugin(EditorNode *p_node);
- ~ColorRampEditorPlugin();
+ GradientEditorPlugin(EditorNode *p_node);
+ ~GradientEditorPlugin();
};
#endif /* TOOLS_EDITOR_PLUGINS_COLOR_RAMP_EDITOR_PLUGIN_H_ */
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 2220e3330f..dbd0758256 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -116,6 +116,18 @@ void ScriptCreateDialog::_parent_name_changed(const String &p_parent) {
_update_dialog();
}
+void ScriptCreateDialog::_template_changed(int p_template) {
+
+ if (p_template == 0) {
+ //default
+ script_template = "";
+ return;
+ }
+ String ext = ScriptServer::get_language(language_menu->get_selected())->get_extension();
+ String name = template_menu->get_item_text(p_template) + "." + ext;
+ script_template = EditorSettings::get_singleton()->get_settings_path() + "/script_templates/" + name;
+}
+
void ScriptCreateDialog::ok_pressed() {
if (is_new_script_created) {
@@ -134,7 +146,13 @@ void ScriptCreateDialog::_create_new() {
if (has_named_classes)
cname = class_name->get_text();
- Ref<Script> scr = ScriptServer::get_language(language_menu->get_selected())->get_template(cname, parent_name->get_text());
+ Ref<Script> scr;
+ if (script_template != "") {
+ scr = ResourceLoader::load(script_template)->duplicate();
+ ScriptServer::get_language(language_menu->get_selected())->make_template(cname, parent_name->get_text(), scr);
+ } else {
+ scr = ScriptServer::get_language(language_menu->get_selected())->get_template(cname, parent_name->get_text());
+ }
String selected_language = language_menu->get_item_text(language_menu->get_selected());
editor_settings->set_project_metadata("script_setup", "last_selected_language", selected_language);
@@ -175,7 +193,8 @@ void ScriptCreateDialog::_load_exist() {
void ScriptCreateDialog::_lang_changed(int l) {
l = language_menu->get_selected();
- if (ScriptServer::get_language(l)->has_named_classes()) {
+ ScriptLanguage *language = ScriptServer::get_language(l);
+ if (language->has_named_classes()) {
has_named_classes = true;
} else {
has_named_classes = false;
@@ -187,7 +206,7 @@ void ScriptCreateDialog::_lang_changed(int l) {
can_inherit_from_file = false;
}
- String selected_ext = "." + ScriptServer::get_language(l)->get_extension();
+ String selected_ext = "." + language->get_extension();
String path = file_path->get_text();
String extension = "";
if (path != "") {
@@ -204,7 +223,7 @@ void ScriptCreateDialog::_lang_changed(int l) {
List<String> extensions;
// get all possible extensions for script
for (int l = 0; l < language_menu->get_item_count(); l++) {
- ScriptServer::get_language(l)->get_recognized_extensions(&extensions);
+ language->get_recognized_extensions(&extensions);
}
for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
@@ -218,6 +237,18 @@ void ScriptCreateDialog::_lang_changed(int l) {
file_path->set_text(path);
}
+ bool use_templates = language->is_using_templates();
+ template_menu->set_disabled(!use_templates);
+ if (use_templates) {
+ Vector<String> template_list = EditorSettings::get_singleton()->get_script_templates(language->get_extension());
+
+ template_menu->clear();
+ template_menu->add_item(TTR("Default"));
+ for (int i = 0; i < template_list.size(); i++) {
+ template_menu->add_item(template_list[i]);
+ }
+ }
+
_update_dialog();
}
@@ -471,6 +502,7 @@ void ScriptCreateDialog::_bind_methods() {
ClassDB::bind_method("_browse_path", &ScriptCreateDialog::_browse_path);
ClassDB::bind_method("_file_selected", &ScriptCreateDialog::_file_selected);
ClassDB::bind_method("_path_changed", &ScriptCreateDialog::_path_changed);
+ ClassDB::bind_method("_template_changed", &ScriptCreateDialog::_template_changed);
ADD_SIGNAL(MethodInfo("script_created", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script")));
}
@@ -629,6 +661,16 @@ ScriptCreateDialog::ScriptCreateDialog() {
gc->add_child(l);
gc->add_child(class_name);
+ /* Templates */
+
+ template_menu = memnew(OptionButton);
+ l = memnew(Label);
+ l->set_text(TTR("Template"));
+ l->set_align(Label::ALIGN_RIGHT);
+ gc->add_child(l);
+ gc->add_child(template_menu);
+ template_menu->connect("item_selected", this, "_template_changed");
+
/* Built-in Script */
internal = memnew(CheckButton);
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index 862d4f88f2..1adbfe3f7d 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -48,6 +48,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
LineEdit *parent_name;
Button *parent_browse_button;
OptionButton *language_menu;
+ OptionButton *template_menu;
LineEdit *file_path;
Button *path_button;
EditorFileDialog *file_browse;
@@ -68,6 +69,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
bool is_built_in;
int current_language;
bool re_check_path;
+ String script_template;
void _path_changed(const String &p_path = String());
void _lang_changed(int l = 0);
@@ -75,6 +77,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
bool _validate(const String &p_strin);
void _class_name_changed(const String &p_name);
void _parent_name_changed(const String &p_parent);
+ void _template_changed(int p_template = 0);
void _browse_path(bool browse_parent);
void _file_selected(const String &p_file);
virtual void ok_pressed();
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 7f1e6023bf..6d22935dcb 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1035,14 +1035,17 @@ void ScriptEditorDebugger::start() {
EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
}
- uint16_t port = GLOBAL_GET("network/debug/remote_port");
perf_history.clear();
for (int i = 0; i < Performance::MONITOR_MAX; i++) {
perf_max[i] = 0;
}
- server->listen(port);
+ int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
+ if (server->listen(remote_port) != OK) {
+ EditorNode::get_log()->add_message(String("** Error listening on port ") + itos(remote_port) + String(" **"));
+ return;
+ }
set_process(true);
}
diff --git a/main/main.cpp b/main/main.cpp
index e13fb8d3db..e00c136596 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -581,12 +581,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
GLOBAL_DEF("memory/multithread/thread_rid_pool_prealloc", 60);
GLOBAL_DEF("network/debug/max_remote_stdout_chars_per_second", 2048);
- GLOBAL_DEF("network/debug/remote_port", 6007);
if (debug_mode == "remote") {
ScriptDebuggerRemote *sdr = memnew(ScriptDebuggerRemote);
- uint16_t debug_port = GLOBAL_GET("network/debug/remote_port");
+ uint16_t debug_port = 6007;
if (debug_host.find(":") != -1) {
int sep_pos = debug_host.find_last(":");
debug_port = debug_host.substr(sep_pos + 1, debug_host.length()).to_int();
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index eea5b15236..5e3ce31dd6 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -69,6 +69,19 @@ Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const Str
return script;
}
+bool GDScriptLanguage::is_using_templates() {
+
+ return true;
+}
+
+void GDScriptLanguage::make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script) {
+
+ String src = p_script->get_source_code();
+ src = src.replace("%BASE%", p_base_class_name);
+ src = src.replace("%TS%", _get_indentation());
+ p_script->set_source_code(src);
+}
+
bool GDScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const {
GDParser parser;
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index dcc0e24098..1dcc442234 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -615,6 +615,11 @@ Error GDScript::reload(bool p_keep_state) {
if (basedir != "")
basedir = basedir.get_base_dir();
+ if (basedir.find("res://") == -1 && basedir.find("user://") == -1) {
+ //loading a template, don't parse
+ return OK;
+ }
+
valid = false;
GDParser parser;
Error err = parser.parse(source, basedir, false, path);
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index 00ae136790..ebef4fed74 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -381,6 +381,8 @@ public:
virtual void get_comment_delimiters(List<String> *p_delimiters) const;
virtual void get_string_delimiters(List<String> *p_delimiters) const;
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
+ virtual bool is_using_templates();
+ virtual void make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script);
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index aec60391d3..bb8111ce99 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -2369,6 +2369,17 @@ Ref<Script> VisualScriptLanguage::get_template(const String &p_class_name, const
script->set_instance_base_type(p_base_class_name);
return script;
}
+
+bool VisualScriptLanguage::is_using_templates() {
+
+ return true;
+}
+
+void VisualScriptLanguage::make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script) {
+ Ref<VisualScript> script = p_script;
+ script->set_instance_base_type(p_base_class_name);
+}
+
bool VisualScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const {
return false;
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 72843099c7..1ccc358342 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -564,6 +564,8 @@ public:
virtual void get_comment_delimiters(List<String> *p_delimiters) const;
virtual void get_string_delimiters(List<String> *p_delimiters) const;
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
+ virtual bool is_using_templates();
+ virtual void make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script);
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 84fc4f10bf..51597526ab 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1714,7 +1714,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
args.push_back("--remove-all");
err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
- int port = GlobalConfig::get_singleton()->get("network/debug/remote_port");
+ int port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
args.clear();
args.push_back("reverse");
args.push_back("tcp:"+itos(port));
@@ -2993,7 +2993,7 @@ public:
args.push_back("--remove-all");
err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
- int port = GlobalConfig::get_singleton()->get("network/debug/remote_port");
+ int port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
args.clear();
args.push_back("reverse");
args.push_back("tcp:" + itos(port));
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 72fba39e33..1070de724b 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -409,14 +409,14 @@ static int button_mask = 0;
if ((int)[event buttonNumber] != 2)
return;
- button_mask |= BUTTON_MASK_MIDDLE;
+ button_mask &= ~BUTTON_MASK_MIDDLE;
Ref<InputEventMouseButton> mb;
mb.instance();
get_key_modifier_state([event modifierFlags], mb);
mb->set_button_index(BUTTON_MIDDLE);
- mb->set_pressed(true);
+ mb->set_pressed(false);
mb->set_position(Vector2(mouse_x, mouse_y));
mb->set_global_position(Vector2(mouse_x, mouse_y));
mb->set_button_mask(button_mask);
@@ -816,7 +816,7 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
unsigned int styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | (p_desired.resizable ? NSResizableWindowMask : 0);
window_object = [[GodotWindow alloc]
- initWithContentRect:NSMakeRect(0, 0, p_desired.width / display_scale, p_desired.height / display_scale)
+ initWithContentRect:NSMakeRect(0, 0, p_desired.width, p_desired.height)
styleMask:styleMask
backing:NSBackingStoreBuffered
defer:NO];
@@ -825,8 +825,8 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
window_view = [[GodotContentView alloc] init];
- window_size.width = p_desired.width;
- window_size.height = p_desired.height;
+ window_size.width = p_desired.width * display_scale;
+ window_size.height = p_desired.height * display_scale;
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && display_scale > 1) {
[window_view setWantsBestResolutionOpenGLSurface:YES];
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 4393cad3bf..e94529dd94 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -543,8 +543,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
mb->set_position(Vector2(old_x, old_y));
}
- mb->set_global_position(mb->get_position());
-
if (uMsg != WM_MOUSEWHEEL) {
if (mb->is_pressed()) {
@@ -568,6 +566,8 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
mb->set_position(Vector2(coords.x, coords.y));
}
+ mb->set_global_position(mb->get_position());
+
if (main_loop) {
input->parse_input_event(mb);
if (mb->is_pressed() && mb->get_button_index() > 3) {
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index 8bce489624..aca7a8c736 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -501,15 +501,15 @@ uint32_t Area2D::get_collision_mask() const {
return collision_mask;
}
-void Area2D::set_layer_mask(uint32_t p_mask) {
+void Area2D::set_collision_layer(uint32_t p_layer) {
- layer_mask = p_mask;
- Physics2DServer::get_singleton()->area_set_layer_mask(get_rid(), p_mask);
+ collision_layer = p_layer;
+ Physics2DServer::get_singleton()->area_set_collision_layer(get_rid(), p_layer);
}
-uint32_t Area2D::get_layer_mask() const {
+uint32_t Area2D::get_collision_layer() const {
- return layer_mask;
+ return collision_layer;
}
void Area2D::set_collision_mask_bit(int p_bit, bool p_value) {
@@ -527,19 +527,19 @@ bool Area2D::get_collision_mask_bit(int p_bit) const {
return get_collision_mask() & (1 << p_bit);
}
-void Area2D::set_layer_mask_bit(int p_bit, bool p_value) {
+void Area2D::set_collision_layer_bit(int p_bit, bool p_value) {
- uint32_t mask = get_layer_mask();
+ uint32_t layer = get_collision_layer();
if (p_value)
- mask |= 1 << p_bit;
+ layer |= 1 << p_bit;
else
- mask &= ~(1 << p_bit);
- set_layer_mask(mask);
+ layer &= ~(1 << p_bit);
+ set_collision_layer(layer);
}
-bool Area2D::get_layer_mask_bit(int p_bit) const {
+bool Area2D::get_collision_layer_bit(int p_bit) const {
- return get_layer_mask() & (1 << p_bit);
+ return get_collision_layer() & (1 << p_bit);
}
void Area2D::_bind_methods() {
@@ -577,14 +577,14 @@ void Area2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_collision_mask", "collision_mask"), &Area2D::set_collision_mask);
ClassDB::bind_method(D_METHOD("get_collision_mask"), &Area2D::get_collision_mask);
- ClassDB::bind_method(D_METHOD("set_layer_mask", "layer_mask"), &Area2D::set_layer_mask);
- ClassDB::bind_method(D_METHOD("get_layer_mask"), &Area2D::get_layer_mask);
+ ClassDB::bind_method(D_METHOD("set_collision_layer", "collision_layer"), &Area2D::set_collision_layer);
+ ClassDB::bind_method(D_METHOD("get_collision_layer"), &Area2D::get_collision_layer);
ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &Area2D::set_collision_mask_bit);
ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &Area2D::get_collision_mask_bit);
- ClassDB::bind_method(D_METHOD("set_layer_mask_bit", "bit", "value"), &Area2D::set_layer_mask_bit);
- ClassDB::bind_method(D_METHOD("get_layer_mask_bit", "bit"), &Area2D::get_layer_mask_bit);
+ ClassDB::bind_method(D_METHOD("set_collision_layer_bit", "bit", "value"), &Area2D::set_collision_layer_bit);
+ ClassDB::bind_method(D_METHOD("get_collision_layer_bit", "bit"), &Area2D::get_collision_layer_bit);
ClassDB::bind_method(D_METHOD("set_monitoring", "enable"), &Area2D::set_monitoring);
ClassDB::bind_method(D_METHOD("is_monitoring"), &Area2D::is_monitoring);
@@ -622,7 +622,7 @@ void Area2D::_bind_methods() {
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "monitoring"), "set_monitoring", "is_monitoring");
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "monitorable"), "set_monitorable", "is_monitorable");
ADD_GROUP("Collision", "collision_");
- ADD_PROPERTYNO(PropertyInfo(Variant::INT, "collision_layers", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_layer_mask", "get_layer_mask");
+ ADD_PROPERTYNO(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer");
ADD_PROPERTYNO(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_mask", "get_collision_mask");
}
@@ -641,7 +641,7 @@ Area2D::Area2D()
monitoring = false;
monitorable = false;
collision_mask = 1;
- layer_mask = 1;
+ collision_layer = 1;
set_monitoring(true);
set_monitorable(true);
}
diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h
index 3efc1abbd4..f0eb1e9240 100644
--- a/scene/2d/area_2d.h
+++ b/scene/2d/area_2d.h
@@ -55,7 +55,7 @@ private:
real_t linear_damp;
real_t angular_damp;
uint32_t collision_mask;
- uint32_t layer_mask;
+ uint32_t collision_layer;
int priority;
bool monitoring;
bool monitorable;
@@ -164,14 +164,14 @@ public:
void set_collision_mask(uint32_t p_mask);
uint32_t get_collision_mask() const;
- void set_layer_mask(uint32_t p_mask);
- uint32_t get_layer_mask() const;
+ void set_collision_layer(uint32_t p_layer);
+ uint32_t get_collision_layer() const;
void set_collision_mask_bit(int p_bit, bool p_value);
bool get_collision_mask_bit(int p_bit) const;
- void set_layer_mask_bit(int p_bit, bool p_value);
- bool get_layer_mask_bit(int p_bit) const;
+ void set_collision_layer_bit(int p_bit, bool p_value);
+ bool get_collision_layer_bit(int p_bit) const;
Array get_overlapping_bodies() const; //function for script
Array get_overlapping_areas() const; //function for script
diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp
index 80969d11b3..1a57d24342 100644
--- a/scene/2d/line_2d.cpp
+++ b/scene/2d/line_2d.cpp
@@ -310,7 +310,7 @@ void Line2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "points"), "set_points", "get_points");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "width"), "set_width", "get_width");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "default_color"), "set_default_color", "get_default_color");
- ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "gradient", PROPERTY_HINT_RESOURCE_TYPE, "ColorRamp"), "set_gradient", "get_gradient");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "gradient", PROPERTY_HINT_RESOURCE_TYPE, "Gradient"), "set_gradient", "get_gradient");
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture");
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "texture_mode", PROPERTY_HINT_ENUM, "None,Tile"), "set_texture_mode", "get_texture_mode");
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "joint_mode", PROPERTY_HINT_ENUM, "Sharp,Bevel,Round"), "set_joint_mode", "get_joint_mode");
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index 27d0d07c0f..21d64c5d64 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -505,8 +505,8 @@ void Particles2D::_notification(int p_what) {
Color color;
- if (color_ramp.is_valid()) {
- color = color_ramp->get_color_at_offset(ptime);
+ if (gradient.is_valid()) {
+ color = gradient->get_color_at_offset(ptime);
} else {
color = default_color;
}
@@ -774,14 +774,14 @@ Color Particles2D::get_color() const {
return default_color;
}
-void Particles2D::set_color_ramp(const Ref<Gradient> &p_color_ramp) {
+void Particles2D::set_gradient(const Ref<Gradient> &p_gradient) {
- color_ramp = p_color_ramp;
+ gradient = p_gradient;
}
-Ref<Gradient> Particles2D::get_color_ramp() const {
+Ref<Gradient> Particles2D::get_gradient() const {
- return color_ramp;
+ return gradient;
}
void Particles2D::set_emissor_offset(const Point2 &p_offset) {
@@ -809,19 +809,19 @@ void Particles2D::set_color_phases(int p_phases) {
//Create color ramp if we have 2 or more phases.
//Otherwise first phase phase will be assigned to default color.
- if (p_phases > 1 && color_ramp.is_null()) {
- color_ramp = Ref<Gradient>(memnew(Gradient()));
+ if (p_phases > 1 && gradient.is_null()) {
+ gradient = Ref<Gradient>(memnew(Gradient()));
}
- if (color_ramp.is_valid()) {
- color_ramp->get_points().resize(p_phases);
+ if (gradient.is_valid()) {
+ gradient->get_points().resize(p_phases);
}
}
//Deprecated.
int Particles2D::get_color_phases() const {
- if (color_ramp.is_valid()) {
- return color_ramp->get_points_count();
+ if (gradient.is_valid()) {
+ return gradient->get_points_count();
}
return 0;
}
@@ -830,9 +830,9 @@ int Particles2D::get_color_phases() const {
void Particles2D::set_color_phase_color(int p_phase, const Color &p_color) {
ERR_FAIL_INDEX(p_phase, MAX_COLOR_PHASES);
- if (color_ramp.is_valid()) {
- if (color_ramp->get_points_count() > p_phase)
- color_ramp->set_color(p_phase, p_color);
+ if (gradient.is_valid()) {
+ if (gradient->get_points_count() > p_phase)
+ gradient->set_color(p_phase, p_color);
} else {
if (p_phase == 0)
default_color = p_color;
@@ -843,8 +843,8 @@ void Particles2D::set_color_phase_color(int p_phase, const Color &p_color) {
Color Particles2D::get_color_phase_color(int p_phase) const {
ERR_FAIL_INDEX_V(p_phase, MAX_COLOR_PHASES, Color());
- if (color_ramp.is_valid()) {
- return color_ramp->get_color(p_phase);
+ if (gradient.is_valid()) {
+ return gradient->get_color(p_phase);
}
return Color(0, 0, 0, 1);
}
@@ -853,8 +853,8 @@ Color Particles2D::get_color_phase_color(int p_phase) const {
void Particles2D::set_color_phase_pos(int p_phase, float p_pos) {
ERR_FAIL_INDEX(p_phase, MAX_COLOR_PHASES);
ERR_FAIL_COND(p_pos < 0.0 || p_pos > 1.0);
- if (color_ramp.is_valid() && color_ramp->get_points_count() > p_phase) {
- return color_ramp->set_offset(p_phase, p_pos);
+ if (gradient.is_valid() && gradient->get_points_count() > p_phase) {
+ return gradient->set_offset(p_phase, p_pos);
}
}
@@ -862,8 +862,8 @@ void Particles2D::set_color_phase_pos(int p_phase, float p_pos) {
float Particles2D::get_color_phase_pos(int p_phase) const {
ERR_FAIL_INDEX_V(p_phase, MAX_COLOR_PHASES, 0);
- if (color_ramp.is_valid()) {
- return color_ramp->get_offset(p_phase);
+ if (gradient.is_valid()) {
+ return gradient->get_offset(p_phase);
}
return 0;
}
@@ -996,8 +996,8 @@ void Particles2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_color", "color"), &Particles2D::set_color);
ClassDB::bind_method(D_METHOD("get_color"), &Particles2D::get_color);
- ClassDB::bind_method(D_METHOD("set_color_ramp:ColorRamp", "color_ramp"), &Particles2D::set_color_ramp);
- ClassDB::bind_method(D_METHOD("get_color_ramp:ColorRamp"), &Particles2D::get_color_ramp);
+ ClassDB::bind_method(D_METHOD("set_gradient:Gradient", "gradient"), &Particles2D::set_gradient);
+ ClassDB::bind_method(D_METHOD("get_gradient:Gradient"), &Particles2D::get_gradient);
ClassDB::bind_method(D_METHOD("set_emissor_offset", "offset"), &Particles2D::set_emissor_offset);
ClassDB::bind_method(D_METHOD("get_emissor_offset"), &Particles2D::get_emissor_offset);
@@ -1078,7 +1078,7 @@ void Particles2D::_bind_methods() {
}
ADD_PROPERTYNO(PropertyInfo(Variant::COLOR, "color/color"), "set_color", "get_color");
- ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "color/color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "ColorRamp"), "set_color_ramp", "get_color_ramp");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "color/color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "Gradient"), "set_gradient", "get_gradient");
ADD_PROPERTYNZ(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "emission_points", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_emission_points", "get_emission_points");
diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h
index 5769fdd251..856beaa836 100644
--- a/scene/2d/particles_2d.h
+++ b/scene/2d/particles_2d.h
@@ -169,7 +169,7 @@ private:
//If no color ramp is set then default color is used. Created as simple alternative to color_ramp.
Color default_color;
- Ref<Gradient> color_ramp;
+ Ref<Gradient> gradient;
void _process_particles(float p_delta);
friend class ParticleAttractor2D;
@@ -241,8 +241,8 @@ public:
void set_color(const Color &p_color);
Color get_color() const;
- void set_color_ramp(const Ref<Gradient> &p_texture);
- Ref<Gradient> get_color_ramp() const;
+ void set_gradient(const Ref<Gradient> &p_texture);
+ Ref<Gradient> get_gradient() const;
void set_emissor_offset(const Point2 &p_offset);
Point2 get_emissor_offset() const;
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 626ea10515..68270ed771 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -79,7 +79,7 @@ uint32_t PhysicsBody2D::_get_layers() const {
void PhysicsBody2D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_collision_layer", "mask"), &PhysicsBody2D::set_collision_layer);
+ ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &PhysicsBody2D::set_collision_layer);
ClassDB::bind_method(D_METHOD("get_collision_layer"), &PhysicsBody2D::get_collision_layer);
ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &PhysicsBody2D::set_collision_mask);
ClassDB::bind_method(D_METHOD("get_collision_mask"), &PhysicsBody2D::get_collision_mask);
@@ -108,15 +108,15 @@ void PhysicsBody2D::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "one_way_collision/max_depth"), "set_one_way_collision_max_depth", "get_one_way_collision_max_depth");
}
-void PhysicsBody2D::set_collision_layer(uint32_t p_mask) {
+void PhysicsBody2D::set_collision_layer(uint32_t p_layer) {
- mask = p_mask;
- Physics2DServer::get_singleton()->body_set_layer_mask(get_rid(), p_mask);
+ collision_layer = p_layer;
+ Physics2DServer::get_singleton()->body_set_collision_layer(get_rid(), p_layer);
}
uint32_t PhysicsBody2D::get_collision_layer() const {
- return mask;
+ return collision_layer;
}
void PhysicsBody2D::set_collision_mask(uint32_t p_mask) {
@@ -146,12 +146,12 @@ bool PhysicsBody2D::get_collision_mask_bit(int p_bit) const {
void PhysicsBody2D::set_collision_layer_bit(int p_bit, bool p_value) {
- uint32_t mask = get_collision_layer();
+ uint32_t collision_layer = get_collision_layer();
if (p_value)
- mask |= 1 << p_bit;
+ collision_layer |= 1 << p_bit;
else
- mask &= ~(1 << p_bit);
- set_collision_layer(mask);
+ collision_layer &= ~(1 << p_bit);
+ set_collision_layer(collision_layer);
}
bool PhysicsBody2D::get_collision_layer_bit(int p_bit) const {
@@ -162,7 +162,7 @@ bool PhysicsBody2D::get_collision_layer_bit(int p_bit) const {
PhysicsBody2D::PhysicsBody2D(Physics2DServer::BodyMode p_mode)
: CollisionObject2D(Physics2DServer::get_singleton()->body_create(p_mode), false) {
- mask = 1;
+ collision_layer = 1;
collision_mask = 1;
set_one_way_collision_max_depth(0);
set_pickable(false);
diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h
index f706111e7e..50c9865f18 100644
--- a/scene/2d/physics_body_2d.h
+++ b/scene/2d/physics_body_2d.h
@@ -38,7 +38,7 @@ class PhysicsBody2D : public CollisionObject2D {
GDCLASS(PhysicsBody2D, CollisionObject2D);
- uint32_t mask;
+ uint32_t collision_layer;
uint32_t collision_mask;
Vector2 one_way_collision_direction;
float one_way_collision_max_depth;
@@ -53,7 +53,7 @@ protected:
static void _bind_methods();
public:
- void set_collision_layer(uint32_t p_mask);
+ void set_collision_layer(uint32_t p_layer);
uint32_t get_collision_layer() const;
void set_collision_mask(uint32_t p_mask);
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index 0a1a8b56ff..cfb4059714 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -44,14 +44,14 @@ Vector2 RayCast2D::get_cast_to() const {
return cast_to;
}
-void RayCast2D::set_layer_mask(uint32_t p_mask) {
+void RayCast2D::set_collision_layer(uint32_t p_layer) {
- layer_mask = p_mask;
+ collision_layer = p_layer;
}
-uint32_t RayCast2D::get_layer_mask() const {
+uint32_t RayCast2D::get_collision_layer() const {
- return layer_mask;
+ return collision_layer;
}
void RayCast2D::set_type_mask(uint32_t p_mask) {
@@ -201,7 +201,7 @@ void RayCast2D::_update_raycast_state() {
Physics2DDirectSpaceState::RayResult rr;
- if (dss->intersect_ray(gt.get_origin(), gt.xform(to), rr, exclude, layer_mask, type_mask)) {
+ if (dss->intersect_ray(gt.get_origin(), gt.xform(to), rr, exclude, collision_layer, type_mask)) {
collided = true;
against = rr.collider_id;
@@ -274,8 +274,8 @@ void RayCast2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear_exceptions"), &RayCast2D::clear_exceptions);
- ClassDB::bind_method(D_METHOD("set_layer_mask", "mask"), &RayCast2D::set_layer_mask);
- ClassDB::bind_method(D_METHOD("get_layer_mask"), &RayCast2D::get_layer_mask);
+ ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &RayCast2D::set_collision_layer);
+ ClassDB::bind_method(D_METHOD("get_collision_layer"), &RayCast2D::get_collision_layer);
ClassDB::bind_method(D_METHOD("set_type_mask", "mask"), &RayCast2D::set_type_mask);
ClassDB::bind_method(D_METHOD("get_type_mask"), &RayCast2D::get_type_mask);
@@ -286,7 +286,7 @@ void RayCast2D::_bind_methods() {
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::VECTOR2, "cast_to"), "set_cast_to", "get_cast_to");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "layer_mask", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_layer_mask", "get_layer_mask");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer");
ADD_PROPERTY(PropertyInfo(Variant::INT, "type_mask", PROPERTY_HINT_FLAGS, "Static,Kinematic,Rigid,Character,Area"), "set_type_mask", "get_type_mask");
}
@@ -296,7 +296,7 @@ RayCast2D::RayCast2D() {
against = 0;
collided = false;
against_shape = 0;
- layer_mask = 1;
+ collision_layer = 1;
type_mask = Physics2DDirectSpaceState::TYPE_MASK_COLLISION;
cast_to = Vector2(0, 50);
exclude_parent_body = true;
diff --git a/scene/2d/ray_cast_2d.h b/scene/2d/ray_cast_2d.h
index cfecfa2585..244f4302ad 100644
--- a/scene/2d/ray_cast_2d.h
+++ b/scene/2d/ray_cast_2d.h
@@ -43,7 +43,7 @@ class RayCast2D : public Node2D {
Vector2 collision_point;
Vector2 collision_normal;
Set<RID> exclude;
- uint32_t layer_mask;
+ uint32_t collision_layer;
uint32_t type_mask;
bool exclude_parent_body;
@@ -61,8 +61,8 @@ public:
void set_cast_to(const Vector2 &p_point);
Vector2 get_cast_to() const;
- void set_layer_mask(uint32_t p_mask);
- uint32_t get_layer_mask() const;
+ void set_collision_layer(uint32_t p_layer);
+ uint32_t get_collision_layer() const;
void set_type_mask(uint32_t p_mask);
uint32_t get_type_mask() const;
diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp
index ea68a111af..37139b2b93 100644
--- a/scene/2d/screen_button.cpp
+++ b/scene/2d/screen_button.cpp
@@ -194,40 +194,27 @@ void TouchScreenButton::_input(const Ref<InputEvent> &p_event) {
if (p_event->get_device() != 0)
return;
+ ERR_FAIL_COND(!is_visible_in_tree());
+
+ const InputEventScreenTouch *st = p_event->cast_to<InputEventScreenTouch>();
+
if (passby_press) {
- Ref<InputEventScreenTouch> st = p_event;
- Ref<InputEventScreenTouch> sd = p_event;
+ const InputEventScreenDrag *sd = p_event->cast_to<InputEventScreenDrag>();
- if (st.is_valid() && !st->is_pressed() && finger_pressed == st->get_index()) {
+ if (st && !st->is_pressed() && finger_pressed == st->get_index()) {
_release();
}
- if ((st.is_valid() && st->is_pressed()) || sd.is_valid()) {
+ if ((st && st->is_pressed()) || sd) {
- int index = st.is_valid() ? st->get_index() : sd->get_index();
- Vector2 coord = st.is_valid() ? st->get_position() : sd->get_position();
+ int index = st ? st->get_index() : sd->get_index();
+ Point2 coord = st ? st->get_position() : sd->get_position();
if (finger_pressed == -1 || index == finger_pressed) {
- coord = (get_global_transform_with_canvas()).affine_inverse().xform(coord);
-
- bool touched = false;
- if (bitmask.is_valid()) {
-
- if (Rect2(Point2(), bitmask->get_size()).has_point(coord)) {
-
- if (bitmask->get_bit(coord))
- touched = true;
- }
- } else {
-
- if (texture.is_valid())
- touched = Rect2(Point2(), texture->get_size()).has_point(coord);
- }
-
- if (touched) {
+ if (_is_point_inside(coord)) {
if (finger_pressed == -1) {
_press(index);
}
@@ -241,47 +228,15 @@ void TouchScreenButton::_input(const Ref<InputEvent> &p_event) {
} else {
- Ref<InputEventScreenTouch> st = p_event;
-
- if (st.is_valid()) {
+ if (st) {
if (st->is_pressed()) {
- if (!is_visible_in_tree())
- return;
-
const bool can_press = finger_pressed == -1;
if (!can_press)
return; //already fingering
- Point2 coord = (get_global_transform_with_canvas()).affine_inverse().xform(st->get_position());
- Rect2 item_rect = get_item_rect();
-
- bool touched = false;
- bool check_rect = true;
- if (shape.is_valid()) {
-
- check_rect = false;
- Transform2D xform = shape_centered ? Transform2D().translated(get_item_rect().size * 0.5f) : Transform2D();
- touched = shape->collide(xform, unit_rect, Transform2D(0, coord + Vector2(0.5, 0.5)));
- }
-
- if (bitmask.is_valid()) {
-
- check_rect = false;
- if (!touched && Rect2(Point2(), bitmask->get_size()).has_point(coord)) {
-
- if (bitmask->get_bit(coord))
- touched = true;
- }
- }
-
- if (!touched && check_rect) {
- if (!texture.is_null())
- touched = item_rect.has_point(coord);
- }
-
- if (touched) {
+ if (_is_point_inside(st->get_position())) {
_press(st->get_index());
}
} else {
@@ -293,6 +248,39 @@ void TouchScreenButton::_input(const Ref<InputEvent> &p_event) {
}
}
+bool TouchScreenButton::_is_point_inside(const Point2 &p_point) {
+
+ Point2 coord = (get_global_transform_with_canvas()).affine_inverse().xform(p_point);
+ Rect2 item_rect = get_item_rect();
+
+ bool touched = false;
+ bool check_rect = true;
+
+ if (shape.is_valid()) {
+
+ check_rect = false;
+ Transform2D xform = shape_centered ? Transform2D().translated(item_rect.size * 0.5f) : Transform2D();
+ touched = shape->collide(xform, unit_rect, Transform2D(0, coord + Vector2(0.5, 0.5)));
+ }
+
+ if (bitmask.is_valid()) {
+
+ check_rect = false;
+ if (!touched && Rect2(Point2(), bitmask->get_size()).has_point(coord)) {
+
+ if (bitmask->get_bit(coord))
+ touched = true;
+ }
+ }
+
+ if (!touched && check_rect) {
+ if (texture.is_valid())
+ touched = item_rect.has_point(coord);
+ }
+
+ return touched;
+}
+
void TouchScreenButton::_press(int p_finger_pressed) {
finger_pressed = p_finger_pressed;
diff --git a/scene/2d/screen_button.h b/scene/2d/screen_button.h
index e44f556c31..8923da2ae4 100644
--- a/scene/2d/screen_button.h
+++ b/scene/2d/screen_button.h
@@ -63,6 +63,8 @@ private:
void _input(const Ref<InputEvent> &p_Event);
+ bool _is_point_inside(const Point2 &p_point);
+
void _press(int p_finger_pressed);
void _release(bool p_exiting_tree = false);
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index eebf0efd1e..4f892a31fc 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -587,7 +587,7 @@ Map<TileMap::PosKey, TileMap::Quadrant>::Element *TileMap::_create_quadrant(cons
//q.canvas_item = VisualServer::get_singleton()->canvas_item_create();
q.body = Physics2DServer::get_singleton()->body_create(use_kinematic ? Physics2DServer::BODY_MODE_KINEMATIC : Physics2DServer::BODY_MODE_STATIC);
Physics2DServer::get_singleton()->body_attach_object_instance_ID(q.body, get_instance_ID());
- Physics2DServer::get_singleton()->body_set_layer_mask(q.body, collision_layer);
+ Physics2DServer::get_singleton()->body_set_collision_layer(q.body, collision_layer);
Physics2DServer::get_singleton()->body_set_collision_mask(q.body, collision_mask);
Physics2DServer::get_singleton()->body_set_param(q.body, Physics2DServer::BODY_PARAM_FRICTION, friction);
Physics2DServer::get_singleton()->body_set_param(q.body, Physics2DServer::BODY_PARAM_BOUNCE, bounce);
@@ -863,7 +863,7 @@ void TileMap::set_collision_layer(uint32_t p_layer) {
for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) {
Quadrant &q = E->get();
- Physics2DServer::get_singleton()->body_set_layer_mask(q.body, collision_layer);
+ Physics2DServer::get_singleton()->body_set_collision_layer(q.body, collision_layer);
}
}
@@ -1286,7 +1286,7 @@ void TileMap::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collision_use_kinematic", PROPERTY_HINT_NONE, ""), "set_collision_use_kinematic", "get_collision_use_kinematic");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "collision_friction", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_collision_friction", "get_collision_friction");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "collision_bounce", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_collision_bounce", "get_collision_bounce");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layers", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer");
ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_mask", "get_collision_mask");
ADD_GROUP("Occluder", "occluder_");
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp
index 8dae078e5b..39a4e926b2 100644
--- a/scene/3d/area.cpp
+++ b/scene/3d/area.cpp
@@ -489,15 +489,15 @@ uint32_t Area::get_collision_mask() const {
return collision_mask;
}
-void Area::set_layer_mask(uint32_t p_mask) {
+void Area::set_collision_layer(uint32_t p_layer) {
- layer_mask = p_mask;
- PhysicsServer::get_singleton()->area_set_layer_mask(get_rid(), p_mask);
+ collision_layer = p_layer;
+ PhysicsServer::get_singleton()->area_set_collision_layer(get_rid(), p_layer);
}
-uint32_t Area::get_layer_mask() const {
+uint32_t Area::get_collision_layer() const {
- return layer_mask;
+ return collision_layer;
}
void Area::set_collision_mask_bit(int p_bit, bool p_value) {
@@ -515,19 +515,19 @@ bool Area::get_collision_mask_bit(int p_bit) const {
return get_collision_mask() & (1 << p_bit);
}
-void Area::set_layer_mask_bit(int p_bit, bool p_value) {
+void Area::set_collision_layer_bit(int p_bit, bool p_value) {
- uint32_t mask = get_layer_mask();
+ uint32_t layer = get_collision_layer();
if (p_value)
- mask |= 1 << p_bit;
+ layer |= 1 << p_bit;
else
- mask &= ~(1 << p_bit);
- set_layer_mask(mask);
+ layer &= ~(1 << p_bit);
+ set_collision_layer(layer);
}
-bool Area::get_layer_mask_bit(int p_bit) const {
+bool Area::get_collision_layer_bit(int p_bit) const {
- return get_layer_mask() & (1 << p_bit);
+ return get_collision_layer() & (1 << p_bit);
}
void Area::_bind_methods() {
@@ -565,14 +565,14 @@ void Area::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_collision_mask", "collision_mask"), &Area::set_collision_mask);
ClassDB::bind_method(D_METHOD("get_collision_mask"), &Area::get_collision_mask);
- ClassDB::bind_method(D_METHOD("set_layer_mask", "layer_mask"), &Area::set_layer_mask);
- ClassDB::bind_method(D_METHOD("get_layer_mask"), &Area::get_layer_mask);
+ ClassDB::bind_method(D_METHOD("set_collision_layer", "collision_layer"), &Area::set_collision_layer);
+ ClassDB::bind_method(D_METHOD("get_collision_layer"), &Area::get_collision_layer);
ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &Area::set_collision_mask_bit);
ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &Area::get_collision_mask_bit);
- ClassDB::bind_method(D_METHOD("set_layer_mask_bit", "bit", "value"), &Area::set_layer_mask_bit);
- ClassDB::bind_method(D_METHOD("get_layer_mask_bit", "bit"), &Area::get_layer_mask_bit);
+ ClassDB::bind_method(D_METHOD("set_collision_layer_bit", "bit", "value"), &Area::set_collision_layer_bit);
+ ClassDB::bind_method(D_METHOD("get_collision_layer_bit", "bit"), &Area::get_collision_layer_bit);
ClassDB::bind_method(D_METHOD("set_monitorable", "enable"), &Area::set_monitorable);
ClassDB::bind_method(D_METHOD("is_monitorable"), &Area::is_monitorable);
@@ -610,7 +610,7 @@ void Area::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "monitoring"), "set_monitoring", "is_monitoring");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "monitorable"), "set_monitorable", "is_monitorable");
ADD_GROUP("Collision", "collision_");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layers", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_layer_mask", "get_layer_mask");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_layer", "get_collision_layer");
ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
}
@@ -628,7 +628,7 @@ Area::Area()
priority = 0;
monitoring = false;
collision_mask = 1;
- layer_mask = 1;
+ collision_layer = 1;
set_ray_pickable(false);
set_monitoring(true);
set_monitorable(true);
diff --git a/scene/3d/area.h b/scene/3d/area.h
index 64bbae9236..279a52ee69 100644
--- a/scene/3d/area.h
+++ b/scene/3d/area.h
@@ -55,7 +55,7 @@ private:
real_t angular_damp;
real_t linear_damp;
uint32_t collision_mask;
- uint32_t layer_mask;
+ uint32_t collision_layer;
int priority;
bool monitoring;
bool monitorable;
@@ -164,14 +164,14 @@ public:
void set_collision_mask(uint32_t p_mask);
uint32_t get_collision_mask() const;
- void set_layer_mask(uint32_t p_mask);
- uint32_t get_layer_mask() const;
+ void set_collision_layer(uint32_t p_layer);
+ uint32_t get_collision_layer() const;
void set_collision_mask_bit(int p_bit, bool p_value);
bool get_collision_mask_bit(int p_bit) const;
- void set_layer_mask_bit(int p_bit, bool p_value);
- bool get_layer_mask_bit(int p_bit) const;
+ void set_collision_layer_bit(int p_bit, bool p_value);
+ bool get_collision_layer_bit(int p_bit) const;
Array get_overlapping_bodies() const;
Array get_overlapping_areas() const; //function for script
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index b4a4cf70bb..9c87acec6e 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -234,7 +234,7 @@ void Light::_bind_methods() {
BIND_CONSTANT(PARAM_SHADOW_SPLIT_3_OFFSET);
BIND_CONSTANT(PARAM_SHADOW_NORMAL_BIAS);
BIND_CONSTANT(PARAM_SHADOW_BIAS);
- BIND_CONSTANT(PARAM_SHADOW_BIAS_SPLIT_SCALE);
+
BIND_CONSTANT(PARAM_MAX);
}
@@ -262,8 +262,7 @@ Light::Light(VisualServer::LightType p_type) {
set_param(PARAM_SHADOW_SPLIT_2_OFFSET, 0.2);
set_param(PARAM_SHADOW_SPLIT_3_OFFSET, 0.5);
set_param(PARAM_SHADOW_NORMAL_BIAS, 0.0);
- set_param(PARAM_SHADOW_BIAS, 0.);
- set_param(PARAM_SHADOW_BIAS_SPLIT_SCALE, 0.1);
+ set_param(PARAM_SHADOW_BIAS, 0.15);
}
Light::Light() {
@@ -318,7 +317,6 @@ void DirectionalLight::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_split_3", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_param", "get_param", PARAM_SHADOW_SPLIT_3_OFFSET);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "directional_shadow_blend_splits"), "set_blend_splits", "is_blend_splits_enabled");
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_normal_bias", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_SHADOW_NORMAL_BIAS);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_bias_split_scale", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_SHADOW_BIAS_SPLIT_SCALE);
BIND_CONSTANT(SHADOW_ORTHOGONAL);
BIND_CONSTANT(SHADOW_PARALLEL_2_SPLITS);
@@ -328,8 +326,11 @@ void DirectionalLight::_bind_methods() {
DirectionalLight::DirectionalLight()
: Light(VisualServer::LIGHT_DIRECTIONAL) {
- set_param(PARAM_SHADOW_NORMAL_BIAS, 0.1);
+ set_param(PARAM_SHADOW_NORMAL_BIAS, 0.2);
+ set_param(PARAM_SHADOW_BIAS, 1.0);
+ set_param(PARAM_SHADOW_MAX_DISTANCE, 200);
set_shadow_mode(SHADOW_PARALLEL_4_SPLITS);
+
blend_splits = false;
}
diff --git a/scene/3d/light.h b/scene/3d/light.h
index c02f9d12d3..22ff5c0763 100644
--- a/scene/3d/light.h
+++ b/scene/3d/light.h
@@ -60,7 +60,6 @@ public:
PARAM_SHADOW_SPLIT_3_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET,
PARAM_SHADOW_NORMAL_BIAS = VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS,
PARAM_SHADOW_BIAS = VS::LIGHT_PARAM_SHADOW_BIAS,
- PARAM_SHADOW_BIAS_SPLIT_SCALE = VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE,
PARAM_MAX = VS::LIGHT_PARAM_MAX
};
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 98babedf0d..3a55a2bc32 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -59,15 +59,15 @@ float PhysicsBody::get_inverse_mass() const {
return 0;
}
-void PhysicsBody::set_collision_layer(uint32_t p_mask) {
+void PhysicsBody::set_collision_layer(uint32_t p_layer) {
- layer_mask = p_mask;
- PhysicsServer::get_singleton()->body_set_layer_mask(get_rid(), p_mask);
+ collision_layer = p_layer;
+ PhysicsServer::get_singleton()->body_set_collision_layer(get_rid(), p_layer);
}
uint32_t PhysicsBody::get_collision_layer() const {
- return layer_mask;
+ return collision_layer;
}
void PhysicsBody::set_collision_mask(uint32_t p_mask) {
@@ -167,7 +167,7 @@ void PhysicsBody::_bind_methods() {
PhysicsBody::PhysicsBody(PhysicsServer::BodyMode p_mode)
: CollisionObject(PhysicsServer::get_singleton()->body_create(p_mode), false) {
- layer_mask = 1;
+ collision_layer = 1;
collision_mask = 1;
}
diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h
index d13f84dc15..db4147f8f6 100644
--- a/scene/3d/physics_body.h
+++ b/scene/3d/physics_body.h
@@ -38,7 +38,7 @@ class PhysicsBody : public CollisionObject {
GDCLASS(PhysicsBody, CollisionObject);
- uint32_t layer_mask;
+ uint32_t collision_layer;
uint32_t collision_mask;
void _set_layers(uint32_t p_mask);
@@ -54,7 +54,7 @@ public:
virtual Vector3 get_angular_velocity() const;
virtual float get_inverse_mass() const;
- void set_collision_layer(uint32_t p_mask);
+ void set_collision_layer(uint32_t p_layer);
uint32_t get_collision_layer() const;
void set_collision_mask(uint32_t p_mask);
diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp
index 345afd3edf..67e7fb0e12 100644
--- a/scene/3d/ray_cast.cpp
+++ b/scene/3d/ray_cast.cpp
@@ -46,14 +46,14 @@ Vector3 RayCast::get_cast_to() const {
return cast_to;
}
-void RayCast::set_layer_mask(uint32_t p_mask) {
+void RayCast::set_collision_layer(uint32_t p_layer) {
- layer_mask = p_mask;
+ collision_layer = p_layer;
}
-uint32_t RayCast::get_layer_mask() const {
+uint32_t RayCast::get_collision_layer() const {
- return layer_mask;
+ return collision_layer;
}
void RayCast::set_type_mask(uint32_t p_mask) {
@@ -170,7 +170,7 @@ void RayCast::_update_raycast_state() {
PhysicsDirectSpaceState::RayResult rr;
- if (dss->intersect_ray(gt.get_origin(), gt.xform(to), rr, exclude, layer_mask, type_mask)) {
+ if (dss->intersect_ray(gt.get_origin(), gt.xform(to), rr, exclude, collision_layer, type_mask)) {
collided = true;
against = rr.collider_id;
@@ -243,15 +243,15 @@ void RayCast::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear_exceptions"), &RayCast::clear_exceptions);
- ClassDB::bind_method(D_METHOD("set_layer_mask", "mask"), &RayCast::set_layer_mask);
- ClassDB::bind_method(D_METHOD("get_layer_mask"), &RayCast::get_layer_mask);
+ ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &RayCast::set_collision_layer);
+ ClassDB::bind_method(D_METHOD("get_collision_layer"), &RayCast::get_collision_layer);
ClassDB::bind_method(D_METHOD("set_type_mask", "mask"), &RayCast::set_type_mask);
ClassDB::bind_method(D_METHOD("get_type_mask"), &RayCast::get_type_mask);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "cast_to"), "set_cast_to", "get_cast_to");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "layer_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_layer_mask", "get_layer_mask");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_layer", "get_collision_layer");
ADD_PROPERTY(PropertyInfo(Variant::INT, "type_mask", PROPERTY_HINT_FLAGS, "Static,Kinematic,Rigid,Character,Area"), "set_type_mask", "get_type_mask");
}
@@ -323,7 +323,7 @@ RayCast::RayCast() {
against = 0;
collided = false;
against_shape = 0;
- layer_mask = 1;
+ collision_layer = 1;
type_mask = PhysicsDirectSpaceState::TYPE_MASK_COLLISION;
cast_to = Vector3(0, -1, 0);
debug_shape = NULL;
diff --git a/scene/3d/ray_cast.h b/scene/3d/ray_cast.h
index 63a53d724f..e9b34c4f75 100644
--- a/scene/3d/ray_cast.h
+++ b/scene/3d/ray_cast.h
@@ -47,7 +47,7 @@ class RayCast : public Spatial {
Set<RID> exclude;
- uint32_t layer_mask;
+ uint32_t collision_layer;
uint32_t type_mask;
Node *debug_shape;
@@ -69,8 +69,8 @@ public:
void set_cast_to(const Vector3 &p_point);
Vector3 get_cast_to() const;
- void set_layer_mask(uint32_t p_mask);
- uint32_t get_layer_mask() const;
+ void set_collision_layer(uint32_t p_layer);
+ uint32_t get_collision_layer() const;
void set_type_mask(uint32_t p_mask);
uint32_t get_type_mask() const;
diff --git a/scene/gui/button_array.cpp b/scene/gui/button_array.cpp
deleted file mode 100644
index 1616272e66..0000000000
--- a/scene/gui/button_array.cpp
+++ /dev/null
@@ -1,546 +0,0 @@
-/*************************************************************************/
-/* button_array.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#include "button_array.h"
-
-bool ButtonArray::_set(const StringName &p_name, const Variant &p_value) {
-
- String n = String(p_name);
- if (n.begins_with("button/")) {
-
- String what = n.get_slicec('/', 1);
- if (what == "count") {
- int new_size = p_value;
- if (new_size > 0 && buttons.size() == 0) {
- selected = 0;
- }
-
- if (new_size < buttons.size()) {
- if (selected >= new_size)
- selected = new_size - 1;
- }
- buttons.resize(new_size);
- _change_notify();
- minimum_size_changed();
- } else if (what == "align") {
- set_align(Align(p_value.operator int()));
- } else if (what == "selected") {
- set_selected(p_value);
- } else if (what == "min_button_size") {
- min_button_size = p_value;
- } else {
- int idx = what.to_int();
- ERR_FAIL_INDEX_V(idx, buttons.size(), false);
- String f = n.get_slicec('/', 2);
- if (f == "text") {
- buttons[idx].text = p_value;
- buttons[idx].xl_text = XL_MESSAGE(p_value);
- } else if (f == "tooltip")
- buttons[idx].tooltip = p_value;
- else if (f == "icon")
- buttons[idx].icon = p_value;
- else
- return false;
- }
-
- update();
- return true;
- }
-
- return false;
-}
-
-bool ButtonArray::_get(const StringName &p_name, Variant &r_ret) const {
-
- String n = String(p_name);
- if (n.begins_with("button/")) {
-
- String what = n.get_slicec('/', 1);
- if (what == "count") {
- r_ret = buttons.size();
- } else if (what == "align") {
- r_ret = get_align();
- } else if (what == "selected") {
- r_ret = get_selected();
- } else if (what == "min_button_size") {
- r_ret = min_button_size;
- } else {
- int idx = what.to_int();
- ERR_FAIL_INDEX_V(idx, buttons.size(), false);
- String f = n.get_slicec('/', 2);
- if (f == "text")
- r_ret = buttons[idx].text;
- else if (f == "tooltip")
- r_ret = buttons[idx].tooltip;
- else if (f == "icon")
- r_ret = buttons[idx].icon;
- else
- return false;
- }
-
- return true;
- }
-
- return false;
-}
-void ButtonArray::_get_property_list(List<PropertyInfo> *p_list) const {
-
- p_list->push_back(PropertyInfo(Variant::INT, "button/count", PROPERTY_HINT_RANGE, "0,512,1"));
- p_list->push_back(PropertyInfo(Variant::INT, "button/min_button_size", PROPERTY_HINT_RANGE, "0,1024,1"));
- p_list->push_back(PropertyInfo(Variant::INT, "button/align", PROPERTY_HINT_ENUM, "Begin,Center,End,Fill,Expand"));
- for (int i = 0; i < buttons.size(); i++) {
- String base = "button/" + itos(i) + "/";
- p_list->push_back(PropertyInfo(Variant::STRING, base + "text"));
- p_list->push_back(PropertyInfo(Variant::STRING, base + "tooltip"));
- p_list->push_back(PropertyInfo(Variant::OBJECT, base + "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture"));
- }
- if (buttons.size() > 0) {
- p_list->push_back(PropertyInfo(Variant::INT, "button/selected", PROPERTY_HINT_RANGE, "0," + itos(buttons.size() - 1) + ",1"));
- }
-}
-
-Size2 ButtonArray::get_minimum_size() const {
-
- Ref<StyleBox> style_normal = get_stylebox("normal");
- Ref<StyleBox> style_selected = get_stylebox("selected");
- Ref<Font> font_normal = get_font("font");
- Ref<Font> font_selected = get_font("font_selected");
- int icon_sep = get_constant("icon_separator");
- int button_sep = get_constant("button_separator");
-
- Size2 minsize;
-
- for (int i = 0; i < buttons.size(); i++) {
-
- Ref<StyleBox> sb = i == selected ? style_selected : style_normal;
- Ref<Font> f = i == selected ? font_selected : font_normal;
-
- Size2 ms;
- ms = f->get_string_size(buttons[i].xl_text);
- if (buttons[i].icon.is_valid()) {
-
- Size2 bs = buttons[i].icon->get_size();
- ms.height = MAX(ms.height, bs.height);
- ms.width += bs.width + icon_sep;
- }
-
- ms += sb->get_minimum_size();
-
- buttons[i]._ms_cache = ms[orientation];
-
- minsize[orientation] += ms[orientation];
- if (i > 0)
- minsize[orientation] += button_sep;
- minsize[!orientation] = MAX(minsize[!orientation], ms[!orientation]);
- }
-
- return minsize;
-}
-
-void ButtonArray::_notification(int p_what) {
-
- switch (p_what) {
- case NOTIFICATION_MOUSE_EXIT: {
- hover = -1;
- update();
- } break;
- case NOTIFICATION_READY: {
- MethodInfo mi;
- mi.name = "mouse_sub_enter";
-
- add_user_signal(mi);
-
- } break;
- case NOTIFICATION_DRAW: {
-
- Size2 size = get_size();
- Size2 minsize = get_combined_minimum_size();
- Ref<StyleBox> style_normal = get_stylebox("normal");
- Ref<StyleBox> style_selected = get_stylebox("selected");
- Ref<StyleBox> style_focus = get_stylebox("focus");
- Ref<StyleBox> style_hover = get_stylebox("hover");
- Ref<Font> font_normal = get_font("font");
- Ref<Font> font_selected = get_font("font_selected");
- int icon_sep = get_constant("icon_separator");
- int button_sep = get_constant("button_separator");
- Color color_normal = get_color("font_color");
- Color color_selected = get_color("font_color_selected");
-
- int sep = button_sep;
- int ofs = 0;
- int expand = 0;
-
- switch (align) {
- case ALIGN_BEGIN: {
-
- ofs = 0;
- } break;
- case ALIGN_CENTER: {
-
- ofs = Math::floor((size[orientation] - minsize[orientation]) / 2);
- } break;
- case ALIGN_END: {
-
- ofs = Math::floor((size[orientation] - minsize[orientation]));
- } break;
- case ALIGN_FILL: {
-
- if (buttons.size() > 1)
- sep += Math::floor((size[orientation] - minsize[orientation]) / (buttons.size() - 1.0));
- ofs = 0;
- } break;
- case ALIGN_EXPAND_FILL: {
-
- ofs = 0;
- expand = size[orientation] - minsize[orientation];
- } break;
- }
-
- int op_size = orientation == VERTICAL ? size.width : size.height;
-
- for (int i = 0; i < buttons.size(); i++) {
-
- int ms = buttons[i]._ms_cache;
- int s = ms;
- if (expand > 0) {
- s += expand / buttons.size();
- }
- if (min_button_size != -1 && s < min_button_size) {
- s = min_button_size;
- }
-
- Rect2 r;
- r.position[orientation] = ofs;
- r.position[!orientation] = 0;
- r.size[orientation] = s;
- r.size[!orientation] = op_size;
-
- Ref<Font> f;
- Color c;
- Point2 sbsize;
- Point2 sbofs;
- if (i == selected) {
- draw_style_box(style_selected, r);
- sbsize = style_selected->get_minimum_size();
- sbofs = style_selected->get_offset();
- f = font_selected;
- c = color_selected;
- if (has_focus())
- draw_style_box(style_focus, r);
- } else {
- if (hover == i)
- draw_style_box(style_hover, r);
- else if (!flat)
- draw_style_box(style_normal, r);
- sbsize = style_normal->get_minimum_size();
- sbofs = style_normal->get_offset();
- f = font_normal;
- c = color_normal;
- }
-
- Size2 ssize = f->get_string_size(buttons[i].xl_text);
- if (buttons[i].icon.is_valid()) {
-
- ssize.x += buttons[i].icon->get_width();
- }
- Point2 text_ofs = ((r.size - ssize - sbsize) / 2.0 + Point2(0, f->get_ascent())).floor() + sbofs;
- if (buttons[i].icon.is_valid()) {
-
- draw_texture(buttons[i].icon, r.position + Point2(text_ofs.x, Math::floor((r.size.height - buttons[i].icon->get_height()) / 2.0)));
- text_ofs.x += buttons[i].icon->get_width() + icon_sep;
- }
- draw_string(f, text_ofs + r.position, buttons[i].xl_text, c);
- buttons[i]._pos_cache = ofs;
- buttons[i]._size_cache = s;
-
- ofs += s;
- ofs += sep;
- }
-
- } break;
- }
-}
-
-void ButtonArray::_gui_input(const Ref<InputEvent> &p_event) {
-
- if (
- ((orientation == HORIZONTAL && p_event->is_action("ui_left")) ||
- (orientation == VERTICAL && p_event->is_action("ui_up"))) &&
- p_event->is_pressed() && selected > 0) {
- set_selected(selected - 1);
- accept_event();
- emit_signal("button_selected", selected);
- return;
- }
-
- if (
- ((orientation == HORIZONTAL && p_event->is_action("ui_right")) ||
- (orientation == VERTICAL && p_event->is_action("ui_down"))) &&
- p_event->is_pressed() && selected < (buttons.size() - 1)) {
- set_selected(selected + 1);
- accept_event();
- emit_signal("button_selected", selected);
- return;
- }
-
- Ref<InputEventMouseButton> mb = p_event;
-
- if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
-
- int ofs = orientation == HORIZONTAL ? mb->get_position().x : mb->get_position().y;
-
- for (int i = 0; i < buttons.size(); i++) {
-
- if (ofs >= buttons[i]._pos_cache && ofs < buttons[i]._pos_cache + buttons[i]._size_cache) {
-
- set_selected(i);
- emit_signal("button_selected", i);
- return;
- }
- }
- }
-
- Ref<InputEventMouseMotion> mm = p_event;
-
- if (mm.is_valid()) {
-
- int ofs = orientation == HORIZONTAL ? mm->get_position().x : mm->get_position().y;
- int new_hover = -1;
- for (int i = 0; i < buttons.size(); i++) {
-
- if (ofs >= buttons[i]._pos_cache && ofs < buttons[i]._pos_cache + buttons[i]._size_cache) {
-
- new_hover = i;
- break;
- }
- }
-
- if (new_hover != hover) {
- hover = new_hover;
- emit_signal("mouse_sub_enter");
- update();
- }
- }
-}
-
-String ButtonArray::get_tooltip(const Point2 &p_pos) const {
-
- int ofs = orientation == HORIZONTAL ? p_pos.x : p_pos.y;
- for (int i = 0; i < buttons.size(); i++) {
-
- if (ofs >= buttons[i]._pos_cache && ofs < buttons[i]._pos_cache + buttons[i]._size_cache)
- return buttons[i].tooltip;
- }
- return Control::get_tooltip(p_pos);
-}
-
-void ButtonArray::set_align(Align p_align) {
-
- align = p_align;
- update();
-}
-
-ButtonArray::Align ButtonArray::get_align() const {
-
- return align;
-}
-
-void ButtonArray::set_flat(bool p_flat) {
-
- flat = p_flat;
- update();
-}
-
-bool ButtonArray::is_flat() const {
-
- return flat;
-}
-
-void ButtonArray::add_button(const String &p_text, const String &p_tooltip) {
-
- Button button;
- button.text = p_text;
- button.xl_text = XL_MESSAGE(p_text);
- button.tooltip = p_tooltip;
- buttons.push_back(button);
- update();
-
- if (selected == -1)
- selected = 0;
-
- minimum_size_changed();
-}
-
-void ButtonArray::add_icon_button(const Ref<Texture> &p_icon, const String &p_text, const String &p_tooltip) {
-
- Button button;
- button.text = p_text;
- button.xl_text = XL_MESSAGE(p_text);
- button.icon = p_icon;
- button.tooltip = p_tooltip;
- buttons.push_back(button);
- if (selected == -1)
- selected = 0;
-
- update();
-}
-
-void ButtonArray::set_button_text(int p_button, const String &p_text) {
-
- ERR_FAIL_INDEX(p_button, buttons.size());
- buttons[p_button].text = p_text;
- buttons[p_button].xl_text = XL_MESSAGE(p_text);
- update();
- minimum_size_changed();
-}
-
-void ButtonArray::set_button_tooltip(int p_button, const String &p_text) {
-
- ERR_FAIL_INDEX(p_button, buttons.size());
- buttons[p_button].tooltip = p_text;
-}
-
-void ButtonArray::set_button_icon(int p_button, const Ref<Texture> &p_icon) {
-
- ERR_FAIL_INDEX(p_button, buttons.size());
- buttons[p_button].icon = p_icon;
- update();
- minimum_size_changed();
-}
-
-String ButtonArray::get_button_text(int p_button) const {
-
- ERR_FAIL_INDEX_V(p_button, buttons.size(), "");
- return buttons[p_button].text;
-}
-
-String ButtonArray::get_button_tooltip(int p_button) const {
-
- ERR_FAIL_INDEX_V(p_button, buttons.size(), "");
- return buttons[p_button].tooltip;
-}
-
-Ref<Texture> ButtonArray::get_button_icon(int p_button) const {
-
- ERR_FAIL_INDEX_V(p_button, buttons.size(), Ref<Texture>());
- return buttons[p_button].icon;
-}
-
-int ButtonArray::get_selected() const {
-
- return selected;
-}
-
-int ButtonArray::get_hovered() const {
-
- return hover;
-}
-
-void ButtonArray::set_selected(int p_selected) {
-
- ERR_FAIL_INDEX(p_selected, buttons.size());
- selected = p_selected;
- update();
-}
-
-void ButtonArray::erase_button(int p_button) {
-
- ERR_FAIL_INDEX(p_button, buttons.size());
- buttons.remove(p_button);
- if (p_button >= selected)
- selected--;
- if (selected < 0)
- selected = 0;
- if (selected >= buttons.size())
- selected = buttons.size() - 1;
-
- update();
-}
-
-void ButtonArray::clear() {
-
- buttons.clear();
- selected = -1;
- update();
-}
-
-int ButtonArray::get_button_count() const {
-
- return buttons.size();
-}
-
-void ButtonArray::get_translatable_strings(List<String> *p_strings) const {
-
- for (int i = 0; i < buttons.size(); i++) {
- p_strings->push_back(buttons[i].text);
- p_strings->push_back(buttons[i].tooltip);
- }
-}
-
-void ButtonArray::_bind_methods() {
-
- ClassDB::bind_method(D_METHOD("add_button", "text", "tooltip"), &ButtonArray::add_button, DEFVAL(""));
- ClassDB::bind_method(D_METHOD("add_icon_button", "icon:Texture", "text", "tooltip"), &ButtonArray::add_icon_button, DEFVAL(""), DEFVAL(""));
- ClassDB::bind_method(D_METHOD("set_button_text", "button_idx", "text"), &ButtonArray::set_button_text);
- ClassDB::bind_method(D_METHOD("set_button_tooltip", "button_idx", "text"), &ButtonArray::set_button_tooltip);
- ClassDB::bind_method(D_METHOD("set_button_icon", "button_idx", "icon:Texture"), &ButtonArray::set_button_icon);
- ClassDB::bind_method(D_METHOD("get_button_text", "button_idx"), &ButtonArray::get_button_text);
- ClassDB::bind_method(D_METHOD("get_button_tooltip", "button_idx"), &ButtonArray::get_button_tooltip);
- ClassDB::bind_method(D_METHOD("get_button_icon:Texture", "button_idx"), &ButtonArray::get_button_icon);
- ClassDB::bind_method(D_METHOD("get_button_count"), &ButtonArray::get_button_count);
- ClassDB::bind_method(D_METHOD("set_flat", "enabled"), &ButtonArray::set_flat);
- ClassDB::bind_method(D_METHOD("is_flat"), &ButtonArray::is_flat);
- ClassDB::bind_method(D_METHOD("get_selected"), &ButtonArray::get_selected);
- ClassDB::bind_method(D_METHOD("get_hovered"), &ButtonArray::get_hovered);
- ClassDB::bind_method(D_METHOD("set_selected", "button_idx"), &ButtonArray::set_selected);
- ClassDB::bind_method(D_METHOD("erase_button", "button_idx"), &ButtonArray::erase_button);
- ClassDB::bind_method(D_METHOD("clear"), &ButtonArray::clear);
-
- ClassDB::bind_method(D_METHOD("_gui_input"), &ButtonArray::_gui_input);
-
- BIND_CONSTANT(ALIGN_BEGIN);
- BIND_CONSTANT(ALIGN_CENTER);
- BIND_CONSTANT(ALIGN_END);
- BIND_CONSTANT(ALIGN_FILL);
- BIND_CONSTANT(ALIGN_EXPAND_FILL);
-
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flat"), "set_flat", "is_flat");
-
- ADD_SIGNAL(MethodInfo("button_selected", PropertyInfo(Variant::INT, "button_idx")));
-}
-
-ButtonArray::ButtonArray(Orientation p_orientation) {
-
- orientation = p_orientation;
- selected = -1;
- set_focus_mode(FOCUS_ALL);
- hover = -1;
- flat = false;
- min_button_size = -1;
-}
diff --git a/scene/gui/button_array.h b/scene/gui/button_array.h
deleted file mode 100644
index 0ebf681cb6..0000000000
--- a/scene/gui/button_array.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*************************************************************************/
-/* button_array.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#ifndef BUTTON_ARRAY_H
-#define BUTTON_ARRAY_H
-
-#include "scene/gui/control.h"
-
-class ButtonArray : public Control {
-
- GDCLASS(ButtonArray, Control);
-
-public:
- enum Align {
- ALIGN_BEGIN,
- ALIGN_CENTER,
- ALIGN_END,
- ALIGN_FILL,
- ALIGN_EXPAND_FILL
- };
-
-private:
- Orientation orientation;
- Align align;
-
- struct Button {
-
- String text;
- String xl_text;
- String tooltip;
- Ref<Texture> icon;
- mutable int _ms_cache;
- mutable int _pos_cache;
- mutable int _size_cache;
- };
-
- int selected;
- int hover;
- bool flat;
- double min_button_size;
-
- Vector<Button> buttons;
-
-protected:
- bool _set(const StringName &p_name, const Variant &p_value);
- bool _get(const StringName &p_name, Variant &r_ret) const;
- void _get_property_list(List<PropertyInfo> *p_list) const;
-
- void _notification(int p_what);
- static void _bind_methods();
-
-public:
- void _gui_input(const Ref<InputEvent> &p_event);
-
- void set_align(Align p_align);
- Align get_align() const;
-
- void set_flat(bool p_flat);
- bool is_flat() const;
-
- void add_button(const String &p_button, const String &p_tooltip = "");
- void add_icon_button(const Ref<Texture> &p_icon, const String &p_button = "", const String &p_tooltip = "");
-
- void set_button_text(int p_button, const String &p_text);
- void set_button_tooltip(int p_button, const String &p_text);
- void set_button_icon(int p_button, const Ref<Texture> &p_icon);
-
- String get_button_text(int p_button) const;
- String get_button_tooltip(int p_button) const;
- Ref<Texture> get_button_icon(int p_button) const;
-
- int get_selected() const;
- int get_hovered() const;
- void set_selected(int p_selected);
-
- int get_button_count() const;
-
- void erase_button(int p_button);
- void clear();
-
- virtual Size2 get_minimum_size() const;
-
- virtual void get_translatable_strings(List<String> *p_strings) const;
- virtual String get_tooltip(const Point2 &p_pos) const;
-
- ButtonArray(Orientation p_orientation = HORIZONTAL);
-};
-
-class HButtonArray : public ButtonArray {
- GDCLASS(HButtonArray, ButtonArray);
-
-public:
- HButtonArray()
- : ButtonArray(HORIZONTAL){};
-};
-
-class VButtonArray : public ButtonArray {
- GDCLASS(VButtonArray, ButtonArray);
-
-public:
- VButtonArray()
- : ButtonArray(VERTICAL){};
-};
-
-#endif // BUTTON_ARRAY_H
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index f0e486aa50..d3bdc401ab 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -156,6 +156,8 @@ void ColorPicker::_update_color() {
_update_text_value();
sample->update();
+ uv_edit->update();
+ w_edit->update();
updating = false;
}
@@ -263,10 +265,10 @@ void ColorPicker::_hsv_draw(int p_wich, Control *c) {
points.push_back(c->get_size());
points.push_back(Vector2(0, c->get_size().y));
Vector<Color> colors;
- colors.push_back(Color(1, 1, 1));
- colors.push_back(Color(1, 1, 1));
- colors.push_back(Color());
- colors.push_back(Color());
+ colors.push_back(Color(1, 1, 1, 1));
+ colors.push_back(Color(1, 1, 1, 1));
+ colors.push_back(Color(0, 0, 0, 1));
+ colors.push_back(Color(0, 0, 0, 1));
c->draw_polygon(points, colors);
Vector<Color> colors2;
Color col = color;
@@ -279,7 +281,7 @@ void ColorPicker::_hsv_draw(int p_wich, Control *c) {
colors2.push_back(col);
col.a = 0;
colors2.push_back(col);
- c->draw_polygon(points, colors);
+ c->draw_polygon(points, colors2);
int x = CLAMP(c->get_size().x * s, 0, c->get_size().x);
int y = CLAMP(c->get_size().y - c->get_size().y * v, 0, c->get_size().y);
col = color;
@@ -290,7 +292,7 @@ void ColorPicker::_hsv_draw(int p_wich, Control *c) {
} else if (p_wich == 1) {
Ref<Texture> hue = get_icon("color_hue", "ColorPicker");
c->draw_texture_rect(hue, Rect2(Point2(), c->get_size()));
- int y = c->get_size().y - c->get_size().y * h;
+ int y = c->get_size().y - c->get_size().y * (1.0 - h);
Color col = Color();
col.set_hsv(h, 1, 1);
c->draw_line(Point2(0, y), Point2(c->get_size().x, y), col.inverted());
@@ -343,7 +345,7 @@ void ColorPicker::_w_input(const Ref<InputEvent> &ev) {
if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) {
changing_color = true;
- h = 1 - ((float)bev->get_position().y) / 256.0;
+ h = 1 - (256.0 - (float)bev->get_position().y) / 256.0;
} else {
changing_color = false;
@@ -362,7 +364,8 @@ void ColorPicker::_w_input(const Ref<InputEvent> &ev) {
if (!changing_color)
return;
float y = CLAMP((float)mev->get_position().y, 0, 256);
- h = 1.0 - y / 256.0;
+ //h = 1.0 - y / 256.0;
+ h = y / 256.0;
color.set_hsv(h, s, v, color.a);
last_hsv = color;
set_pick_color(color);
diff --git a/scene/gui/color_ramp_edit.cpp b/scene/gui/gradient_edit.cpp
index 33e4ce0403..58bce57580 100644
--- a/scene/gui/color_ramp_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -27,10 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "color_ramp_edit.h"
+#include "gradient_edit.h"
#include "os/keyboard.h"
-ColorRampEdit::ColorRampEdit() {
+GradientEdit::GradientEdit() {
grabbed = -1;
grabbing = false;
set_focus_mode(FOCUS_ALL);
@@ -46,7 +46,7 @@ ColorRampEdit::ColorRampEdit() {
checker->create_from_image(img, ImageTexture::FLAG_REPEAT);
}
-int ColorRampEdit::_get_point_from_pos(int x) {
+int GradientEdit::_get_point_from_pos(int x) {
int result = -1;
int total_w = get_size().width - get_size().height - 3;
for (int i = 0; i < points.size(); i++) {
@@ -58,7 +58,7 @@ int ColorRampEdit::_get_point_from_pos(int x) {
return result;
}
-void ColorRampEdit::_show_color_picker() {
+void GradientEdit::_show_color_picker() {
if (grabbed == -1)
return;
Size2 ms = Size2(350, picker->get_combined_minimum_size().height + 10);
@@ -68,10 +68,10 @@ void ColorRampEdit::_show_color_picker() {
popup->popup();
}
-ColorRampEdit::~ColorRampEdit() {
+GradientEdit::~GradientEdit() {
}
-void ColorRampEdit::_gui_input(const Ref<InputEvent> &p_event) {
+void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
@@ -272,7 +272,7 @@ void ColorRampEdit::_gui_input(const Ref<InputEvent> &p_event) {
}
}
-void ColorRampEdit::_notification(int p_what) {
+void GradientEdit::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
if (!picker->is_connected("color_changed", this, "_color_changed")) {
@@ -370,7 +370,7 @@ void ColorRampEdit::_notification(int p_what) {
}
}
-void ColorRampEdit::_draw_checker(int x, int y, int w, int h) {
+void GradientEdit::_draw_checker(int x, int y, int w, int h) {
//Draw it with polygon to insert UVs for scale
Vector<Vector2> backPoints;
backPoints.push_back(Vector2(x, y));
@@ -391,12 +391,12 @@ void ColorRampEdit::_draw_checker(int x, int y, int w, int h) {
draw_polygon(backPoints, colorPoints, uvPoints, checker);
}
-Size2 ColorRampEdit::get_minimum_size() const {
+Size2 GradientEdit::get_minimum_size() const {
return Vector2(0, 16);
}
-void ColorRampEdit::_color_changed(const Color &p_color) {
+void GradientEdit::_color_changed(const Color &p_color) {
if (grabbed == -1)
return;
@@ -405,7 +405,7 @@ void ColorRampEdit::_color_changed(const Color &p_color) {
emit_signal("ramp_changed");
}
-void ColorRampEdit::set_ramp(const Vector<float> &p_offsets, const Vector<Color> &p_colors) {
+void GradientEdit::set_ramp(const Vector<float> &p_offsets, const Vector<Color> &p_colors) {
ERR_FAIL_COND(p_offsets.size() != p_colors.size());
points.clear();
@@ -420,33 +420,33 @@ void ColorRampEdit::set_ramp(const Vector<float> &p_offsets, const Vector<Color>
update();
}
-Vector<float> ColorRampEdit::get_offsets() const {
+Vector<float> GradientEdit::get_offsets() const {
Vector<float> ret;
for (int i = 0; i < points.size(); i++)
ret.push_back(points[i].offset);
return ret;
}
-Vector<Color> ColorRampEdit::get_colors() const {
+Vector<Color> GradientEdit::get_colors() const {
Vector<Color> ret;
for (int i = 0; i < points.size(); i++)
ret.push_back(points[i].color);
return ret;
}
-void ColorRampEdit::set_points(Vector<Gradient::Point> &p_points) {
+void GradientEdit::set_points(Vector<Gradient::Point> &p_points) {
if (points.size() != p_points.size())
grabbed = -1;
points.clear();
points = p_points;
}
-Vector<Gradient::Point> &ColorRampEdit::get_points() {
+Vector<Gradient::Point> &GradientEdit::get_points() {
return points;
}
-void ColorRampEdit::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &ColorRampEdit::_gui_input);
- ClassDB::bind_method(D_METHOD("_color_changed"), &ColorRampEdit::_color_changed);
+void GradientEdit::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("_gui_input"), &GradientEdit::_gui_input);
+ ClassDB::bind_method(D_METHOD("_color_changed"), &GradientEdit::_color_changed);
ADD_SIGNAL(MethodInfo("ramp_changed"));
}
diff --git a/scene/gui/color_ramp_edit.h b/scene/gui/gradient_edit.h
index 0fe447c43a..6c4ae6fd15 100644
--- a/scene/gui/color_ramp_edit.h
+++ b/scene/gui/gradient_edit.h
@@ -37,9 +37,9 @@
#define POINT_WIDTH 8
-class ColorRampEdit : public Control {
+class GradientEdit : public Control {
- GDCLASS(ColorRampEdit, Control);
+ GDCLASS(GradientEdit, Control);
PopupPanel *popup;
ColorPicker *picker;
@@ -68,8 +68,8 @@ public:
Vector<Gradient::Point> &get_points();
virtual Size2 get_minimum_size() const;
- ColorRampEdit();
- virtual ~ColorRampEdit();
+ GradientEdit();
+ virtual ~GradientEdit();
};
/*class ColorRampEditPanel : public Panel
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 9f078072d7..3e714f7c31 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -42,7 +42,7 @@
#include "scene/2d/path_2d.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
-#include "scene/gui/button_array.h"
+
#include "scene/gui/button_group.h"
#include "scene/gui/center_container.h"
#include "scene/gui/check_box.h"
@@ -360,9 +360,6 @@ void register_scene_types() {
OS::get_singleton()->yield(); //may take time to init
- ClassDB::register_virtual_class<ButtonArray>();
- ClassDB::register_class<HButtonArray>();
- ClassDB::register_class<VButtonArray>();
ClassDB::register_class<TextureProgress>();
ClassDB::register_class<ItemList>();
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index ce88325539..a6927f13b9 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -1370,6 +1370,8 @@ void SpatialMaterial::_bind_methods() {
BIND_CONSTANT(BILLBOARD_ENABLED);
BIND_CONSTANT(BILLBOARD_FIXED_Y);
BIND_CONSTANT(BILLBOARD_PARTICLES);
+
+
}
SpatialMaterial::SpatialMaterial()
diff --git a/servers/physics/collision_object_sw.cpp b/servers/physics/collision_object_sw.cpp
index dc0b2fc84f..d673088304 100644
--- a/servers/physics/collision_object_sw.cpp
+++ b/servers/physics/collision_object_sw.cpp
@@ -208,7 +208,7 @@ CollisionObjectSW::CollisionObjectSW(Type p_type) {
type = p_type;
space = NULL;
instance_id = 0;
- layer_mask = 1;
+ collision_layer = 1;
collision_mask = 1;
ray_pickable = true;
}
diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h
index 0767f88ba1..15082a0551 100644
--- a/servers/physics/collision_object_sw.h
+++ b/servers/physics/collision_object_sw.h
@@ -53,7 +53,7 @@ private:
Type type;
RID self;
ObjectID instance_id;
- uint32_t layer_mask;
+ uint32_t collision_layer;
uint32_t collision_mask;
struct Shape {
@@ -134,14 +134,14 @@ public:
_FORCE_INLINE_ void set_shape_as_trigger(int p_idx, bool p_enable) { shapes[p_idx].trigger = p_enable; }
_FORCE_INLINE_ bool is_shape_set_as_trigger(int p_idx) const { return shapes[p_idx].trigger; }
- _FORCE_INLINE_ void set_layer_mask(uint32_t p_mask) { layer_mask = p_mask; }
- _FORCE_INLINE_ uint32_t get_layer_mask() const { return layer_mask; }
+ _FORCE_INLINE_ void set_collision_layer(uint32_t p_layer) { collision_layer = p_layer; }
+ _FORCE_INLINE_ uint32_t get_collision_layer() const { return collision_layer; }
_FORCE_INLINE_ void set_collision_mask(uint32_t p_mask) { collision_mask = p_mask; }
_FORCE_INLINE_ uint32_t get_collision_mask() const { return collision_mask; }
_FORCE_INLINE_ bool test_collision_mask(CollisionObjectSW *p_other) const {
- return layer_mask & p_other->collision_mask || p_other->layer_mask & collision_mask;
+ return collision_layer & p_other->collision_mask || p_other->collision_layer & collision_mask;
}
void remove_shape(ShapeSW *p_shape);
diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp
index 727ff38718..455863da91 100644
--- a/servers/physics/physics_server_sw.cpp
+++ b/servers/physics/physics_server_sw.cpp
@@ -389,12 +389,12 @@ Transform PhysicsServerSW::area_get_transform(RID p_area) const {
return area->get_transform();
};
-void PhysicsServerSW::area_set_layer_mask(RID p_area, uint32_t p_mask) {
+void PhysicsServerSW::area_set_collision_layer(RID p_area, uint32_t p_layer) {
AreaSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
- area->set_layer_mask(p_mask);
+ area->set_collision_layer(p_layer);
}
void PhysicsServerSW::area_set_collision_mask(RID p_area, uint32_t p_mask) {
@@ -609,21 +609,21 @@ bool PhysicsServerSW::body_is_continuous_collision_detection_enabled(RID p_body)
return body->is_continuous_collision_detection_enabled();
}
-void PhysicsServerSW::body_set_layer_mask(RID p_body, uint32_t p_mask) {
+void PhysicsServerSW::body_set_collision_layer(RID p_body, uint32_t p_layer) {
BodySW *body = body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->set_layer_mask(p_mask);
+ body->set_collision_layer(p_layer);
body->wakeup();
}
-uint32_t PhysicsServerSW::body_get_layer_mask(RID p_body, uint32_t p_mask) const {
+uint32_t PhysicsServerSW::body_get_collision_layer(RID p_body) const {
const BodySW *body = body_owner.get(p_body);
ERR_FAIL_COND_V(!body, 0);
- return body->get_layer_mask();
+ return body->get_collision_layer();
}
void PhysicsServerSW::body_set_collision_mask(RID p_body, uint32_t p_mask) {
@@ -635,7 +635,7 @@ void PhysicsServerSW::body_set_collision_mask(RID p_body, uint32_t p_mask) {
body->wakeup();
}
-uint32_t PhysicsServerSW::body_get_collision_mask(RID p_body, uint32_t p_mask) const {
+uint32_t PhysicsServerSW::body_get_collision_mask(RID p_body) const {
const BodySW *body = body_owner.get(p_body);
ERR_FAIL_COND_V(!body, 0);
@@ -665,7 +665,7 @@ void PhysicsServerSW::body_set_user_flags(RID p_body, uint32_t p_flags) {
ERR_FAIL_COND(!body);
};
-uint32_t PhysicsServerSW::body_get_user_flags(RID p_body, uint32_t p_flags) const {
+uint32_t PhysicsServerSW::body_get_user_flags(RID p_body) const {
BodySW *body = body_owner.get(p_body);
ERR_FAIL_COND_V(!body, 0);
diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h
index 44f9aff662..559e9aeb51 100644
--- a/servers/physics/physics_server_sw.h
+++ b/servers/physics/physics_server_sw.h
@@ -130,7 +130,7 @@ public:
virtual bool area_is_ray_pickable(RID p_area) const;
virtual void area_set_collision_mask(RID p_area, uint32_t p_mask);
- virtual void area_set_layer_mask(RID p_area, uint32_t p_mask);
+ virtual void area_set_collision_layer(RID p_area, uint32_t p_layer);
virtual void area_set_monitorable(RID p_area, bool p_monitorable);
@@ -168,14 +168,14 @@ public:
virtual void body_set_enable_continuous_collision_detection(RID p_body, bool p_enable);
virtual bool body_is_continuous_collision_detection_enabled(RID p_body) const;
- virtual void body_set_layer_mask(RID p_body, uint32_t p_mask);
- virtual uint32_t body_get_layer_mask(RID p_body, uint32_t p_mask) const;
+ virtual void body_set_collision_layer(RID p_body, uint32_t p_layer);
+ virtual uint32_t body_get_collision_layer(RID p_body) const;
virtual void body_set_collision_mask(RID p_body, uint32_t p_mask);
- virtual uint32_t body_get_collision_mask(RID p_body, uint32_t p_mask) const;
+ virtual uint32_t body_get_collision_mask(RID p_body) const;
virtual void body_set_user_flags(RID p_body, uint32_t p_flags);
- virtual uint32_t body_get_user_flags(RID p_body, uint32_t p_flags) const;
+ virtual uint32_t body_get_user_flags(RID p_body) const;
virtual void body_set_param(RID p_body, BodyParameter p_param, real_t p_value);
virtual real_t body_get_param(RID p_body, BodyParameter p_param) const;
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index 16562dce6b..67ac21e4f9 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -32,12 +32,12 @@
#include "global_config.h"
#include "physics_server_sw.h"
-_FORCE_INLINE_ static bool _match_object_type_query(CollisionObjectSW *p_object, uint32_t p_layer_mask, uint32_t p_type_mask) {
+_FORCE_INLINE_ static bool _match_object_type_query(CollisionObjectSW *p_object, uint32_t p_collision_layer, uint32_t p_type_mask) {
if (p_object->get_type() == CollisionObjectSW::TYPE_AREA)
return p_type_mask & PhysicsDirectSpaceState::TYPE_MASK_AREA;
- if ((p_object->get_layer_mask() & p_layer_mask) == 0)
+ if ((p_object->get_collision_layer() & p_collision_layer) == 0)
return false;
BodySW *body = static_cast<BodySW *>(p_object);
@@ -45,7 +45,7 @@ _FORCE_INLINE_ static bool _match_object_type_query(CollisionObjectSW *p_object,
return (1 << body->get_mode()) & p_type_mask;
}
-bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask, bool p_pick_ray) {
+bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask, bool p_pick_ray) {
ERR_FAIL_COND_V(space->locked, false);
@@ -67,7 +67,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto
for (int i = 0; i < amount; i++) {
- if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
+ if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
continue;
if (p_pick_ray && !(static_cast<CollisionObjectSW *>(space->intersection_query_results[i])->is_ray_pickable()))
@@ -123,7 +123,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto
return true;
}
-int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transform &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask) {
+int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transform &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
if (p_result_max <= 0)
return 0;
@@ -144,7 +144,7 @@ int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transfo
if (cc >= p_result_max)
break;
- if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
+ if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
continue;
//area can't be picked by ray (default)
@@ -174,7 +174,7 @@ int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transfo
return cc;
}
-bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask, ShapeRestInfo *r_info) {
+bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask, ShapeRestInfo *r_info) {
ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.get(p_shape);
ERR_FAIL_COND_V(!shape, false);
@@ -204,7 +204,7 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
for (int i = 0; i < amount; i++) {
- if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
+ if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
continue;
if (p_exclude.has(space->intersection_query_results[i]->get_self()))
@@ -295,7 +295,7 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
return true;
}
-bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask) {
+bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
if (p_result_max <= 0)
return 0;
@@ -325,7 +325,7 @@ bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_sh
for (int i = 0; i < amount; i++) {
- if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
+ if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
continue;
const CollisionObjectSW *col_obj = space->intersection_query_results[i];
@@ -374,7 +374,7 @@ static void _rest_cbk_result(const Vector3 &p_point_A, const Vector3 &p_point_B,
rd->best_object = rd->object;
rd->best_shape = rd->shape;
}
-bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask) {
+bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.get(p_shape);
ERR_FAIL_COND_V(!shape, 0);
@@ -391,7 +391,7 @@ bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_
for (int i = 0; i < amount; i++) {
- if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
+ if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
continue;
const CollisionObjectSW *col_obj = space->intersection_query_results[i];
diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h
index 20a2a06862..782bacbd65 100644
--- a/servers/physics/space_sw.h
+++ b/servers/physics/space_sw.h
@@ -47,11 +47,11 @@ class PhysicsDirectSpaceStateSW : public PhysicsDirectSpaceState {
public:
SpaceSW *space;
- virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, bool p_pick_ray = false);
- virtual int intersect_shape(const RID &p_shape, const Transform &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
- virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, ShapeRestInfo *r_info = NULL);
- virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
- virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
+ virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, bool p_pick_ray = false);
+ virtual int intersect_shape(const RID &p_shape, const Transform &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
+ virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, ShapeRestInfo *r_info = NULL);
+ virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
+ virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
PhysicsDirectSpaceStateSW();
};
diff --git a/servers/physics_2d/collision_object_2d_sw.cpp b/servers/physics_2d/collision_object_2d_sw.cpp
index b6c1d145df..0163a18850 100644
--- a/servers/physics_2d/collision_object_2d_sw.cpp
+++ b/servers/physics_2d/collision_object_2d_sw.cpp
@@ -214,6 +214,6 @@ CollisionObject2DSW::CollisionObject2DSW(Type p_type) {
space = NULL;
instance_id = 0;
collision_mask = 1;
- layer_mask = 1;
+ collision_layer = 1;
pickable = true;
}
diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h
index 8ca6c92dbc..f2059e8618 100644
--- a/servers/physics_2d/collision_object_2d_sw.h
+++ b/servers/physics_2d/collision_object_2d_sw.h
@@ -67,7 +67,7 @@ private:
Transform2D transform;
Transform2D inv_transform;
uint32_t collision_mask;
- uint32_t layer_mask;
+ uint32_t collision_layer;
bool _static;
void _update_shapes();
@@ -122,8 +122,8 @@ public:
void set_collision_mask(uint32_t p_mask) { collision_mask = p_mask; }
_FORCE_INLINE_ uint32_t get_collision_mask() const { return collision_mask; }
- void set_layer_mask(uint32_t p_mask) { layer_mask = p_mask; }
- _FORCE_INLINE_ uint32_t get_layer_mask() const { return layer_mask; }
+ void set_collision_layer(uint32_t p_layer) { collision_layer = p_layer; }
+ _FORCE_INLINE_ uint32_t get_collision_layer() const { return collision_layer; }
void remove_shape(Shape2DSW *p_shape);
void remove_shape(int p_index);
@@ -137,7 +137,7 @@ public:
_FORCE_INLINE_ bool test_collision_mask(CollisionObject2DSW *p_other) const {
- return layer_mask & p_other->collision_mask || p_other->layer_mask & collision_mask;
+ return collision_layer & p_other->collision_mask || p_other->collision_layer & collision_mask;
}
virtual ~CollisionObject2DSW() {}
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index 03e0f8a7fd..9a31fa49b0 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -476,12 +476,12 @@ void Physics2DServerSW::area_set_collision_mask(RID p_area, uint32_t p_mask) {
area->set_collision_mask(p_mask);
}
-void Physics2DServerSW::area_set_layer_mask(RID p_area, uint32_t p_mask) {
+void Physics2DServerSW::area_set_collision_layer(RID p_area, uint32_t p_layer) {
Area2DSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
- area->set_layer_mask(p_mask);
+ area->set_collision_layer(p_layer);
}
void Physics2DServerSW::area_set_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) {
@@ -691,19 +691,19 @@ uint32_t Physics2DServerSW::body_get_object_instance_ID(RID p_body) const {
return body->get_instance_id();
};
-void Physics2DServerSW::body_set_layer_mask(RID p_body, uint32_t p_flags) {
+void Physics2DServerSW::body_set_collision_layer(RID p_body, uint32_t p_flags) {
Body2DSW *body = body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->set_layer_mask(p_flags);
+ body->set_collision_layer(p_flags);
};
-uint32_t Physics2DServerSW::body_get_layer_mask(RID p_body) const {
+uint32_t Physics2DServerSW::body_get_collision_layer(RID p_body) const {
Body2DSW *body = body_owner.get(p_body);
ERR_FAIL_COND_V(!body, 0);
- return body->get_layer_mask();
+ return body->get_collision_layer();
};
void Physics2DServerSW::body_set_collision_mask(RID p_body, uint32_t p_flags) {
diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h
index a8d85932ff..be67e3157d 100644
--- a/servers/physics_2d/physics_2d_server_sw.h
+++ b/servers/physics_2d/physics_2d_server_sw.h
@@ -136,7 +136,7 @@ public:
virtual Transform2D area_get_transform(RID p_area) const;
virtual void area_set_monitorable(RID p_area, bool p_monitorable);
virtual void area_set_collision_mask(RID p_area, uint32_t p_mask);
- virtual void area_set_layer_mask(RID p_area, uint32_t p_mask);
+ virtual void area_set_collision_layer(RID p_area, uint32_t p_layer);
virtual void area_set_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method);
virtual void area_set_area_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method);
@@ -176,8 +176,8 @@ public:
virtual void body_set_continuous_collision_detection_mode(RID p_body, CCDMode p_mode);
virtual CCDMode body_get_continuous_collision_detection_mode(RID p_body) const;
- virtual void body_set_layer_mask(RID p_body, uint32_t p_mask);
- virtual uint32_t body_get_layer_mask(RID p_body) const;
+ virtual void body_set_collision_layer(RID p_body, uint32_t p_layer);
+ virtual uint32_t body_get_collision_layer(RID p_body) const;
virtual void body_set_collision_mask(RID p_body, uint32_t p_mask);
virtual uint32_t body_get_collision_mask(RID p_) const;
diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h
index ddcf31182a..1026d84fd9 100644
--- a/servers/physics_2d/physics_2d_server_wrap_mt.h
+++ b/servers/physics_2d/physics_2d_server_wrap_mt.h
@@ -162,7 +162,7 @@ public:
FUNC1RC(Transform2D, area_get_transform, RID);
FUNC2(area_set_collision_mask, RID, uint32_t);
- FUNC2(area_set_layer_mask, RID, uint32_t);
+ FUNC2(area_set_collision_layer, RID, uint32_t);
FUNC2(area_set_monitorable, RID, bool);
FUNC2(area_set_pickable, RID, bool);
@@ -203,8 +203,8 @@ public:
FUNC2(body_set_continuous_collision_detection_mode, RID, CCDMode);
FUNC1RC(CCDMode, body_get_continuous_collision_detection_mode, RID);
- FUNC2(body_set_layer_mask, RID, uint32_t);
- FUNC1RC(uint32_t, body_get_layer_mask, RID);
+ FUNC2(body_set_collision_layer, RID, uint32_t);
+ FUNC1RC(uint32_t, body_get_collision_layer, RID);
FUNC2(body_set_collision_mask, RID, uint32_t);
FUNC1RC(uint32_t, body_get_collision_mask, RID);
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index 78b1e84734..fd94fc01cd 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -31,9 +31,9 @@
#include "collision_solver_2d_sw.h"
#include "physics_2d_server_sw.h"
-_FORCE_INLINE_ static bool _match_object_type_query(CollisionObject2DSW *p_object, uint32_t p_layer_mask, uint32_t p_type_mask) {
+_FORCE_INLINE_ static bool _match_object_type_query(CollisionObject2DSW *p_object, uint32_t p_collision_layer, uint32_t p_type_mask) {
- if ((p_object->get_layer_mask() & p_layer_mask) == 0)
+ if ((p_object->get_collision_layer() & p_collision_layer) == 0)
return false;
if (p_object->get_type() == CollisionObject2DSW::TYPE_AREA)
@@ -44,7 +44,7 @@ _FORCE_INLINE_ static bool _match_object_type_query(CollisionObject2DSW *p_objec
return (1 << body->get_mode()) & p_type_mask;
}
-int Physics2DDirectSpaceStateSW::intersect_point(const Vector2 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask, bool p_pick_point) {
+int Physics2DDirectSpaceStateSW::intersect_point(const Vector2 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask, bool p_pick_point) {
if (p_result_max <= 0)
return 0;
@@ -59,7 +59,7 @@ int Physics2DDirectSpaceStateSW::intersect_point(const Vector2 &p_point, ShapeRe
for (int i = 0; i < amount; i++) {
- if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
+ if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
continue;
if (p_exclude.has(space->intersection_query_results[i]->get_self()))
@@ -95,7 +95,7 @@ int Physics2DDirectSpaceStateSW::intersect_point(const Vector2 &p_point, ShapeRe
return cc;
}
-bool Physics2DDirectSpaceStateSW::intersect_ray(const Vector2 &p_from, const Vector2 &p_to, RayResult &r_result, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask) {
+bool Physics2DDirectSpaceStateSW::intersect_ray(const Vector2 &p_from, const Vector2 &p_to, RayResult &r_result, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
ERR_FAIL_COND_V(space->locked, false);
@@ -117,7 +117,7 @@ bool Physics2DDirectSpaceStateSW::intersect_ray(const Vector2 &p_from, const Vec
for (int i = 0; i < amount; i++) {
- if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
+ if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
continue;
if (p_exclude.has(space->intersection_query_results[i]->get_self()))
@@ -175,7 +175,7 @@ bool Physics2DDirectSpaceStateSW::intersect_ray(const Vector2 &p_from, const Vec
return true;
}
-int Physics2DDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask) {
+int Physics2DDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
if (p_result_max <= 0)
return 0;
@@ -192,7 +192,7 @@ int Physics2DDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Trans
for (int i = 0; i < amount; i++) {
- if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
+ if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
continue;
if (p_exclude.has(space->intersection_query_results[i]->get_self()))
@@ -217,7 +217,7 @@ int Physics2DDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Trans
return cc;
}
-bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask) {
+bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
Shape2DSW *shape = Physics2DServerSW::singletonsw->shape_owner.get(p_shape);
ERR_FAIL_COND_V(!shape, false);
@@ -238,7 +238,7 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transfor
for (int i = 0; i < amount; i++) {
- if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
+ if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
continue;
if (p_exclude.has(space->intersection_query_results[i]->get_self()))
@@ -330,7 +330,7 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transfor
return true;
}
-bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, real_t p_margin, Vector2 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask) {
+bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, real_t p_margin, Vector2 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
if (p_result_max <= 0)
return 0;
@@ -361,7 +361,7 @@ bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D &
for (int i = 0; i < amount; i++) {
- if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
+ if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
continue;
const CollisionObject2DSW *col_obj = space->intersection_query_results[i];
@@ -428,7 +428,7 @@ static void _rest_cbk_result(const Vector2 &p_point_A, const Vector2 &p_point_B,
rd->best_shape = rd->shape;
}
-bool Physics2DDirectSpaceStateSW::rest_info(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_layer_mask, uint32_t p_object_type_mask) {
+bool Physics2DDirectSpaceStateSW::rest_info(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask) {
Shape2DSW *shape = Physics2DServerSW::singletonsw->shape_owner.get(p_shape);
ERR_FAIL_COND_V(!shape, 0);
@@ -446,7 +446,7 @@ bool Physics2DDirectSpaceStateSW::rest_info(RID p_shape, const Transform2D &p_sh
for (int i = 0; i < amount; i++) {
- if (!_match_object_type_query(space->intersection_query_results[i], p_layer_mask, p_object_type_mask))
+ if (!_match_object_type_query(space->intersection_query_results[i], p_collision_layer, p_object_type_mask))
continue;
const CollisionObject2DSW *col_obj = space->intersection_query_results[i];
diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h
index 46435b1c66..64841c4328 100644
--- a/servers/physics_2d/space_2d_sw.h
+++ b/servers/physics_2d/space_2d_sw.h
@@ -47,12 +47,12 @@ class Physics2DDirectSpaceStateSW : public Physics2DDirectSpaceState {
public:
Space2DSW *space;
- virtual int intersect_point(const Vector2 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, bool p_pick_point = false);
- virtual bool intersect_ray(const Vector2 &p_from, const Vector2 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
- virtual int intersect_shape(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
- virtual bool cast_motion(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
- virtual bool collide_shape(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, real_t p_margin, Vector2 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
- virtual bool rest_info(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
+ virtual int intersect_point(const Vector2 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, bool p_pick_point = false);
+ virtual bool intersect_ray(const Vector2 &p_from, const Vector2 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
+ virtual int intersect_shape(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
+ virtual bool cast_motion(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
+ virtual bool collide_shape(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, real_t p_margin, Vector2 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
+ virtual bool rest_info(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
Physics2DDirectSpaceStateSW();
};
diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp
index 43295073aa..8ffa82214c 100644
--- a/servers/physics_2d_server.cpp
+++ b/servers/physics_2d_server.cpp
@@ -154,13 +154,13 @@ float Physics2DShapeQueryParameters::get_margin() const {
return margin;
}
-void Physics2DShapeQueryParameters::set_layer_mask(int p_layer_mask) {
+void Physics2DShapeQueryParameters::set_collision_layer(int p_collision_layer) {
- layer_mask = p_layer_mask;
+ collision_layer = p_collision_layer;
}
-int Physics2DShapeQueryParameters::get_layer_mask() const {
+int Physics2DShapeQueryParameters::get_collision_layer() const {
- return layer_mask;
+ return collision_layer;
}
void Physics2DShapeQueryParameters::set_object_type_mask(int p_object_type_mask) {
@@ -204,8 +204,8 @@ void Physics2DShapeQueryParameters::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_margin", "margin"), &Physics2DShapeQueryParameters::set_margin);
ClassDB::bind_method(D_METHOD("get_margin"), &Physics2DShapeQueryParameters::get_margin);
- ClassDB::bind_method(D_METHOD("set_layer_mask", "layer_mask"), &Physics2DShapeQueryParameters::set_layer_mask);
- ClassDB::bind_method(D_METHOD("get_layer_mask"), &Physics2DShapeQueryParameters::get_layer_mask);
+ ClassDB::bind_method(D_METHOD("set_collision_layer", "collision_layer"), &Physics2DShapeQueryParameters::set_collision_layer);
+ ClassDB::bind_method(D_METHOD("get_collision_layer"), &Physics2DShapeQueryParameters::get_collision_layer);
ClassDB::bind_method(D_METHOD("set_object_type_mask", "object_type_mask"), &Physics2DShapeQueryParameters::set_object_type_mask);
ClassDB::bind_method(D_METHOD("get_object_type_mask"), &Physics2DShapeQueryParameters::get_object_type_mask);
@@ -217,7 +217,7 @@ void Physics2DShapeQueryParameters::_bind_methods() {
Physics2DShapeQueryParameters::Physics2DShapeQueryParameters() {
margin = 0;
- layer_mask = 0x7FFFFFFF;
+ collision_layer = 0x7FFFFFFF;
object_type_mask = Physics2DDirectSpaceState::TYPE_MASK_COLLISION;
}
@@ -249,7 +249,7 @@ Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryP
Vector<ShapeResult> sr;
sr.resize(p_max_results);
- int rc = intersect_shape(psq->shape, psq->transform, psq->motion, psq->margin, sr.ptr(), sr.size(), psq->exclude, psq->layer_mask, psq->object_type_mask);
+ int rc = intersect_shape(psq->shape, psq->transform, psq->motion, psq->margin, sr.ptr(), sr.size(), psq->exclude, psq->collision_layer, psq->object_type_mask);
Array ret;
ret.resize(rc);
for (int i = 0; i < rc; i++) {
@@ -269,7 +269,7 @@ Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryP
Array Physics2DDirectSpaceState::_cast_motion(const Ref<Physics2DShapeQueryParameters> &psq) {
float closest_safe, closest_unsafe;
- bool res = cast_motion(psq->shape, psq->transform, psq->motion, psq->margin, closest_safe, closest_unsafe, psq->exclude, psq->layer_mask, psq->object_type_mask);
+ bool res = cast_motion(psq->shape, psq->transform, psq->motion, psq->margin, closest_safe, closest_unsafe, psq->exclude, psq->collision_layer, psq->object_type_mask);
if (!res)
return Array();
Array ret;
@@ -312,7 +312,7 @@ Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryPar
Vector<Vector2> ret;
ret.resize(p_max_results * 2);
int rc = 0;
- bool res = collide_shape(psq->shape, psq->transform, psq->motion, psq->margin, ret.ptr(), p_max_results, rc, psq->exclude, psq->layer_mask, psq->object_type_mask);
+ bool res = collide_shape(psq->shape, psq->transform, psq->motion, psq->margin, ret.ptr(), p_max_results, rc, psq->exclude, psq->collision_layer, psq->object_type_mask);
if (!res)
return Array();
Array r;
@@ -325,7 +325,7 @@ Dictionary Physics2DDirectSpaceState::_get_rest_info(const Ref<Physics2DShapeQue
ShapeRestInfo sri;
- bool res = rest_info(psq->shape, psq->transform, psq->motion, psq->margin, &sri, psq->exclude, psq->layer_mask, psq->object_type_mask);
+ bool res = rest_info(psq->shape, psq->transform, psq->motion, psq->margin, &sri, psq->exclude, psq->collision_layer, psq->object_type_mask);
Dictionary r;
if (!res)
return r;
@@ -346,8 +346,8 @@ Physics2DDirectSpaceState::Physics2DDirectSpaceState() {
void Physics2DDirectSpaceState::_bind_methods() {
- ClassDB::bind_method(D_METHOD("intersect_point", "point", "max_results", "exclude", "layer_mask", "type_mask"), &Physics2DDirectSpaceState::_intersect_point, DEFVAL(32), DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(TYPE_MASK_COLLISION));
- ClassDB::bind_method(D_METHOD("intersect_ray:Dictionary", "from", "to", "exclude", "layer_mask", "type_mask"), &Physics2DDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(TYPE_MASK_COLLISION));
+ ClassDB::bind_method(D_METHOD("intersect_point", "point", "max_results", "exclude", "collision_layer", "type_mask"), &Physics2DDirectSpaceState::_intersect_point, DEFVAL(32), DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(TYPE_MASK_COLLISION));
+ ClassDB::bind_method(D_METHOD("intersect_ray:Dictionary", "from", "to", "exclude", "collision_layer", "type_mask"), &Physics2DDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(TYPE_MASK_COLLISION));
ClassDB::bind_method(D_METHOD("intersect_shape", "shape:Physics2DShapeQueryParameters", "max_results"), &Physics2DDirectSpaceState::_intersect_shape, DEFVAL(32));
ClassDB::bind_method(D_METHOD("cast_motion", "shape:Physics2DShapeQueryParameters"), &Physics2DDirectSpaceState::_cast_motion);
ClassDB::bind_method(D_METHOD("collide_shape", "shape:Physics2DShapeQueryParameters", "max_results"), &Physics2DDirectSpaceState::_collide_shape, DEFVAL(32));
@@ -504,7 +504,7 @@ void Physics2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("area_remove_shape", "area", "shape_idx"), &Physics2DServer::area_remove_shape);
ClassDB::bind_method(D_METHOD("area_clear_shapes", "area"), &Physics2DServer::area_clear_shapes);
- ClassDB::bind_method(D_METHOD("area_set_layer_mask", "area", "mask"), &Physics2DServer::area_set_layer_mask);
+ ClassDB::bind_method(D_METHOD("area_set_collision_layer", "area", "layer"), &Physics2DServer::area_set_collision_layer);
ClassDB::bind_method(D_METHOD("area_set_collision_mask", "area", "mask"), &Physics2DServer::area_set_collision_mask);
ClassDB::bind_method(D_METHOD("area_set_param", "area", "param", "value"), &Physics2DServer::area_set_param);
@@ -548,8 +548,8 @@ void Physics2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_set_continuous_collision_detection_mode", "body", "mode"), &Physics2DServer::body_set_continuous_collision_detection_mode);
ClassDB::bind_method(D_METHOD("body_get_continuous_collision_detection_mode", "body"), &Physics2DServer::body_get_continuous_collision_detection_mode);
- ClassDB::bind_method(D_METHOD("body_set_layer_mask", "body", "mask"), &Physics2DServer::body_set_layer_mask);
- ClassDB::bind_method(D_METHOD("body_get_layer_mask", "body"), &Physics2DServer::body_get_layer_mask);
+ ClassDB::bind_method(D_METHOD("body_set_collision_layer", "body", "layer"), &Physics2DServer::body_set_collision_layer);
+ ClassDB::bind_method(D_METHOD("body_get_collision_layer", "body"), &Physics2DServer::body_get_collision_layer);
ClassDB::bind_method(D_METHOD("body_set_collision_mask", "body", "mask"), &Physics2DServer::body_set_collision_mask);
ClassDB::bind_method(D_METHOD("body_get_collision_mask", "body"), &Physics2DServer::body_get_collision_mask);
diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h
index 4ea037e1b4..80113dd7d6 100644
--- a/servers/physics_2d_server.h
+++ b/servers/physics_2d_server.h
@@ -97,7 +97,7 @@ class Physics2DShapeQueryParameters : public Reference {
Vector2 motion;
float margin;
Set<RID> exclude;
- uint32_t layer_mask;
+ uint32_t collision_layer;
uint32_t object_type_mask;
protected:
@@ -117,8 +117,8 @@ public:
void set_margin(float p_margin);
float get_margin() const;
- void set_layer_mask(int p_layer_mask);
- int get_layer_mask() const;
+ void set_collision_layer(int p_collision_layer);
+ int get_collision_layer() const;
void set_object_type_mask(int p_object_type_mask);
int get_object_type_mask() const;
@@ -166,7 +166,7 @@ public:
Variant metadata;
};
- virtual bool intersect_ray(const Vector2 &p_from, const Vector2 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
+ virtual bool intersect_ray(const Vector2 &p_from, const Vector2 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
struct ShapeResult {
@@ -177,13 +177,13 @@ public:
Variant metadata;
};
- virtual int intersect_point(const Vector2 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, bool p_pick_point = false) = 0;
+ virtual int intersect_point(const Vector2 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, bool p_pick_point = false) = 0;
- virtual int intersect_shape(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, float p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
+ virtual int intersect_shape(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, float p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
- virtual bool cast_motion(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, float p_margin, float &p_closest_safe, float &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
+ virtual bool cast_motion(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, float p_margin, float &p_closest_safe, float &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
- virtual bool collide_shape(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, float p_margin, Vector2 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
+ virtual bool collide_shape(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, float p_margin, Vector2 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
struct ShapeRestInfo {
@@ -196,7 +196,7 @@ public:
Variant metadata;
};
- virtual bool rest_info(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, float p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
+ virtual bool rest_info(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, float p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
Physics2DDirectSpaceState();
};
@@ -342,7 +342,7 @@ public:
virtual Transform2D area_get_transform(RID p_area) const = 0;
virtual void area_set_collision_mask(RID p_area, uint32_t p_mask) = 0;
- virtual void area_set_layer_mask(RID p_area, uint32_t p_mask) = 0;
+ virtual void area_set_collision_layer(RID p_area, uint32_t p_layer) = 0;
virtual void area_set_monitorable(RID p_area, bool p_monitorable) = 0;
virtual void area_set_pickable(RID p_area, bool p_pickable) = 0;
@@ -398,8 +398,8 @@ public:
virtual void body_set_continuous_collision_detection_mode(RID p_body, CCDMode p_mode) = 0;
virtual CCDMode body_get_continuous_collision_detection_mode(RID p_body) const = 0;
- virtual void body_set_layer_mask(RID p_body, uint32_t p_mask) = 0;
- virtual uint32_t body_get_layer_mask(RID p_body) const = 0;
+ virtual void body_set_collision_layer(RID p_body, uint32_t p_layer) = 0;
+ virtual uint32_t body_get_collision_layer(RID p_body) const = 0;
virtual void body_set_collision_mask(RID p_body, uint32_t p_mask) = 0;
virtual uint32_t body_get_collision_mask(RID p_body) const = 0;
diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp
index b19dfc1c68..6b6db1ff8c 100644
--- a/servers/physics_server.cpp
+++ b/servers/physics_server.cpp
@@ -151,13 +151,13 @@ float PhysicsShapeQueryParameters::get_margin() const {
return margin;
}
-void PhysicsShapeQueryParameters::set_layer_mask(int p_layer_mask) {
+void PhysicsShapeQueryParameters::set_collision_layer(int p_collision_layer) {
- layer_mask = p_layer_mask;
+ collision_layer = p_collision_layer;
}
-int PhysicsShapeQueryParameters::get_layer_mask() const {
+int PhysicsShapeQueryParameters::get_collision_layer() const {
- return layer_mask;
+ return collision_layer;
}
void PhysicsShapeQueryParameters::set_object_type_mask(int p_object_type_mask) {
@@ -198,8 +198,8 @@ void PhysicsShapeQueryParameters::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_margin", "margin"), &PhysicsShapeQueryParameters::set_margin);
ClassDB::bind_method(D_METHOD("get_margin"), &PhysicsShapeQueryParameters::get_margin);
- ClassDB::bind_method(D_METHOD("set_layer_mask", "layer_mask"), &PhysicsShapeQueryParameters::set_layer_mask);
- ClassDB::bind_method(D_METHOD("get_layer_mask"), &PhysicsShapeQueryParameters::get_layer_mask);
+ ClassDB::bind_method(D_METHOD("set_collision_layer", "collision_layer"), &PhysicsShapeQueryParameters::set_collision_layer);
+ ClassDB::bind_method(D_METHOD("get_collision_layer"), &PhysicsShapeQueryParameters::get_collision_layer);
ClassDB::bind_method(D_METHOD("set_object_type_mask", "object_type_mask"), &PhysicsShapeQueryParameters::set_object_type_mask);
ClassDB::bind_method(D_METHOD("get_object_type_mask"), &PhysicsShapeQueryParameters::get_object_type_mask);
@@ -211,7 +211,7 @@ void PhysicsShapeQueryParameters::_bind_methods() {
PhysicsShapeQueryParameters::PhysicsShapeQueryParameters() {
margin = 0;
- layer_mask = 0x7FFFFFFF;
+ collision_layer = 0x7FFFFFFF;
object_type_mask = PhysicsDirectSpaceState::TYPE_MASK_COLLISION;
}
@@ -274,7 +274,7 @@ Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParam
Vector<ShapeResult> sr;
sr.resize(p_max_results);
- int rc = intersect_shape(psq->shape, psq->transform, psq->margin, sr.ptr(), sr.size(), psq->exclude, psq->layer_mask, psq->object_type_mask);
+ int rc = intersect_shape(psq->shape, psq->transform, psq->margin, sr.ptr(), sr.size(), psq->exclude, psq->collision_layer, psq->object_type_mask);
Array ret;
ret.resize(rc);
for (int i = 0; i < rc; i++) {
@@ -293,7 +293,7 @@ Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParam
Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameters> &psq, const Vector3 &p_motion) {
float closest_safe, closest_unsafe;
- bool res = cast_motion(psq->shape, psq->transform, p_motion, psq->margin, closest_safe, closest_unsafe, psq->exclude, psq->layer_mask, psq->object_type_mask);
+ bool res = cast_motion(psq->shape, psq->transform, p_motion, psq->margin, closest_safe, closest_unsafe, psq->exclude, psq->collision_layer, psq->object_type_mask);
if (!res)
return Array();
Array ret;
@@ -307,7 +307,7 @@ Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParamet
Vector<Vector3> ret;
ret.resize(p_max_results * 2);
int rc = 0;
- bool res = collide_shape(psq->shape, psq->transform, psq->margin, ret.ptr(), p_max_results, rc, psq->exclude, psq->layer_mask, psq->object_type_mask);
+ bool res = collide_shape(psq->shape, psq->transform, psq->margin, ret.ptr(), p_max_results, rc, psq->exclude, psq->collision_layer, psq->object_type_mask);
if (!res)
return Array();
Array r;
@@ -320,7 +320,7 @@ Dictionary PhysicsDirectSpaceState::_get_rest_info(const Ref<PhysicsShapeQueryPa
ShapeRestInfo sri;
- bool res = rest_info(psq->shape, psq->transform, psq->margin, &sri, psq->exclude, psq->layer_mask, psq->object_type_mask);
+ bool res = rest_info(psq->shape, psq->transform, psq->margin, &sri, psq->exclude, psq->collision_layer, psq->object_type_mask);
Dictionary r;
if (!res)
return r;
@@ -343,7 +343,7 @@ void PhysicsDirectSpaceState::_bind_methods() {
//ClassDB::bind_method(D_METHOD("intersect_ray","from","to","exclude","umask"),&PhysicsDirectSpaceState::_intersect_ray,DEFVAL(Array()),DEFVAL(0));
//ClassDB::bind_method(D_METHOD("intersect_shape:PhysicsShapeQueryResult","shape","xform","result_max","exclude","umask"),&PhysicsDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0));
- ClassDB::bind_method(D_METHOD("intersect_ray:Dictionary", "from", "to", "exclude", "layer_mask", "type_mask"), &PhysicsDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(TYPE_MASK_COLLISION));
+ ClassDB::bind_method(D_METHOD("intersect_ray:Dictionary", "from", "to", "exclude", "collision_layer", "type_mask"), &PhysicsDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(TYPE_MASK_COLLISION));
ClassDB::bind_method(D_METHOD("intersect_shape", "shape:PhysicsShapeQueryParameters", "max_results"), &PhysicsDirectSpaceState::_intersect_shape, DEFVAL(32));
ClassDB::bind_method(D_METHOD("cast_motion", "shape:PhysicsShapeQueryParameters", "motion"), &PhysicsDirectSpaceState::_cast_motion);
ClassDB::bind_method(D_METHOD("collide_shape", "shape:PhysicsShapeQueryParameters", "max_results"), &PhysicsDirectSpaceState::_collide_shape, DEFVAL(32));
@@ -425,7 +425,7 @@ void PhysicsServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("area_remove_shape", "area", "shape_idx"), &PhysicsServer::area_remove_shape);
ClassDB::bind_method(D_METHOD("area_clear_shapes", "area"), &PhysicsServer::area_clear_shapes);
- ClassDB::bind_method(D_METHOD("area_set_layer_mask", "area", "mask"), &PhysicsServer::area_set_layer_mask);
+ ClassDB::bind_method(D_METHOD("area_set_collision_layer", "area", "layer"), &PhysicsServer::area_set_collision_layer);
ClassDB::bind_method(D_METHOD("area_set_collision_mask", "area", "mask"), &PhysicsServer::area_set_collision_mask);
ClassDB::bind_method(D_METHOD("area_set_param", "area", "param", "value"), &PhysicsServer::area_set_param);
@@ -450,8 +450,8 @@ void PhysicsServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("body_set_mode", "body", "mode"), &PhysicsServer::body_set_mode);
ClassDB::bind_method(D_METHOD("body_get_mode", "body"), &PhysicsServer::body_get_mode);
- ClassDB::bind_method(D_METHOD("body_set_layer_mask", "body", "mask"), &PhysicsServer::body_set_layer_mask);
- ClassDB::bind_method(D_METHOD("body_get_layer_mask", "body"), &PhysicsServer::body_get_layer_mask);
+ ClassDB::bind_method(D_METHOD("body_set_collision_layer", "body", "layer"), &PhysicsServer::body_set_collision_layer);
+ ClassDB::bind_method(D_METHOD("body_get_collision_layer", "body"), &PhysicsServer::body_get_collision_layer);
ClassDB::bind_method(D_METHOD("body_set_collision_mask", "body", "mask"), &PhysicsServer::body_set_collision_mask);
ClassDB::bind_method(D_METHOD("body_get_collision_mask", "body"), &PhysicsServer::body_get_collision_mask);
diff --git a/servers/physics_server.h b/servers/physics_server.h
index 95f725b774..3d1a2aec7a 100644
--- a/servers/physics_server.h
+++ b/servers/physics_server.h
@@ -100,7 +100,7 @@ class PhysicsShapeQueryParameters : public Reference {
Transform transform;
float margin;
Set<RID> exclude;
- uint32_t layer_mask;
+ uint32_t collision_layer;
uint32_t object_type_mask;
protected:
@@ -117,8 +117,8 @@ public:
void set_margin(float p_margin);
float get_margin() const;
- void set_layer_mask(int p_layer_mask);
- int get_layer_mask() const;
+ void set_collision_layer(int p_collision_layer);
+ int get_collision_layer() const;
void set_object_type_mask(int p_object_type_mask);
int get_object_type_mask() const;
@@ -166,7 +166,7 @@ public:
int shape;
};
- virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, bool p_pick_ray = false) = 0;
+ virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, bool p_pick_ray = false) = 0;
struct ShapeResult {
@@ -176,7 +176,7 @@ public:
int shape;
};
- virtual int intersect_shape(const RID &p_shape, const Transform &p_xform, float p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
+ virtual int intersect_shape(const RID &p_shape, const Transform &p_xform, float p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
struct ShapeRestInfo {
@@ -188,11 +188,11 @@ public:
Vector3 linear_velocity; //velocity at contact point
};
- virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &p_closest_safe, float &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, ShapeRestInfo *r_info = NULL) = 0;
+ virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &p_closest_safe, float &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, ShapeRestInfo *r_info = NULL) = 0;
- virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, float p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
+ virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, float p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
- virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, float p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
+ virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, float p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION) = 0;
PhysicsDirectSpaceState();
};
@@ -332,7 +332,7 @@ public:
virtual Transform area_get_transform(RID p_area) const = 0;
virtual void area_set_collision_mask(RID p_area, uint32_t p_mask) = 0;
- virtual void area_set_layer_mask(RID p_area, uint32_t p_mask) = 0;
+ virtual void area_set_collision_layer(RID p_area, uint32_t p_layer) = 0;
virtual void area_set_monitorable(RID p_area, bool p_monitorable) = 0;
@@ -382,14 +382,14 @@ public:
virtual void body_set_enable_continuous_collision_detection(RID p_body, bool p_enable) = 0;
virtual bool body_is_continuous_collision_detection_enabled(RID p_body) const = 0;
- virtual void body_set_layer_mask(RID p_body, uint32_t p_mask) = 0;
- virtual uint32_t body_get_layer_mask(RID p_body, uint32_t p_mask) const = 0;
+ virtual void body_set_collision_layer(RID p_body, uint32_t p_layer) = 0;
+ virtual uint32_t body_get_collision_layer(RID p_body) const = 0;
virtual void body_set_collision_mask(RID p_body, uint32_t p_mask) = 0;
- virtual uint32_t body_get_collision_mask(RID p_body, uint32_t p_mask) const = 0;
+ virtual uint32_t body_get_collision_mask(RID p_body) const = 0;
virtual void body_set_user_flags(RID p_body, uint32_t p_flags) = 0;
- virtual uint32_t body_get_user_flags(RID p_body, uint32_t p_flags) const = 0;
+ virtual uint32_t body_get_user_flags(RID p_body) const = 0;
// common body variables
enum BodyParameter {
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index c5fc2fe8af..7d922d6776 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -131,7 +131,7 @@ public:
virtual RID light_instance_create(RID p_light) = 0;
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) = 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 RID reflection_atlas_create() = 0;
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index e0201420fe..44aaf85581 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -153,6 +153,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["EXTRA_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["TIME"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["PARTICLE_CUSTOM"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["AT_LIGHT_PASS"] = ShaderLanguage::TYPE_BOOL;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["SRC_COLOR"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["POSITION"] = ShaderLanguage::TYPE_VEC2;
@@ -166,6 +167,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["SCREEN_UV"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["POINT_COORD"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["TIME"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["AT_LIGHT_PASS"] = ShaderLanguage::TYPE_BOOL;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["POSITION"] = ShaderLanguage::TYPE_VEC2;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["NORMAL"] = ShaderLanguage::TYPE_VEC3;
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index b905b230dc..352daa9655 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -1347,6 +1347,8 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
bool overlap = VSG::storage->light_directional_get_blend_splits(p_instance->base);
+ float first_radius = 0.0;
+
for (int i = 0; i < splits; i++) {
// setup a camera matrix for that range!
@@ -1373,9 +1375,11 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
// obtain the light frustm ranges (given endpoints)
- Vector3 x_vec = p_instance->transform.basis.get_axis(Vector3::AXIS_X).normalized();
- Vector3 y_vec = p_instance->transform.basis.get_axis(Vector3::AXIS_Y).normalized();
- Vector3 z_vec = p_instance->transform.basis.get_axis(Vector3::AXIS_Z).normalized();
+ Transform transform = p_instance->transform.orthonormalized(); //discard scale and stabilize light
+
+ Vector3 x_vec = transform.basis.get_axis(Vector3::AXIS_X).normalized();
+ Vector3 y_vec = transform.basis.get_axis(Vector3::AXIS_Y).normalized();
+ Vector3 z_vec = transform.basis.get_axis(Vector3::AXIS_Z).normalized();
//z_vec points agsint the camera, like in default opengl
float x_min, x_max;
@@ -1386,7 +1390,10 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
float y_min_cam, y_max_cam;
float z_min_cam, z_max_cam;
+ float bias_scale = 1.0;
+
//used for culling
+
for (int j = 0; j < 8; j++) {
float d_x = x_vec.dot(endpoints[j]);
@@ -1435,6 +1442,12 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
radius *= texture_size / (texture_size - 2.0); //add a texel by each side, so stepified texture will always fit
+ if (i == 0) {
+ first_radius = radius;
+ } else {
+ bias_scale = radius / first_radius;
+ }
+
x_max_cam = x_vec.dot(center) + radius;
x_min_cam = x_vec.dot(center) - radius;
y_max_cam = y_vec.dot(center) + radius;
@@ -1493,10 +1506,10 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
ortho_camera.set_orthogonal(-half_x, half_x, -half_y, half_y, 0, (z_max - z_min_cam));
Transform ortho_transform;
- ortho_transform.basis = p_instance->transform.basis;
+ ortho_transform.basis = transform.basis;
ortho_transform.origin = x_vec * (x_min_cam + half_x) + y_vec * (y_min_cam + half_y) + z_vec * z_max;
- VSG::scene_render->light_instance_set_shadow_transform(light->instance, ortho_camera, ortho_transform, 0, distances[i + 1], i);
+ VSG::scene_render->light_instance_set_shadow_transform(light->instance, ortho_camera, ortho_transform, 0, distances[i + 1], i, bias_scale);
}
VSG::scene_render->render_shadow(light->instance, p_shadow_atlas, i, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 4f2f9d30fa..470f927f6b 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -358,7 +358,6 @@ public:
LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET,
LIGHT_PARAM_SHADOW_NORMAL_BIAS,
LIGHT_PARAM_SHADOW_BIAS,
- LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE,
LIGHT_PARAM_MAX
};
diff --git a/thirdparty/README.md b/thirdparty/README.md
index c3dd1dff6e..c846094a6a 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -72,7 +72,7 @@ Files extracted from upstream source:
## glad
- Upstream: https://github.com/Dav1dde/glad
-- Version: 0.1.13a0
+- Version: 0.1.14a0
- License: MIT
The files we package are automatically generated.
diff --git a/thirdparty/glad/glad.c b/thirdparty/glad/glad.c
index 70a93f8d25..2d756ec3f6 100644
--- a/thirdparty/glad/glad.c
+++ b/thirdparty/glad/glad.c
@@ -1,6 +1,6 @@
/*
- OpenGL loader generated by glad 0.1.13a0 on Fri Jan 6 19:27:07 2017.
+ OpenGL loader generated by glad 0.1.14a0 on Wed Jun 14 20:12:45 2017.
Language/Generator: C/C++
Specification: gl
@@ -30,7 +30,7 @@ static void* get_proc(const char *namez);
static HMODULE libGL;
typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*);
-PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
+static PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
static
int open_gl(void) {
@@ -57,7 +57,7 @@ static void* libGL;
#ifndef __APPLE__
typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*);
-PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
+static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
#endif
static
@@ -152,19 +152,19 @@ static int get_exts(void) {
exts = (const char *)glGetString(GL_EXTENSIONS);
#ifdef _GLAD_IS_SOME_NEW_VERSION
} else {
- int index;
+ unsigned int index;
num_exts_i = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i);
if (num_exts_i > 0) {
- exts_i = (const char **)realloc((void *)exts_i, num_exts_i * sizeof *exts_i);
+ exts_i = (const char **)realloc((void *)exts_i, (size_t)num_exts_i * (sizeof *exts_i));
}
if (exts_i == NULL) {
return 0;
}
- for(index = 0; index < num_exts_i; index++) {
+ for(index = 0; index < (unsigned)num_exts_i; index++) {
exts_i[index] = (const char*)glGetStringi(GL_EXTENSIONS, index);
}
}
@@ -174,7 +174,7 @@ static int get_exts(void) {
static void free_exts(void) {
if (exts_i != NULL) {
- free((char **)exts_i);
+ free((void *)exts_i);
exts_i = NULL;
}
}
diff --git a/thirdparty/glad/glad/glad.h b/thirdparty/glad/glad/glad.h
index e5eb22e297..cb78df071e 100644
--- a/thirdparty/glad/glad/glad.h
+++ b/thirdparty/glad/glad/glad.h
@@ -1,6 +1,6 @@
/*
- OpenGL loader generated by glad 0.1.13a0 on Fri Jan 6 19:27:07 2017.
+ OpenGL loader generated by glad 0.1.14a0 on Wed Jun 14 20:12:45 2017.
Language/Generator: C/C++
Specification: gl
@@ -54,7 +54,7 @@ typedef void* (* GLADloadproc)(const char *name);
#ifndef GLAPI
# if defined(GLAD_GLAPI_EXPORT)
-# if defined(WIN32) || defined(__CYGWIN__)
+# if defined(_WIN32) || defined(__CYGWIN__)
# if defined(GLAD_GLAPI_EXPORT_BUILD)
# if defined(__GNUC__)
# define GLAPI __attribute__ ((dllexport)) extern
@@ -183,6 +183,7 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen
typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam);
typedef unsigned short GLhalfNV;
typedef GLintptr GLvdpauSurfaceNV;
+typedef void (APIENTRY *GLVULKANPROCNV)(void);
#define GL_DEPTH_BUFFER_BIT 0x00000100
#define GL_STENCIL_BUFFER_BIT 0x00000400
#define GL_COLOR_BUFFER_BIT 0x00004000
@@ -264,7 +265,6 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_BLEND_SRC 0x0BE1
#define GL_BLEND 0x0BE2
#define GL_LOGIC_OP_MODE 0x0BF0
-#define GL_COLOR_LOGIC_OP 0x0BF2
#define GL_DRAW_BUFFER 0x0C01
#define GL_READ_BUFFER 0x0C02
#define GL_SCISSOR_BOX 0x0C10
@@ -292,21 +292,9 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_SUBPIXEL_BITS 0x0D50
#define GL_TEXTURE_1D 0x0DE0
#define GL_TEXTURE_2D 0x0DE1
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-#define GL_POLYGON_OFFSET_POINT 0x2A01
-#define GL_POLYGON_OFFSET_LINE 0x2A02
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_TEXTURE_BINDING_1D 0x8068
-#define GL_TEXTURE_BINDING_2D 0x8069
#define GL_TEXTURE_WIDTH 0x1000
#define GL_TEXTURE_HEIGHT 0x1001
-#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
#define GL_TEXTURE_BORDER_COLOR 0x1004
-#define GL_TEXTURE_RED_SIZE 0x805C
-#define GL_TEXTURE_GREEN_SIZE 0x805D
-#define GL_TEXTURE_BLUE_SIZE 0x805E
-#define GL_TEXTURE_ALPHA_SIZE 0x805F
#define GL_DONT_CARE 0x1100
#define GL_FASTEST 0x1101
#define GL_NICEST 0x1102
@@ -317,7 +305,6 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_INT 0x1404
#define GL_UNSIGNED_INT 0x1405
#define GL_FLOAT 0x1406
-#define GL_DOUBLE 0x140A
#define GL_STACK_OVERFLOW 0x0503
#define GL_STACK_UNDERFLOW 0x0504
#define GL_CLEAR 0x1500
@@ -369,23 +356,7 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_TEXTURE_MIN_FILTER 0x2801
#define GL_TEXTURE_WRAP_S 0x2802
#define GL_TEXTURE_WRAP_T 0x2803
-#define GL_PROXY_TEXTURE_1D 0x8063
-#define GL_PROXY_TEXTURE_2D 0x8064
#define GL_REPEAT 0x2901
-#define GL_R3_G3_B2 0x2A10
-#define GL_RGB4 0x804F
-#define GL_RGB5 0x8050
-#define GL_RGB8 0x8051
-#define GL_RGB10 0x8052
-#define GL_RGB12 0x8053
-#define GL_RGB16 0x8054
-#define GL_RGBA2 0x8055
-#define GL_RGBA4 0x8056
-#define GL_RGB5_A1 0x8057
-#define GL_RGBA8 0x8058
-#define GL_RGB10_A2 0x8059
-#define GL_RGBA12 0x805A
-#define GL_RGBA16 0x805B
#define GL_CURRENT_BIT 0x00000001
#define GL_POINT_BIT 0x00000002
#define GL_LINE_BIT 0x00000004
@@ -404,9 +375,6 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_TEXTURE_BIT 0x00040000
#define GL_SCISSOR_BIT 0x00080000
#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF
-#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
-#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
-#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
#define GL_QUAD_STRIP 0x0008
#define GL_POLYGON 0x0009
#define GL_ACCUM 0x0100
@@ -446,14 +414,6 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_PIXEL_MAP_G_TO_G 0x0C77
#define GL_PIXEL_MAP_B_TO_B 0x0C78
#define GL_PIXEL_MAP_A_TO_A 0x0C79
-#define GL_VERTEX_ARRAY_POINTER 0x808E
-#define GL_NORMAL_ARRAY_POINTER 0x808F
-#define GL_COLOR_ARRAY_POINTER 0x8090
-#define GL_INDEX_ARRAY_POINTER 0x8091
-#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
-#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093
-#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0
-#define GL_SELECTION_BUFFER_POINTER 0x0DF3
#define GL_CURRENT_COLOR 0x0B00
#define GL_CURRENT_INDEX 0x0B01
#define GL_CURRENT_NORMAL 0x0B02
@@ -499,11 +459,9 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_PROJECTION_MATRIX 0x0BA7
#define GL_TEXTURE_MATRIX 0x0BA8
#define GL_ATTRIB_STACK_DEPTH 0x0BB0
-#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1
#define GL_ALPHA_TEST 0x0BC0
#define GL_ALPHA_TEST_FUNC 0x0BC1
#define GL_ALPHA_TEST_REF 0x0BC2
-#define GL_INDEX_LOGIC_OP 0x0BF1
#define GL_LOGIC_OP 0x0BF1
#define GL_AUX_BUFFERS 0x0C00
#define GL_INDEX_CLEAR_VALUE 0x0C20
@@ -553,7 +511,6 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_MAX_NAME_STACK_DEPTH 0x0D37
#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
-#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B
#define GL_INDEX_BITS 0x0D51
#define GL_RED_BITS 0x0D52
#define GL_GREEN_BITS 0x0D53
@@ -589,35 +546,8 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_MAP1_GRID_SEGMENTS 0x0DD1
#define GL_MAP2_GRID_DOMAIN 0x0DD2
#define GL_MAP2_GRID_SEGMENTS 0x0DD3
-#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1
-#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2
-#define GL_SELECTION_BUFFER_SIZE 0x0DF4
-#define GL_VERTEX_ARRAY 0x8074
-#define GL_NORMAL_ARRAY 0x8075
-#define GL_COLOR_ARRAY 0x8076
-#define GL_INDEX_ARRAY 0x8077
-#define GL_TEXTURE_COORD_ARRAY 0x8078
-#define GL_EDGE_FLAG_ARRAY 0x8079
-#define GL_VERTEX_ARRAY_SIZE 0x807A
-#define GL_VERTEX_ARRAY_TYPE 0x807B
-#define GL_VERTEX_ARRAY_STRIDE 0x807C
-#define GL_NORMAL_ARRAY_TYPE 0x807E
-#define GL_NORMAL_ARRAY_STRIDE 0x807F
-#define GL_COLOR_ARRAY_SIZE 0x8081
-#define GL_COLOR_ARRAY_TYPE 0x8082
-#define GL_COLOR_ARRAY_STRIDE 0x8083
-#define GL_INDEX_ARRAY_TYPE 0x8085
-#define GL_INDEX_ARRAY_STRIDE 0x8086
-#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
-#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
-#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
-#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C
#define GL_TEXTURE_COMPONENTS 0x1003
#define GL_TEXTURE_BORDER 0x1005
-#define GL_TEXTURE_LUMINANCE_SIZE 0x8060
-#define GL_TEXTURE_INTENSITY_SIZE 0x8061
-#define GL_TEXTURE_PRIORITY 0x8066
-#define GL_TEXTURE_RESIDENT 0x8067
#define GL_AMBIENT 0x1200
#define GL_DIFFUSE 0x1201
#define GL_SPECULAR 0x1202
@@ -664,6 +594,91 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_OBJECT_PLANE 0x2501
#define GL_EYE_PLANE 0x2502
#define GL_CLAMP 0x2900
+#define GL_CLIP_PLANE0 0x3000
+#define GL_CLIP_PLANE1 0x3001
+#define GL_CLIP_PLANE2 0x3002
+#define GL_CLIP_PLANE3 0x3003
+#define GL_CLIP_PLANE4 0x3004
+#define GL_CLIP_PLANE5 0x3005
+#define GL_LIGHT0 0x4000
+#define GL_LIGHT1 0x4001
+#define GL_LIGHT2 0x4002
+#define GL_LIGHT3 0x4003
+#define GL_LIGHT4 0x4004
+#define GL_LIGHT5 0x4005
+#define GL_LIGHT6 0x4006
+#define GL_LIGHT7 0x4007
+#define GL_COLOR_LOGIC_OP 0x0BF2
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_POLYGON_OFFSET_POINT 0x2A01
+#define GL_POLYGON_OFFSET_LINE 0x2A02
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_1D 0x8068
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
+#define GL_TEXTURE_RED_SIZE 0x805C
+#define GL_TEXTURE_GREEN_SIZE 0x805D
+#define GL_TEXTURE_BLUE_SIZE 0x805E
+#define GL_TEXTURE_ALPHA_SIZE 0x805F
+#define GL_DOUBLE 0x140A
+#define GL_PROXY_TEXTURE_1D 0x8063
+#define GL_PROXY_TEXTURE_2D 0x8064
+#define GL_R3_G3_B2 0x2A10
+#define GL_RGB4 0x804F
+#define GL_RGB5 0x8050
+#define GL_RGB8 0x8051
+#define GL_RGB10 0x8052
+#define GL_RGB12 0x8053
+#define GL_RGB16 0x8054
+#define GL_RGBA2 0x8055
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGBA8 0x8058
+#define GL_RGB10_A2 0x8059
+#define GL_RGBA12 0x805A
+#define GL_RGBA16 0x805B
+#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
+#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
+#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
+#define GL_VERTEX_ARRAY_POINTER 0x808E
+#define GL_NORMAL_ARRAY_POINTER 0x808F
+#define GL_COLOR_ARRAY_POINTER 0x8090
+#define GL_INDEX_ARRAY_POINTER 0x8091
+#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
+#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093
+#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0
+#define GL_SELECTION_BUFFER_POINTER 0x0DF3
+#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1
+#define GL_INDEX_LOGIC_OP 0x0BF1
+#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B
+#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1
+#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2
+#define GL_SELECTION_BUFFER_SIZE 0x0DF4
+#define GL_VERTEX_ARRAY 0x8074
+#define GL_NORMAL_ARRAY 0x8075
+#define GL_COLOR_ARRAY 0x8076
+#define GL_INDEX_ARRAY 0x8077
+#define GL_TEXTURE_COORD_ARRAY 0x8078
+#define GL_EDGE_FLAG_ARRAY 0x8079
+#define GL_VERTEX_ARRAY_SIZE 0x807A
+#define GL_VERTEX_ARRAY_TYPE 0x807B
+#define GL_VERTEX_ARRAY_STRIDE 0x807C
+#define GL_NORMAL_ARRAY_TYPE 0x807E
+#define GL_NORMAL_ARRAY_STRIDE 0x807F
+#define GL_COLOR_ARRAY_SIZE 0x8081
+#define GL_COLOR_ARRAY_TYPE 0x8082
+#define GL_COLOR_ARRAY_STRIDE 0x8083
+#define GL_INDEX_ARRAY_TYPE 0x8085
+#define GL_INDEX_ARRAY_STRIDE 0x8086
+#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
+#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
+#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
+#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C
+#define GL_TEXTURE_LUMINANCE_SIZE 0x8060
+#define GL_TEXTURE_INTENSITY_SIZE 0x8061
+#define GL_TEXTURE_PRIORITY 0x8066
+#define GL_TEXTURE_RESIDENT 0x8067
#define GL_ALPHA4 0x803B
#define GL_ALPHA8 0x803C
#define GL_ALPHA12 0x803D
@@ -697,20 +712,6 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_T2F_N3F_V3F 0x2A2B
#define GL_T2F_C4F_N3F_V3F 0x2A2C
#define GL_T4F_C4F_N3F_V4F 0x2A2D
-#define GL_CLIP_PLANE0 0x3000
-#define GL_CLIP_PLANE1 0x3001
-#define GL_CLIP_PLANE2 0x3002
-#define GL_CLIP_PLANE3 0x3003
-#define GL_CLIP_PLANE4 0x3004
-#define GL_CLIP_PLANE5 0x3005
-#define GL_LIGHT0 0x4000
-#define GL_LIGHT1 0x4001
-#define GL_LIGHT2 0x4002
-#define GL_LIGHT3 0x4003
-#define GL_LIGHT4 0x4004
-#define GL_LIGHT5 0x4005
-#define GL_LIGHT6 0x4006
-#define GL_LIGHT7 0x4007
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034