summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/variant_call.cpp2
-rw-r--r--core/variant_parser.cpp2
-rw-r--r--doc/classes/@GDScript.xml13
-rw-r--r--doc/classes/UndoRedo.xml22
-rw-r--r--doc/classes/int.xml16
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp22
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h3
-rw-r--r--editor/editor_properties.cpp14
-rw-r--r--modules/bullet/space_bullet.cpp67
-rw-r--r--scene/gui/texture_button.cpp6
-rw-r--r--servers/physics_2d/shape_2d_sw.cpp7
11 files changed, 100 insertions, 74 deletions
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 32461f6584..25a0f3957c 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -480,7 +480,7 @@ struct _VariantCall {
VCALL_LOCALMEM0(Dictionary, clear);
VCALL_LOCALMEM1R(Dictionary, has);
VCALL_LOCALMEM1R(Dictionary, has_all);
- VCALL_LOCALMEM1(Dictionary, erase);
+ VCALL_LOCALMEM1R(Dictionary, erase);
VCALL_LOCALMEM0R(Dictionary, hash);
VCALL_LOCALMEM0R(Dictionary, keys);
VCALL_LOCALMEM0R(Dictionary, values);
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index 716e5499e3..0056fc75b6 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -1597,7 +1597,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
} break;
case Variant::INT: {
- p_store_string_func(p_store_string_ud, itos(p_variant.operator int()));
+ p_store_string_func(p_store_string_ud, itos(p_variant.operator int64_t()));
} break;
case Variant::REAL: {
diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml
index a7b58352cc..7b4b3e43ba 100644
--- a/doc/classes/@GDScript.xml
+++ b/doc/classes/@GDScript.xml
@@ -811,7 +811,7 @@
<description>
Random range, any floating point value between [code]from[/code] and [code]to[/code].
[codeblock]
- prints(rand_range(0, 1), rand_range(0, 1)) # prints 0.135591 0.405263
+ prints(rand_range(0, 1), rand_range(0, 1)) # prints e.g. 0.135591 0.405263
[/codeblock]
</description>
</method>
@@ -830,7 +830,7 @@
<description>
Returns a random floating point value on the interval [code][0, 1][/code].
[codeblock]
- randf() # returns 0.375671
+ randf() # returns e.g. 0.375671
[/codeblock]
</description>
</method>
@@ -838,11 +838,12 @@
<return type="int">
</return>
<description>
- Returns a random 32 bit integer. Use remainder to obtain a random value in the interval [code][0, N][/code] (where N is smaller than 2^32 -1).
+ Returns a random unsigned 32 bit integer. Use remainder to obtain a random value in the interval [code][0, N][/code] (where N is smaller than 2^32 -1).
[codeblock]
- randi() % 20 # returns random number between 0 and 19
- randi() % 100 # returns random number between 0 and 99
- randi() % 100 + 1 # returns random number between 1 and 100
+ randi() # returns random integer between 0 and 2^32 - 1
+ randi() % 20 # returns random integer between 0 and 19
+ randi() % 100 # returns random integer between 0 and 99
+ randi() % 100 + 1 # returns random integer between 1 and 100
[/codeblock]
</description>
</method>
diff --git a/doc/classes/UndoRedo.xml b/doc/classes/UndoRedo.xml
index 93806ac326..8d98bcfdb0 100644
--- a/doc/classes/UndoRedo.xml
+++ b/doc/classes/UndoRedo.xml
@@ -8,22 +8,22 @@
Common behavior is to create an action, then add do/undo calls to functions or property changes, then committing the action.
Here's an example on how to add an action to Godot editor's own 'undoredo':
[codeblock]
- var undoredo = get_undo_redo() # method of EditorPlugin
+ var undo_redo = get_undo_redo() # Method of EditorPlugin.
func do_something():
- pass # put your code here
+ pass # Put your code here.
func undo_something():
- pass # put here the code that reverts what's done by "do_something()"
+ pass # Put here the code that reverts what's done by "do_something()".
func _on_MyButton_pressed():
var node = get_node("MyNode2D")
- undoredo.create_action("Move the node")
- undoredo.add_do_method(self, "do_something")
- undoredo.add_undo_method(self, "undo_something")
- undoredo.add_do_property(node, "position", Vector2(100,100))
- undoredo.add_undo_property(node, "position", node.position)
- undoredo.commit_action()
+ undo_redo.create_action("Move the node")
+ undo_redo.add_do_method(self, "do_something")
+ undo_redo.add_undo_method(self, "undo_something")
+ undo_redo.add_do_property(node, "position", Vector2(100,100))
+ undo_redo.add_undo_property(node, "position", node.position)
+ undo_redo.commit_action()
[/codeblock]
[method create_action], [method add_do_method], [method add_undo_method], [method add_do_property], [method add_undo_property], and [method commit_action] should be called one after the other, like in the example. Not doing so could lead to crashes.
If you don't need to register a method you can leave [method add_do_method] and [method add_undo_method] out, and so it goes for properties. You can register more than one method/property.
@@ -125,6 +125,7 @@
</argument>
<description>
Create a new action. After this is called, do all your calls to [method add_do_method], [method add_undo_method], [method add_do_property], and [method add_undo_property], then commit the action with [method commit_action].
+ The way actions are merged is dictated by the [code]merge_mode[/code] argument. See [enum MergeMode] for details.
</description>
</method>
<method name="get_current_action_name" qualifiers="const">
@@ -159,10 +160,13 @@
</methods>
<constants>
<constant name="MERGE_DISABLE" value="0" enum="MergeMode">
+ Makes [code]do[/code]/[code]undo[/code] operations stay in separate actions.
</constant>
<constant name="MERGE_ENDS" value="1" enum="MergeMode">
+ Makes so that the action's [code]do[/code] operation is from the first action created and the [code]undo[/code] operation is from the last subsequent action with the same name.
</constant>
<constant name="MERGE_ALL" value="2" enum="MergeMode">
+ Makes subsequent actions with the same name be merged into one.
</constant>
</constants>
</class>
diff --git a/doc/classes/int.xml b/doc/classes/int.xml
index 4855fa2848..7175b9fd88 100644
--- a/doc/classes/int.xml
+++ b/doc/classes/int.xml
@@ -4,7 +4,21 @@
Integer built-in type.
</brief_description>
<description>
- Integer built-in type.
+ Signed 64-bit integer type.
+ It can take values in the interval [code][-2^63, 2^63 - 1][/code], i.e. [code][-9223372036854775808, 9223372036854775807][/code]. Exceeding those bounds will wrap around.
+ [code]int[/code] is a [Variant] type, and will thus be used when assigning an integer value to a [Variant]. It can also be enforced with the [code]: int[/code] type hint.
+ [codeblock]
+ var my_variant = 0 # int, value 0
+ my_variant += 4.2 # float, value 4.2
+ var my_int: int = 1 # int, value 1
+ my_int = 4.2 # int, value 4, the right value is implicitly cast to int
+ my_int = int("6.7") # int, value 6, the String is explicitly cast with [method int]
+
+ var max_int = 9223372036854775807
+ print(max_int) # 9223372036854775807, OK
+ max_int += 1
+ print(max_int) # -9223372036854775808, we overflowed and wrapped around
+ [/codeblock]
</description>
<tutorials>
</tutorials>
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index c66f2ed6ec..dee01db4a5 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -3286,6 +3286,16 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_
glDisable(GL_CULL_FACE);
glDisable(GL_BLEND);
+ if (!state.used_depth_prepass_and_resolved) {
+ //resolve depth buffer
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo);
+ glReadBuffer(GL_COLOR_ATTACHMENT0);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->fbo);
+ glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+ }
+
if (env->ssao_enabled || env->ssr_enabled) {
//copy normal and roughness to effect buffer
@@ -4138,6 +4148,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glDepthFunc(GL_LEQUAL);
state.used_contact_shadows = false;
+ state.used_depth_prepass_and_resolved = false;
for (int i = 0; i < p_light_cull_count; i++) {
@@ -4185,13 +4196,14 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
//bind depth for read
glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 8);
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->depth);
+ state.used_depth_prepass_and_resolved = true;
}
fb_cleared = true;
render_pass++;
- state.using_contact_shadows = true;
+ state.used_depth_prepass = true;
} else {
- state.using_contact_shadows = false;
+ state.used_depth_prepass = false;
}
_setup_lights(p_light_cull_result, p_light_cull_count, p_cam_transform.affine_inverse(), p_cam_projection, p_shadow_atlas);
@@ -4288,7 +4300,8 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
}
if (!fb_cleared) {
- glClearBufferfi(GL_DEPTH, 0, 1.0, 0);
+ glClearDepth(1.0f);
+ glClear(GL_DEPTH_BUFFER_BIT);
}
Color clear_color(0, 0, 0, 0);
@@ -4438,6 +4451,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
//state.scene_shader.set_conditional( SceneShaderGLES3::USE_FOG,false);
if (use_mrt) {
+
_render_mrts(env, p_cam_projection);
} else {
//FIXME: check that this is possible to use
@@ -4562,7 +4576,7 @@ void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_
float bias = 0;
float normal_bias = 0;
- state.using_contact_shadows = false;
+ state.used_depth_prepass = false;
CameraMatrix light_projection;
Transform light_transform;
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index fbafc59b48..3ac5ade721 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -205,7 +205,8 @@ public:
bool used_sss;
bool used_screen_texture;
bool used_depth_texture;
- bool using_contact_shadows;
+ bool used_depth_prepass;
+ bool used_depth_prepass_and_resolved;
VS::ViewportDebugDraw debug_draw;
} state;
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 98950023ce..08e4260deb 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -483,16 +483,16 @@ EditorPropertyCheck::EditorPropertyCheck() {
void EditorPropertyEnum::_option_selected(int p_which) {
- int val = options->get_item_metadata(p_which);
+ int64_t val = options->get_item_metadata(p_which);
emit_changed(get_edited_property(), val);
}
void EditorPropertyEnum::update_property() {
- int which = get_edited_object()->get(get_edited_property());
+ int64_t which = get_edited_object()->get(get_edited_property());
for (int i = 0; i < options->get_item_count(); i++) {
- if (which == (int)options->get_item_metadata(i)) {
+ if (which == (int64_t)options->get_item_metadata(i)) {
options->select(i);
return;
}
@@ -501,11 +501,11 @@ void EditorPropertyEnum::update_property() {
void EditorPropertyEnum::setup(const Vector<String> &p_options) {
- int current_val = 0;
+ int64_t current_val = 0;
for (int i = 0; i < p_options.size(); i++) {
Vector<String> text_split = p_options[i].split(":");
if (text_split.size() != 1)
- current_val = text_split[1].to_int();
+ current_val = text_split[1].to_int64();
options->add_item(text_split[0]);
options->set_item_metadata(i, current_val);
current_val += 1;
@@ -801,11 +801,11 @@ EditorPropertyLayers::EditorPropertyLayers() {
void EditorPropertyInteger::_value_changed(double val) {
if (setting)
return;
- emit_changed(get_edited_property(), int(val));
+ emit_changed(get_edited_property(), (int64_t)val);
}
void EditorPropertyInteger::update_property() {
- int val = get_edited_object()->get(get_edited_property());
+ int64_t val = get_edited_object()->get(get_edited_property());
setting = true;
spin->set_value(val);
setting = false;
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index 8fb8eba057..74b0d10699 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -650,7 +650,6 @@ void SpaceBullet::check_ghost_overlaps() {
/// Algorithm support variables
btCollisionShape *other_body_shape;
btConvexShape *area_shape;
- btGjkPairDetector::ClosestPointInput gjk_input;
AreaBullet *area;
int x(-1), i(-1), y(-1), z(-1), indexOverlap(-1);
@@ -704,10 +703,6 @@ void SpaceBullet::check_ghost_overlaps() {
btTransform area_shape_treansform(area->get_bt_shape_transform(y));
area_shape_treansform.getOrigin() *= area_scale;
- gjk_input.m_transformA =
- area->get_transform__bullet() *
- area_shape_treansform;
-
area_shape = static_cast<btConvexShape *>(area->get_bt_shape(y));
// For each other object shape
@@ -721,45 +716,35 @@ void SpaceBullet::check_ghost_overlaps() {
btTransform other_shape_transform(otherObject->get_bt_shape_transform(z));
other_shape_transform.getOrigin() *= other_body_scale;
- gjk_input.m_transformB =
- otherObject->get_transform__bullet() *
- other_shape_transform;
-
- if (other_body_shape->isConvex()) {
-
- btPointCollector result;
- btGjkPairDetector gjk_pair_detector(
- area_shape,
- static_cast<btConvexShape *>(other_body_shape),
- gjk_simplex_solver,
- gjk_epa_pen_solver);
- gjk_pair_detector.getClosestPoints(gjk_input, result, 0);
-
- if (0 >= result.m_distance) {
- hasOverlap = true;
- goto collision_found;
- }
-
- } else {
-
- btCollisionObjectWrapper obA(NULL, area_shape, area->get_bt_ghost(), gjk_input.m_transformA, -1, y);
- btCollisionObjectWrapper obB(NULL, other_body_shape, otherObject->get_bt_collision_object(), gjk_input.m_transformB, -1, z);
-
- btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS);
-
- if (!algorithm)
- continue;
+ btCollisionObjectWrapper obA(
+ NULL,
+ area_shape,
+ area->get_bt_ghost(),
+ area->get_transform__bullet() * area_shape_treansform,
+ -1,
+ y);
+ btCollisionObjectWrapper obB(
+ NULL,
+ other_body_shape,
+ otherObject->get_bt_collision_object(),
+ otherObject->get_transform__bullet() * other_shape_transform,
+ -1,
+ z);
+
+ btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS);
+
+ if (!algorithm)
+ continue;
- GodotDeepPenetrationContactResultCallback contactPointResult(&obA, &obB);
- algorithm->processCollision(&obA, &obB, dynamicsWorld->getDispatchInfo(), &contactPointResult);
+ GodotDeepPenetrationContactResultCallback contactPointResult(&obA, &obB);
+ algorithm->processCollision(&obA, &obB, dynamicsWorld->getDispatchInfo(), &contactPointResult);
- algorithm->~btCollisionAlgorithm();
- dispatcher->freeCollisionAlgorithm(algorithm);
+ algorithm->~btCollisionAlgorithm();
+ dispatcher->freeCollisionAlgorithm(algorithm);
- if (contactPointResult.hasHit()) {
- hasOverlap = true;
- goto collision_found;
- }
+ if (contactPointResult.hasHit()) {
+ hasOverlap = true;
+ goto collision_found;
}
} // ~For each other object shape
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp
index c165c5a545..19bef9fdf5 100644
--- a/scene/gui/texture_button.cpp
+++ b/scene/gui/texture_button.cpp
@@ -64,7 +64,9 @@ bool TextureButton::has_point(const Point2 &p_point) const {
Rect2 rect = Rect2();
Size2 mask_size = click_mask->get_size();
- if (_tile) {
+ if (_position_rect.no_area()) {
+ rect.size = mask_size;
+ } else if (_tile) {
// if the stretch mode is tile we offset the point to keep it inside the mask size
rect.size = mask_size;
if (_position_rect.has_point(point)) {
@@ -216,6 +218,8 @@ void TextureButton::_notification(int p_what) {
draw_texture_rect(texdraw, _position_rect, _tile);
else
draw_texture_rect_region(texdraw, _position_rect, _texture_region);
+ } else {
+ _position_rect = Rect2();
}
if (has_focus() && focused.is_valid()) {
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp
index aaa37615d5..56b87f620c 100644
--- a/servers/physics_2d/shape_2d_sw.cpp
+++ b/servers/physics_2d/shape_2d_sw.cpp
@@ -369,8 +369,11 @@ void RectangleShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_suppor
}
bool RectangleShape2DSW::contains_point(const Vector2 &p_point) const {
-
- return Math::abs(p_point.x) < half_extents.x && Math::abs(p_point.y) < half_extents.y;
+ float x = p_point.x;
+ float y = p_point.y;
+ float edge_x = half_extents.x;
+ float edge_y = half_extents.y;
+ return (x >= -edge_x) && (x < edge_x) && (y >= -edge_y) && (y < edge_y);
}
bool RectangleShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const {