diff options
-rw-r--r-- | core/io/logger.cpp | 11 | ||||
-rw-r--r-- | core/math/transform_2d.cpp | 12 | ||||
-rw-r--r-- | core/math/transform_2d.h | 11 | ||||
-rw-r--r-- | core/variant.h | 9 | ||||
-rw-r--r-- | doc/classes/Generic6DOFJoint3D.xml | 12 | ||||
-rw-r--r-- | doc/classes/Tween.xml | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript.cpp | 11 | ||||
-rw-r--r-- | modules/gdscript/gdscript_functions.cpp | 3 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 2 | ||||
-rw-r--r-- | modules/mono/utils/string_utils.cpp | 10 | ||||
-rw-r--r-- | platform/linuxbsd/display_server_x11.cpp | 85 | ||||
-rw-r--r-- | platform/linuxbsd/display_server_x11.h | 4 | ||||
-rw-r--r-- | scene/2d/node_2d.cpp | 42 | ||||
-rw-r--r-- | scene/2d/node_2d.h | 5 | ||||
-rw-r--r-- | scene/2d/tile_map.cpp | 7 | ||||
-rw-r--r-- | scene/3d/physics_joint_3d.cpp | 6 | ||||
-rw-r--r-- | servers/register_server_types.cpp | 1 | ||||
-rw-r--r-- | servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp | 22 | ||||
-rw-r--r-- | thirdparty/README.md | 1 | ||||
-rw-r--r-- | thirdparty/misc/stb_vorbis.c | 2 |
20 files changed, 167 insertions, 91 deletions
diff --git a/core/io/logger.cpp b/core/io/logger.cpp index 48aebeda3d..ad0cc81023 100644 --- a/core/io/logger.cpp +++ b/core/io/logger.cpp @@ -34,17 +34,6 @@ #include "core/os/os.h" #include "core/print_string.h" -// va_copy was defined in the C99, but not in C++ standards before C++11. -// When you compile C++ without --std=c++<XX> option, compilers still define -// va_copy, otherwise you have to use the internal version (__va_copy). -#if !defined(va_copy) -#if defined(__GNUC__) -#define va_copy(d, s) __va_copy((d), (s)) -#else -#define va_copy(d, s) ((d) = (s)) -#endif -#endif - #if defined(MINGW_ENABLED) || defined(_MSC_VER) #define sprintf sprintf_s #endif diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp index 97a9216a5a..ed95baa233 100644 --- a/core/math/transform_2d.cpp +++ b/core/math/transform_2d.cpp @@ -70,6 +70,18 @@ void Transform2D::rotate(real_t p_phi) { *this = Transform2D(p_phi, Vector2()) * (*this); } +real_t Transform2D::get_skew() const { + + real_t det = basis_determinant(); + return Math::acos(elements[0].normalized().dot(SGN(det) * elements[1].normalized())) - Math_PI * 0.5; +} + +void Transform2D::set_skew(float p_angle) { + + real_t det = basis_determinant(); + elements[1] = SGN(det) * elements[0].rotated((Math_PI * 0.5 + p_angle)).normalized() * elements[1].length(); +} + real_t Transform2D::get_rotation() const { real_t det = basis_determinant(); Transform2D m = orthonormalized(); diff --git a/core/math/transform_2d.h b/core/math/transform_2d.h index fa43762aa4..459ceed7a9 100644 --- a/core/math/transform_2d.h +++ b/core/math/transform_2d.h @@ -70,7 +70,10 @@ struct Transform2D { void set_rotation(real_t p_rot); real_t get_rotation() const; + real_t get_skew() const; + void set_skew(float p_angle); _FORCE_INLINE_ void set_rotation_and_scale(real_t p_rot, const Size2 &p_scale); + _FORCE_INLINE_ void set_rotation_scale_and_skew(real_t p_rot, const Size2 &p_scale, float p_skew); void rotate(real_t p_phi); void scale(const Size2 &p_scale); @@ -184,6 +187,14 @@ void Transform2D::set_rotation_and_scale(real_t p_rot, const Size2 &p_scale) { elements[0][1] = Math::sin(p_rot) * p_scale.x; } +void Transform2D::set_rotation_scale_and_skew(real_t p_rot, const Size2 &p_scale, float p_skew) { + + elements[0][0] = Math::cos(p_rot) * p_scale.x; + elements[1][1] = Math::cos(p_rot + p_skew) * p_scale.y; + elements[1][0] = -Math::sin(p_rot + p_skew) * p_scale.y; + elements[0][1] = Math::sin(p_rot) * p_scale.x; +} + Rect2 Transform2D::xform_inv(const Rect2 &p_rect) const { Vector2 ends[4] = { diff --git a/core/variant.h b/core/variant.h index a832f7ccf8..1ae09ad82f 100644 --- a/core/variant.h +++ b/core/variant.h @@ -67,13 +67,6 @@ typedef Vector<Vector2> PackedVector2Array; typedef Vector<Vector3> PackedVector3Array; typedef Vector<Color> PackedColorArray; -// Temporary workaround until c++11 alignas() -#ifdef __GNUC__ -#define GCC_ALIGNED_8 __attribute__((aligned(8))) -#else -#define GCC_ALIGNED_8 -#endif - class Variant { public: // If this changes the table in variant_op must be updated @@ -211,7 +204,7 @@ private: PackedArrayRefBase *packed_array; void *_ptr; //generic pointer uint8_t _mem[sizeof(ObjData) > (sizeof(real_t) * 4) ? sizeof(ObjData) : (sizeof(real_t) * 4)]; - } _data GCC_ALIGNED_8; + } _data alignas(8); void reference(const Variant &p_variant); void clear(); diff --git a/doc/classes/Generic6DOFJoint3D.xml b/doc/classes/Generic6DOFJoint3D.xml index fae567dc58..ae86ab7365 100644 --- a/doc/classes/Generic6DOFJoint3D.xml +++ b/doc/classes/Generic6DOFJoint3D.xml @@ -373,6 +373,12 @@ <constant name="PARAM_LINEAR_MOTOR_FORCE_LIMIT" value="6" enum="Param"> The maximum force the linear motor will apply while trying to reach the velocity target. </constant> + <constant name="PARAM_LINEAR_SPRING_STIFFNESS" value="7" enum="Param"> + </constant> + <constant name="PARAM_LINEAR_SPRING_DAMPING" value="8" enum="Param"> + </constant> + <constant name="PARAM_LINEAR_SPRING_EQUILIBRIUM_POINT" value="9" enum="Param"> + </constant> <constant name="PARAM_ANGULAR_LOWER_LIMIT" value="10" enum="Param"> The minimum rotation in negative direction to break loose and rotate around the axes. </constant> @@ -400,6 +406,12 @@ <constant name="PARAM_ANGULAR_MOTOR_FORCE_LIMIT" value="18" enum="Param"> Maximum acceleration for the motor at the axes. </constant> + <constant name="PARAM_ANGULAR_SPRING_STIFFNESS" value="19" enum="Param"> + </constant> + <constant name="PARAM_ANGULAR_SPRING_DAMPING" value="20" enum="Param"> + </constant> + <constant name="PARAM_ANGULAR_SPRING_EQUILIBRIUM_POINT" value="21" enum="Param"> + </constant> <constant name="PARAM_MAX" value="22" enum="Param"> Represents the size of the [enum Param] enum. </constant> diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml index f9320ac55e..1938a3facb 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -16,7 +16,7 @@ [/codeblock] Many methods require a property name, such as [code]"position"[/code] above. You can find the correct property name by hovering over the property in the Inspector. You can also provide the components of a property directly by using [code]"property:component"[/code] (eg. [code]position:x[/code]), where it would only apply to that particular component. Many of the methods accept [code]trans_type[/code] and [code]ease_type[/code]. The first accepts an [enum TransitionType] constant, and refers to the way the timing of the animation is handled (see [url=https://easings.net/]easings.net[/url] for some examples). The second accepts an [enum EaseType] constant, and controls the where [code]trans_type[/code] is applied to the interpolation (in the beginning, the end, or both). If you don't know which transition and easing to pick, you can try different [enum TransitionType] constants with [constant EASE_IN_OUT], and use the one that looks best. - [b][url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/tween_cheatsheet.png]Tween easing and transition types cheatsheet[/url][/b] + [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/tween_cheatsheet.png]Tween easing and transition types cheatsheet[/url] </description> <tutorials> </tutorials> diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 0316581604..06ab9e226d 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -103,15 +103,14 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco instance->owner->set_script_instance(instance); /* STEP 2, INITIALIZE AND CONSTRUCT */ - { MutexLock lock(GDScriptLanguage::singleton->lock); - instances.insert(instance->owner); } - + if (p_argcount < 0) { + return instance; + } initializer->call(instance, p_args, p_argcount, r_error); - if (r_error.error != Callable::CallError::CALL_OK) { instance->script = Ref<GDScript>(); instance->owner->set_script_instance(nullptr); @@ -119,10 +118,8 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco MutexLock lock(GDScriptLanguage::singleton->lock); instances.erase(p_owner); } - - ERR_FAIL_COND_V(r_error.error != Callable::CallError::CALL_OK, nullptr); //error constructing + ERR_FAIL_V_MSG(nullptr, "Error constructing a GDScriptInstance."); } - //@TODO make thread safe return instance; } diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index 58161d6f53..0199af642f 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -1197,8 +1197,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ return; } } - - r_ret = gdscr->_new(nullptr, 0, r_error); + r_ret = gdscr->_new(nullptr, -1 /*skip initializer*/, r_error); GDScriptInstance *ins = static_cast<GDScriptInstance *>(static_cast<Object *>(r_ret)->get_script_instance()); Ref<GDScript> gd_ref = ins->get_script(); diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index a37fc579e7..c20d517ff6 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -4033,7 +4033,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { if (!_enter_indent_block(block)) { - _set_error("Indented block expected."); + _set_error(vformat("Indented block expected after declaration of \"%s\" function.", function->name)); return; } diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp index 907811355f..67b264d803 100644 --- a/modules/mono/utils/string_utils.cpp +++ b/modules/mono/utils/string_utils.cpp @@ -196,16 +196,6 @@ String str_format(const char *p_format, ...) { return res; } -// va_copy was defined in the C99, but not in C++ standards before C++11. -// When you compile C++ without --std=c++<XX> option, compilers still define -// va_copy, otherwise you have to use the internal version (__va_copy). -#if !defined(va_copy) -#if defined(__GNUC__) -#define va_copy(d, s) __va_copy((d), (s)) -#else -#define va_copy(d, s) ((d) = (s)) -#endif -#endif #if defined(MINGW_ENABLED) || defined(_MSC_VER) && _MSC_VER < 1900 #define gd_vsnprintf(m_buffer, m_count, m_format, m_args_copy) vsnprintf_s(m_buffer, m_count, _TRUNCATE, m_format, m_args_copy) diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index e38b0c13d0..b5052667a7 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -254,13 +254,16 @@ bool DisplayServerX11::_refresh_device_info() { bool absolute_mode = false; int resolution_x = 0; int resolution_y = 0; - double range_min_x = 0; - double range_min_y = 0; - double range_max_x = 0; - double range_max_y = 0; - int pressure_resolution = 0; - int tilt_resolution_x = 0; - int tilt_resolution_y = 0; + double abs_x_min = 0; + double abs_x_max = 0; + double abs_y_min = 0; + double abs_y_max = 0; + double pressure_min = 0; + double pressure_max = 0; + double tilt_x_min = 0; + double tilt_x_max = 0; + double tilt_y_min = 0; + double tilt_y_max = 0; for (int j = 0; j < dev->num_classes; j++) { #ifdef TOUCH_ENABLED if (dev->classes[j]->type == XITouchClass && ((XITouchClassInfo *)dev->classes[j])->mode == XIDirectTouch) { @@ -272,23 +275,23 @@ bool DisplayServerX11::_refresh_device_info() { if (class_info->number == VALUATOR_ABSX && class_info->mode == XIModeAbsolute) { resolution_x = class_info->resolution; - range_min_x = class_info->min; - range_max_x = class_info->max; + abs_x_min = class_info->min; + abs_y_max = class_info->max; absolute_mode = true; } else if (class_info->number == VALUATOR_ABSY && class_info->mode == XIModeAbsolute) { resolution_y = class_info->resolution; - range_min_y = class_info->min; - range_max_y = class_info->max; + abs_y_min = class_info->min; + abs_y_max = class_info->max; absolute_mode = true; } else if (class_info->number == VALUATOR_PRESSURE && class_info->mode == XIModeAbsolute) { - pressure_resolution = (class_info->max - class_info->min); - if (pressure_resolution == 0) pressure_resolution = 1; + pressure_min = class_info->min; + pressure_max = class_info->max; } else if (class_info->number == VALUATOR_TILTX && class_info->mode == XIModeAbsolute) { - tilt_resolution_x = (class_info->max - class_info->min); - if (tilt_resolution_x == 0) tilt_resolution_x = 1; + tilt_x_min = class_info->min; + tilt_x_max = class_info->max; } else if (class_info->number == VALUATOR_TILTY && class_info->mode == XIModeAbsolute) { - tilt_resolution_y = (class_info->max - class_info->min); - if (tilt_resolution_y == 0) tilt_resolution_y = 1; + tilt_x_min = class_info->min; + tilt_x_max = class_info->max; } } } @@ -299,18 +302,19 @@ bool DisplayServerX11::_refresh_device_info() { if (absolute_mode) { // If no resolution was reported, use the min/max ranges. if (resolution_x <= 0) { - resolution_x = (range_max_x - range_min_x) * abs_resolution_range_mult; + resolution_x = (abs_x_max - abs_x_min) * abs_resolution_range_mult; } if (resolution_y <= 0) { - resolution_y = (range_max_y - range_min_y) * abs_resolution_range_mult; + resolution_y = (abs_y_max - abs_y_min) * abs_resolution_range_mult; } - xi.absolute_devices[dev->deviceid] = Vector2(abs_resolution_mult / resolution_x, abs_resolution_mult / resolution_y); print_verbose("XInput: Absolute pointing device: " + String(dev->name)); } xi.pressure = 0; - xi.pen_devices[dev->deviceid] = Vector3(pressure_resolution, tilt_resolution_x, tilt_resolution_y); + xi.pen_pressure_range[dev->deviceid] = Vector2(pressure_min, pressure_max); + xi.pen_tilt_x_range[dev->deviceid] = Vector2(tilt_x_min, tilt_x_max); + xi.pen_tilt_y_range[dev->deviceid] = Vector2(tilt_y_min, tilt_y_max); } XIFreeDeviceInfo(info); @@ -2353,6 +2357,9 @@ void DisplayServerX11::process_events() { // Is the current mouse mode one where it needs to be grabbed. bool mouse_mode_grab = mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED; + xi.pressure = 0; + xi.tilt = Vector2(); + while (XPending(x11_display) > 0) { XEvent event; XNextEvent(x11_display, &event); @@ -2399,9 +2406,6 @@ void DisplayServerX11::process_events() { double rel_x = 0.0; double rel_y = 0.0; - double pressure = 0.0; - double tilt_x = 0.0; - double tilt_y = 0.0; if (XIMaskIsSet(raw_event->valuators.mask, VALUATOR_ABSX)) { rel_x = *values; @@ -2414,24 +2418,39 @@ void DisplayServerX11::process_events() { } if (XIMaskIsSet(raw_event->valuators.mask, VALUATOR_PRESSURE)) { - pressure = *values; + Map<int, Vector2>::Element *pen_pressure = xi.pen_pressure_range.find(device_id); + if (pen_pressure) { + Vector2 pen_pressure_range = pen_pressure->value(); + if (pen_pressure_range != Vector2()) + xi.pressure = (*values - pen_pressure_range[0]) / + (pen_pressure_range[1] - pen_pressure_range[0]); + } + values++; } if (XIMaskIsSet(raw_event->valuators.mask, VALUATOR_TILTX)) { - tilt_x = *values; + Map<int, Vector2>::Element *pen_tilt_x = xi.pen_tilt_x_range.find(device_id); + if (pen_tilt_x) { + Vector2 pen_tilt_x_range = pen_tilt_x->value(); + if (pen_tilt_x_range != Vector2()) { + xi.tilt.x = ((*values - pen_tilt_x_range[0]) / (pen_tilt_x_range[1] - pen_tilt_x_range[0])) * 2 - 1; + } + } + values++; } if (XIMaskIsSet(raw_event->valuators.mask, VALUATOR_TILTY)) { - tilt_y = *values; - } + Map<int, Vector2>::Element *pen_tilt_y = xi.pen_tilt_y_range.find(device_id); + if (pen_tilt_y) { + Vector2 pen_tilt_y_range = pen_tilt_y->value(); + if (pen_tilt_y_range != Vector2()) { + xi.tilt.y = ((*values - pen_tilt_y_range[0]) / (pen_tilt_y_range[1] - pen_tilt_y_range[0])) * 2 - 1; + } + } - Map<int, Vector3>::Element *pen_info = xi.pen_devices.find(device_id); - if (pen_info) { - Vector3 mult = pen_info->value(); - if (mult.x != 0.0) xi.pressure = pressure / mult.x; - if ((mult.y != 0.0) && (mult.z != 0.0)) xi.tilt = Vector2(tilt_x / mult.y, tilt_y / mult.z); + values++; } // https://bugs.freedesktop.org/show_bug.cgi?id=71609 diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h index 8f090d3fad..3dc06745a1 100644 --- a/platform/linuxbsd/display_server_x11.h +++ b/platform/linuxbsd/display_server_x11.h @@ -170,7 +170,9 @@ class DisplayServerX11 : public DisplayServer { int opcode; Vector<int> touch_devices; Map<int, Vector2> absolute_devices; - Map<int, Vector3> pen_devices; + Map<int, Vector2> pen_pressure_range; + Map<int, Vector2> pen_tilt_x_range; + Map<int, Vector2> pen_tilt_y_range; XIEventMask all_event_mask; Map<int, Vector2> state; double pressure; diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index ac8a77b6cb..1ea51be148 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -42,6 +42,7 @@ Dictionary Node2D::_edit_get_state() const { state["position"] = get_position(); state["rotation"] = get_rotation(); state["scale"] = get_scale(); + state["skew"] = get_skew(); return state; } @@ -51,11 +52,14 @@ void Node2D::_edit_set_state(const Dictionary &p_state) { pos = p_state["position"]; angle = p_state["rotation"]; _scale = p_state["scale"]; + skew = p_state["skew"]; _update_transform(); _change_notify("rotation"); _change_notify("rotation_degrees"); _change_notify("scale"); + _change_notify("skew"); + _change_notify("skew_degrees"); _change_notify("position"); } @@ -111,7 +115,7 @@ void Node2D::_edit_set_rect(const Rect2 &p_edit_rect) { Point2 new_pos = p_edit_rect.position + p_edit_rect.size * zero_offset; Transform2D postxf; - postxf.set_rotation_and_scale(angle, _scale); + postxf.set_rotation_scale_and_skew(angle, _scale, skew); new_pos = postxf.xform(new_pos); pos += new_pos; @@ -128,12 +132,13 @@ void Node2D::_update_xform_values() { pos = _mat.elements[2]; angle = _mat.get_rotation(); _scale = _mat.get_scale(); + skew = _mat.get_skew(); _xform_dirty = false; } void Node2D::_update_transform() { - _mat.set_rotation_and_scale(angle, _scale); + _mat.set_rotation_scale_and_skew(angle, _scale, skew); _mat.elements[2] = pos; RenderingServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), _mat); @@ -163,11 +168,26 @@ void Node2D::set_rotation(float p_radians) { _change_notify("rotation_degrees"); } +void Node2D::set_skew(float p_radians) { + + if (_xform_dirty) + ((Node2D *)this)->_update_xform_values(); + skew = p_radians; + _update_transform(); + _change_notify("skew"); + _change_notify("skew_degrees"); +} + void Node2D::set_rotation_degrees(float p_degrees) { set_rotation(Math::deg2rad(p_degrees)); } +void Node2D::set_skew_degrees(float p_degrees) { + + set_skew(Math::deg2rad(p_degrees)); +} + void Node2D::set_scale(const Size2 &p_scale) { if (_xform_dirty) @@ -196,11 +216,22 @@ float Node2D::get_rotation() const { return angle; } +float Node2D::get_skew() const { + if (_xform_dirty) + ((Node2D *)this)->_update_xform_values(); + + return skew; +} + float Node2D::get_rotation_degrees() const { return Math::rad2deg(get_rotation()); } +float Node2D::get_skew_degrees() const { + + return Math::rad2deg(get_skew()); +} Size2 Node2D::get_scale() const { if (_xform_dirty) ((Node2D *)this)->_update_xform_values(); @@ -398,11 +429,15 @@ void Node2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_position", "position"), &Node2D::set_position); ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Node2D::set_rotation); ClassDB::bind_method(D_METHOD("set_rotation_degrees", "degrees"), &Node2D::set_rotation_degrees); + ClassDB::bind_method(D_METHOD("set_skew", "radians"), &Node2D::set_skew); + ClassDB::bind_method(D_METHOD("set_skew_degrees", "degrees"), &Node2D::set_skew_degrees); ClassDB::bind_method(D_METHOD("set_scale", "scale"), &Node2D::set_scale); ClassDB::bind_method(D_METHOD("get_position"), &Node2D::get_position); ClassDB::bind_method(D_METHOD("get_rotation"), &Node2D::get_rotation); ClassDB::bind_method(D_METHOD("get_rotation_degrees"), &Node2D::get_rotation_degrees); + ClassDB::bind_method(D_METHOD("get_skew"), &Node2D::get_skew); + ClassDB::bind_method(D_METHOD("get_skew_degrees"), &Node2D::get_skew_degrees); ClassDB::bind_method(D_METHOD("get_scale"), &Node2D::get_scale); ClassDB::bind_method(D_METHOD("rotate", "radians"), &Node2D::rotate); @@ -443,6 +478,8 @@ void Node2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rotation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_rotation", "get_rotation"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rotation_degrees", PROPERTY_HINT_RANGE, "-360,360,0.1,or_lesser,or_greater", PROPERTY_USAGE_EDITOR), "set_rotation_degrees", "get_rotation_degrees"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "scale"), "set_scale", "get_scale"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "skew", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_skew", "get_skew"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "skew_degrees", PROPERTY_HINT_RANGE, "-89.9,89.9,0.1", PROPERTY_USAGE_EDITOR), "set_skew_degrees", "get_skew_degrees"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform", PROPERTY_HINT_NONE, "", 0), "set_transform", "get_transform"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_position", PROPERTY_HINT_NONE, "", 0), "set_global_position", "get_global_position"); @@ -460,6 +497,7 @@ Node2D::Node2D() { angle = 0; _scale = Vector2(1, 1); + skew = 0; _xform_dirty = false; z_index = 0; z_relative = true; diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index abed05ed0c..0afec36254 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -40,6 +40,7 @@ class Node2D : public CanvasItem { Point2 pos; float angle; Size2 _scale; + float skew; int z_index; bool z_relative; @@ -75,6 +76,8 @@ public: void set_position(const Point2 &p_pos); void set_rotation(float p_radians); void set_rotation_degrees(float p_degrees); + void set_skew(float p_radians); + void set_skew_degrees(float p_radians); void set_scale(const Size2 &p_scale); void rotate(float p_radians); @@ -86,7 +89,9 @@ public: Point2 get_position() const; float get_rotation() const; + float get_skew() const; float get_rotation_degrees() const; + float get_skew_degrees() const; Size2 get_scale() const; Point2 get_global_position() const; diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 9628c01718..86e61fe878 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -940,13 +940,10 @@ void TileMap::update_bitmask_area(const Vector2 &p_pos) { void TileMap::update_bitmask_region(const Vector2 &p_start, const Vector2 &p_end) { if ((p_end.x < p_start.x || p_end.y < p_start.y) || (p_end.x == p_start.x && p_end.y == p_start.y)) { - int i; Array a = get_used_cells(); - for (i = 0; i < a.size(); i++) { - // update_bitmask_area() in order to update cells adjacent to the - // current cell, since ordering in array may not be reliable + for (int i = 0; i < a.size(); i++) { Vector2 vector = (Vector2)a[i]; - update_bitmask_area(Vector2(vector.x, vector.y)); + update_cell_bitmask(vector.x, vector.y); } return; } diff --git a/scene/3d/physics_joint_3d.cpp b/scene/3d/physics_joint_3d.cpp index 591c17a91e..140d887d9a 100644 --- a/scene/3d/physics_joint_3d.cpp +++ b/scene/3d/physics_joint_3d.cpp @@ -807,6 +807,9 @@ void Generic6DOFJoint3D::_bind_methods() { BIND_ENUM_CONSTANT(PARAM_LINEAR_DAMPING); BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTOR_TARGET_VELOCITY); BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTOR_FORCE_LIMIT); + BIND_ENUM_CONSTANT(PARAM_LINEAR_SPRING_STIFFNESS); + BIND_ENUM_CONSTANT(PARAM_LINEAR_SPRING_DAMPING); + BIND_ENUM_CONSTANT(PARAM_LINEAR_SPRING_EQUILIBRIUM_POINT); BIND_ENUM_CONSTANT(PARAM_ANGULAR_LOWER_LIMIT); BIND_ENUM_CONSTANT(PARAM_ANGULAR_UPPER_LIMIT); BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS); @@ -816,6 +819,9 @@ void Generic6DOFJoint3D::_bind_methods() { BIND_ENUM_CONSTANT(PARAM_ANGULAR_ERP); BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTOR_TARGET_VELOCITY); BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTOR_FORCE_LIMIT); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_SPRING_STIFFNESS); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_SPRING_DAMPING); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_SPRING_EQUILIBRIUM_POINT); BIND_ENUM_CONSTANT(PARAM_MAX); BIND_ENUM_CONSTANT(FLAG_ENABLE_LINEAR_LIMIT); diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index 60217002fb..eb92cf55e3 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -218,6 +218,7 @@ void register_server_singletons() { Engine::get_singleton()->add_singleton(Engine::Singleton("DisplayServer", DisplayServer::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("RenderingServer", RenderingServer::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("RenderingDevice", RenderingDevice::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("AudioServer", AudioServer::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer2D", PhysicsServer2D::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer3D", PhysicsServer3D::get_singleton())); diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp index b3cf40f166..6986f82065 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp @@ -1720,6 +1720,16 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig light_data.shadow_enabled = p_using_shadows && storage->light_has_shadow(base); + float angular_diameter = storage->light_get_param(base, RS::LIGHT_PARAM_SIZE); + if (angular_diameter > 0.0) { + // I know tan(0) is 0, but let's not risk it with numerical precision. + // technically this will keep expanding until reaching the sun, but all we care + // is expand until we reach the radius of the near plane (there can't be more occluders than that) + angular_diameter = Math::tan(Math::deg2rad(angular_diameter)); + } else { + angular_diameter = 0.0; + } + if (light_data.shadow_enabled) { RS::LightDirectionalShadowMode smode = storage->light_directional_get_shadow_mode(base); @@ -1775,15 +1785,9 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig light_data.fade_to = -light_data.shadow_split_offsets[3]; light_data.soft_shadow_scale = storage->light_get_param(base, RS::LIGHT_PARAM_SHADOW_BLUR); + light_data.softshadow_angle = angular_diameter; - float softshadow_angle = storage->light_get_param(base, RS::LIGHT_PARAM_SIZE); - if (softshadow_angle > 0.0) { - // I know tan(0) is 0, but let's not risk it with numerical precision. - // technically this will keep expanding until reaching the sun, but all we care - // is expand until we reach the radius of the near plane (there can't be more occluders than that) - light_data.softshadow_angle = Math::tan(Math::deg2rad(softshadow_angle)); - } else { - light_data.softshadow_angle = 0; + if (angular_diameter <= 0.0) { light_data.soft_shadow_scale *= directional_shadow_quality_radius_get(); // Only use quality radius for PCF } } @@ -1806,7 +1810,7 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig sky_light_data.color[2] = light_data.color[2]; sky_light_data.enabled = true; - sky_light_data.size = light_data.softshadow_angle; + sky_light_data.size = angular_diameter; sky_scene_state.directional_light_count++; } diff --git a/thirdparty/README.md b/thirdparty/README.md index 5821ca1424..1a3588e0e0 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -422,6 +422,7 @@ Collection of single-file libraries used in Godot components. * Upstream: https://github.com/nothings/stb * Version: 1.19 * License: Public Domain (Unlicense) or MIT + * Modifications: `f->temp_offset += (sz+3)&~3;` changed to `f->temp_offset += (sz+7)&~7;` (needed until fixed upstream) ## nanosvg diff --git a/thirdparty/misc/stb_vorbis.c b/thirdparty/misc/stb_vorbis.c index b28944a4d9..b0d79b1724 100644 --- a/thirdparty/misc/stb_vorbis.c +++ b/thirdparty/misc/stb_vorbis.c @@ -961,7 +961,7 @@ static void *setup_temp_malloc(vorb *f, int sz) static void setup_temp_free(vorb *f, void *p, int sz) { if (f->alloc.alloc_buffer) { - f->temp_offset += (sz+3)&~3; + f->temp_offset += (sz+7)&~7; return; } free(p); |