summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/canvas_item.h4
-rw-r--r--scene/2d/navigation2d.cpp26
-rw-r--r--scene/2d/physics_body_2d.cpp2
-rw-r--r--scene/2d/tile_map.cpp30
-rw-r--r--scene/2d/tile_map.h7
-rw-r--r--scene/3d/arvr_nodes.cpp2
-rw-r--r--scene/3d/light.cpp6
-rw-r--r--scene/3d/light.h1
-rw-r--r--scene/3d/physics_body.cpp2
-rw-r--r--scene/animation/tween.cpp24
-rw-r--r--scene/gui/control.cpp2
11 files changed, 72 insertions, 34 deletions
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 3a99e917eb..5a0a9c6e6a 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -291,10 +291,10 @@ public:
RID get_canvas() const;
Ref<World2D> get_world_2d() const;
- void set_material(const Ref<Material> &p_material);
+ virtual void set_material(const Ref<Material> &p_material);
Ref<Material> get_material() const;
- void set_use_parent_material(bool p_use_parent_material);
+ virtual void set_use_parent_material(bool p_use_parent_material);
bool get_use_parent_material() const;
Ref<InputEvent> make_input_local(const Ref<InputEvent> &p_event) const;
diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp
index fa488b6b23..74d835dfb2 100644
--- a/scene/2d/navigation2d.cpp
+++ b/scene/2d/navigation2d.cpp
@@ -476,7 +476,6 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect
Polygon *left_poly = end_poly;
Polygon *right_poly = end_poly;
Polygon *p = end_poly;
- path.push_back(end_point);
while (p) {
@@ -534,7 +533,7 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect
left_poly = p;
portal_left = apex_point;
portal_right = apex_point;
- if (path[path.size() - 1].distance_to(apex_point) > CMP_EPSILON)
+ if (!path.size() || path[path.size() - 1].distance_to(apex_point) > CMP_EPSILON)
path.push_back(apex_point);
skip = true;
//print_line("addpoint left");
@@ -555,7 +554,7 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect
right_poly = p;
portal_right = apex_point;
portal_left = apex_point;
- if (path[path.size() - 1].distance_to(apex_point) > CMP_EPSILON)
+ if (!path.size() || path[path.size() - 1].distance_to(apex_point) > CMP_EPSILON)
path.push_back(apex_point);
//print_line("addpoint right");
//print_line("***CLIP RIGHT");
@@ -568,16 +567,10 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect
p = NULL;
}
- if (path[path.size() - 1].distance_to(begin_point) > CMP_EPSILON)
- path.push_back(begin_point);
-
- path.invert();
-
} else {
//midpoints
Polygon *p = end_poly;
- path.push_back(end_point);
while (true) {
int prev = p->prev_edge;
int prev_n = (p->prev_edge + 1) % p->edges.size();
@@ -587,11 +580,20 @@ Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vect
if (p == begin_poly)
break;
}
+ }
- if (path[path.size() - 1].distance_to(begin_point) > CMP_EPSILON)
- path.push_back(begin_point);
+ if (!path.size() || path[path.size() - 1].distance_squared_to(begin_point) > CMP_EPSILON) {
+ path.push_back(begin_point); // Add the begin point
+ } else {
+ path[path.size() - 1] = begin_point; // Replace first midpoint by the exact begin point
+ }
+
+ path.invert();
- path.invert();
+ if (path.size() <= 1 || path[path.size() - 1].distance_squared_to(end_point) > CMP_EPSILON) {
+ path.push_back(end_point); // Add the end point
+ } else {
+ path[path.size() - 1] = end_point; // Replace last midpoint by the exact end point
}
return path;
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 6ac946ea37..b1eb2ba267 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -883,7 +883,7 @@ void RigidBody2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_colliding_bodies"), &RigidBody2D::get_colliding_bodies);
- BIND_VMETHOD(MethodInfo("_integrate_forces", PropertyInfo(Variant::OBJECT, "state:Physics2DDirectBodyState")));
+ BIND_VMETHOD(MethodInfo("_integrate_forces", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "Physics2DDirectBodyState")));
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Rigid,Static,Character,Kinematic"), "set_mode", "get_mode");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "mass", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_mass", "get_mass");
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index d41db1dce5..b1cc8c226a 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -336,6 +336,7 @@ void TileMap::_update_dirty_quadrants() {
if (mat.is_valid())
vs->canvas_item_set_material(canvas_item, mat->get_rid());
vs->canvas_item_set_parent(canvas_item, get_canvas_item());
+ _update_item_material_state(canvas_item);
Transform2D xform;
xform.set_origin(q.pos);
vs->canvas_item_set_transform(canvas_item, xform);
@@ -780,6 +781,35 @@ void TileMap::_clear_quadrants() {
}
}
+void TileMap::set_material(const Ref<Material> &p_material) {
+
+ CanvasItem::set_material(p_material);
+ _update_all_items_material_state();
+}
+
+void TileMap::set_use_parent_material(bool p_use_parent_material) {
+
+ CanvasItem::set_use_parent_material(p_use_parent_material);
+ _update_all_items_material_state();
+}
+
+void TileMap::_update_all_items_material_state() {
+
+ for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) {
+
+ Quadrant &q = E->get();
+ for (List<RID>::Element *E = q.canvas_items.front(); E; E = E->next()) {
+
+ _update_item_material_state(E->get());
+ }
+ }
+}
+
+void TileMap::_update_item_material_state(const RID &p_canvas_item) {
+
+ VS::get_singleton()->canvas_item_set_use_parent_material(p_canvas_item, get_use_parent_material() || get_material().is_valid());
+}
+
void TileMap::clear() {
_clear_quadrants();
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index f401d51eeb..c9d14e09d1 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -183,6 +183,9 @@ private:
void _update_quadrant_transform();
void _recompute_rect_cache();
+ void _update_all_items_material_state();
+ _FORCE_INLINE_ void _update_item_material_state(const RID &p_canvas_item);
+
_FORCE_INLINE_ int _get_quadrant_size() const;
void _set_tile_data(const PoolVector<int> &p_data);
@@ -278,6 +281,10 @@ public:
virtual void set_light_mask(int p_light_mask);
+ virtual void set_material(const Ref<Material> &p_material);
+
+ virtual void set_use_parent_material(bool p_use_parent_material);
+
void clear();
TileMap();
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp
index 545be8bc5f..caf313190b 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/arvr_nodes.cpp
@@ -264,7 +264,7 @@ void ARVRAnchor::_notification(int p_what) {
// our basis is scaled to the size of the plane the anchor is tracking
// extract the size from our basis and reset the scale
size = transform.basis.get_scale() * world_scale;
- transform.basis.set_scale(Vector3(1.0, 1.0, 1.0));
+ transform.basis.orthonormalize();
// apply our reference frame and set our transform
set_transform(arvr_server->get_reference_frame() * transform);
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 5b48ee4af8..09b253b309 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -334,6 +334,7 @@ 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,1,0.01"), "set_param", "get_param", PARAM_SHADOW_BIAS_SPLIT_SCALE);
BIND_ENUM_CONSTANT(SHADOW_ORTHOGONAL);
BIND_ENUM_CONSTANT(SHADOW_PARALLEL_2_SPLITS);
@@ -343,9 +344,10 @@ void DirectionalLight::_bind_methods() {
DirectionalLight::DirectionalLight()
: Light(VisualServer::LIGHT_DIRECTIONAL) {
- set_param(PARAM_SHADOW_NORMAL_BIAS, 0.2);
- set_param(PARAM_SHADOW_BIAS, 1.0);
+ set_param(PARAM_SHADOW_NORMAL_BIAS, 0.8);
+ set_param(PARAM_SHADOW_BIAS, 0.1);
set_param(PARAM_SHADOW_MAX_DISTANCE, 200);
+ set_param(PARAM_SHADOW_BIAS_SPLIT_SCALE, 0.25);
set_shadow_mode(SHADOW_PARALLEL_4_SPLITS);
blend_splits = false;
diff --git a/scene/3d/light.h b/scene/3d/light.h
index 93dd4828da..5d589d33e5 100644
--- a/scene/3d/light.h
+++ b/scene/3d/light.h
@@ -58,6 +58,7 @@ 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 b149dcd2dc..a0a393e8ed 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -842,7 +842,7 @@ void RigidBody::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_colliding_bodies"), &RigidBody::get_colliding_bodies);
- BIND_VMETHOD(MethodInfo("_integrate_forces", PropertyInfo(Variant::OBJECT, "state:PhysicsDirectBodyState")));
+ BIND_VMETHOD(MethodInfo("_integrate_forces", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectBodyState")));
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Rigid,Static,Character,Kinematic"), "set_mode", "get_mode");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "mass", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_mass", "get_mass");
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 3cd953773f..fb61c43d5c 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -560,12 +560,16 @@ void Tween::_tween_process(float p_delta) {
switch (data.type) {
case INTER_PROPERTY:
- case INTER_METHOD:
- break;
+ case INTER_METHOD: {
+ Variant result = _run_equation(data);
+ emit_signal("tween_step", object, data.key, data.elapsed, result);
+ _apply_tween_value(data, result);
+ if (data.finish)
+ _apply_tween_value(data, data.final_val);
+ } break;
+
case INTER_CALLBACK:
if (data.finish) {
-
- Variant::CallError error;
if (data.call_deferred) {
switch (data.args) {
@@ -588,8 +592,8 @@ void Tween::_tween_process(float p_delta) {
object->call_deferred(data.key, data.arg[0], data.arg[1], data.arg[2], data.arg[3], data.arg[4]);
break;
}
-
} else {
+ Variant::CallError error;
Variant *arg[5] = {
&data.arg[0],
&data.arg[1],
@@ -599,19 +603,11 @@ void Tween::_tween_process(float p_delta) {
};
object->call(data.key, (const Variant **)arg, data.args, error);
}
- if (!repeat)
- call_deferred("_remove", object, data.key, true);
}
- continue;
+ break;
}
- Variant result = _run_equation(data);
- emit_signal("tween_step", object, data.key, data.elapsed, result);
-
- _apply_tween_value(data, result);
-
if (data.finish) {
- _apply_tween_value(data, data.final_val);
emit_signal("tween_completed", object, data.key);
// not repeat mode, remove completed action
if (!repeat)
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index e2da5e4981..961fccc804 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2703,7 +2703,7 @@ void Control::_bind_methods() {
ADD_SIGNAL(MethodInfo("minimum_size_changed"));
ADD_SIGNAL(MethodInfo("modal_closed"));
- BIND_VMETHOD(MethodInfo("has_point:bool", PropertyInfo(Variant::VECTOR2, "point")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "has_point", PropertyInfo(Variant::VECTOR2, "point")));
}
Control::Control() {