diff --git a/DONORS.md b/DONORS.md new file mode 100644 index 00000000000..09049ede481 --- /dev/null +++ b/DONORS.md @@ -0,0 +1,141 @@ +# Donors to the Godot Engine project + +Godot Engine is a non-profit project developed by a community of voluntary +contributors, as well as occasional paid contributors thanks to the financial +support of generous donors. + +The ways to donate to the project, as well as details on how the funds are +used, are described on [Godot's website](https://godotengine.org/donate). + +The following is a list of the current monthly donors, to be have their +generous deed immortalized in the next stable release of Godot Engine. + +## Platinum sponsors + +None so far, but your company could be the first! :) + +## Gold sponsors + + Gamblify + +## Mini sponsors + + Arron Washington + Chrisartguy + Christian Uldall Pedersen + Hein-Pieter van Braam + Matthieu Huvé + Neal Gompa (Conan Kudo) + Olimpiu Metiu + Ruslan Mustakov + +## Gold donors + + Alexander Otto + Jake Bo + Javier + Nathan Warden + Ranoller + Rémi Verschelde + Stephan Lanfermann + + Andreas Schüle + Bernhard Liebl + Jordan M Lucas + + BanjoNode2D + Chris Serino + Conrad Curry + Craig Smith + David Churchill + Dean Harmon + Guilherme Felipe de C. G. da Silva + Henrique Alves + Laurence Bannister + Leo + Przemysław Gołąb (n-pigeon) + Robert Willes + Robin Arys + summerblind + Testus Maximus + Thomas Bjarnelöf + + Amanda Haldy + Andreas Haas + Bryanna M + Cody Parker + D + Ezra Theunissen + flesk + François Cantin + Hendrik Mans + Jeppe Zapp + Johannes Wuensch + Justin Arnold + Justo Delgado Baudí + Leandro Voltolino + Myles + Robert Podgorski + Scott Beacon + x1212 + +## Silver donors + + Alex Barsukov + Avencherus + Bastian Böhm + Ben Vercammen + Bryan Stevenson + Collin Shooltz + Fabian Becker + fengjiongmax + Geequlim + Gerrit Großkopf + Guldoman + hatniX + HeartBeast + Heribert Hirth + Hunter Jones + imekon + Jacob McKenney + Jonathon + Josh 'Cheeseness' Bush + Julian Murgia + Juraj Móza + Kevin Boyer + Klavdij Voncina + Lisandro Lorea + magodev + Martin Novák + Matthew Fitzpatrick + Matthew Valancy + Matthias Hölzl + Max R.R. Collada + Michael Gringauz + Mikael Olsson + Moritz Laass + nee + nvgrod + Pablo Seibelt + Pan Ip + Paul Mason + Paweł Kowal + Pietro Vertechi + rayos + Richman Stewart + Roger Smith + Sam Van Campenhout + Sam Vila + Sasori Olkof + Sootstone + Tavo Tell + Tom Larrow + Trent McPheron + Troy Bonneau + UltyX + Xananax & karroffel + +## Bronze donors + +There are even more donors that support the project with a small monthly donation. +Every bit counts and we thank every one of them for their amazing support! diff --git a/core/array.cpp b/core/array.cpp index c35bf5bf0ca..2e3fbf858da 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -210,6 +210,17 @@ const Variant &Array::get(int p_idx) const { return operator[](p_idx); } +Array Array::duplicate() const { + + Array new_arr; + int element_count = size(); + new_arr.resize(element_count); + for (int i = 0; i < element_count; i++) { + new_arr[i] = get(i); + } + + return new_arr; +} struct _ArrayVariantSort { _FORCE_INLINE_ bool operator()(const Variant &p_l, const Variant &p_r) const { diff --git a/core/array.h b/core/array.h index 777116ab56c..8a647dd13bc 100644 --- a/core/array.h +++ b/core/array.h @@ -84,6 +84,8 @@ public: Variant pop_back(); Variant pop_front(); + Array duplicate() const; + Array(const Array &p_from); Array(); ~Array(); diff --git a/core/class_db.cpp b/core/class_db.cpp index 872e466e723..f5ddd9c7616 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -536,11 +536,9 @@ void ClassDB::get_method_list(StringName p_class, List *p_methods, b minfo.return_val = method->get_return_info(); minfo.flags = method->get_hint_flags(); - int defval_count = method->get_default_argument_count(); - minfo.default_arguments.resize(defval_count); - - for (int i = 0; i < defval_count; i++) { - minfo.default_arguments[i] = method->get_default_argument(defval_count - i - 1); + for (int i = 0; i < method->get_argument_count(); i++) { + if (method->has_default_argument(i)) + minfo.default_arguments.push_back(method->get_default_argument(i)); } p_methods->push_back(minfo); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index c5909981eab..084d8ffcab4 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1117,6 +1117,9 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons memdelete(f); } ERR_FAIL_COND_V(!fw, ERR_CANT_CREATE); + + uint8_t magic[4] = { 'R', 'S', 'R', 'C' }; + fw->store_buffer(magic, 4); } bool big_endian = f->get_32(); diff --git a/core/list.h b/core/list.h index a67287a9abd..da201e98681 100644 --- a/core/list.h +++ b/core/list.h @@ -291,6 +291,54 @@ public: erase(_data->first); } + Element *insert_after(Element *p_element, const T &p_value) { + CRASH_COND(p_element && (!_data || p_element->data != _data)); + + if (!p_element) { + return push_back(p_value); + } + + Element *n = memnew_allocator(Element, A); + n->value = (T &)p_value; + n->prev_ptr = p_element; + n->next_ptr = p_element->next_ptr; + n->data = _data; + + if (!p_element->next_ptr) { + _data->last = n; + } + + p_element->next_ptr = n; + + _data->size_cache++; + + return n; + } + + Element *insert_before(Element *p_element, const T &p_value) { + CRASH_COND(p_element && (!_data || p_element->data != _data)); + + if (!p_element) { + return push_back(p_value); + } + + Element *n = memnew_allocator(Element, A); + n->value = (T &)p_value; + n->prev_ptr = p_element->prev_ptr; + n->next_ptr = p_element; + n->data = _data; + + if (!p_element->prev_ptr) { + _data->first = n; + } + + p_element->prev_ptr = n; + + _data->size_cache++; + + return n; + } + /** * find an element in the list, */ diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 0512cdd7980..572a6c52398 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -265,76 +265,28 @@ void CameraMatrix::get_viewport_size(real_t &r_width, real_t &r_height) const { bool CameraMatrix::get_endpoints(const Transform &p_transform, Vector3 *p_8points) const { - const real_t *matrix = (const real_t *)this->matrix; + Vector planes = get_projection_planes(Transform()); + const Planes intersections[8][3]={ + {PLANE_FAR,PLANE_LEFT,PLANE_TOP}, + {PLANE_FAR,PLANE_LEFT,PLANE_BOTTOM}, + {PLANE_FAR,PLANE_RIGHT,PLANE_TOP}, + {PLANE_FAR,PLANE_RIGHT,PLANE_BOTTOM}, + {PLANE_NEAR,PLANE_LEFT,PLANE_TOP}, + {PLANE_NEAR,PLANE_LEFT,PLANE_BOTTOM}, + {PLANE_NEAR,PLANE_RIGHT,PLANE_TOP}, + {PLANE_NEAR,PLANE_RIGHT,PLANE_BOTTOM}, + }; - ///////--- Near Plane ---/////// - Plane near_plane = Plane(matrix[3] + matrix[2], - matrix[7] + matrix[6], - matrix[11] + matrix[10], - -matrix[15] - matrix[14]); - near_plane.normalize(); + for(int i=0;i<8;i++) { - ///////--- Far Plane ---/////// - Plane far_plane = Plane(matrix[2] - matrix[3], - matrix[6] - matrix[7], - matrix[10] - matrix[11], - matrix[15] - matrix[14]); - far_plane.normalize(); - - ///////--- Right Plane ---/////// - Plane right_plane = Plane(matrix[0] - matrix[3], - matrix[4] - matrix[7], - matrix[8] - matrix[11], - -matrix[15] + matrix[12]); - right_plane.normalize(); - - ///////--- Top Plane ---/////// - Plane top_plane = Plane(matrix[1] - matrix[3], - matrix[5] - matrix[7], - matrix[9] - matrix[11], - -matrix[15] + matrix[13]); - top_plane.normalize(); - - Vector3 near_endpoint_left, near_endpoint_right; - Vector3 far_endpoint_left, far_endpoint_right; - - bool res = near_plane.intersect_3(right_plane, top_plane, &near_endpoint_right); - ERR_FAIL_COND_V(!res, false); - - res = far_plane.intersect_3(right_plane, top_plane, &far_endpoint_right); - ERR_FAIL_COND_V(!res, false); - - if ((matrix[8] == 0) && (matrix[9] == 0)) { - near_endpoint_left = near_endpoint_right; - near_endpoint_left.x = -near_endpoint_left.x; - - far_endpoint_left = far_endpoint_right; - far_endpoint_left.x = -far_endpoint_left.x; - } else { - ///////--- Left Plane ---/////// - Plane left_plane = Plane(matrix[0] + matrix[3], - matrix[4] + matrix[7], - matrix[8] + matrix[11], - -matrix[15] - matrix[12]); - left_plane.normalize(); - - res = near_plane.intersect_3(left_plane, top_plane, &near_endpoint_left); - ERR_FAIL_COND_V(!res, false); - - res = far_plane.intersect_3(left_plane, top_plane, &far_endpoint_left); + Vector3 point; + bool res = planes[intersections[i][0]].intersect_3(planes[intersections[i][1]],planes[intersections[i][2]], &point); ERR_FAIL_COND_V(!res, false); + p_8points[i]=p_transform.xform(point); } - p_8points[0] = p_transform.xform(Vector3(near_endpoint_right.x, near_endpoint_right.y, near_endpoint_right.z)); - p_8points[1] = p_transform.xform(Vector3(near_endpoint_right.x, -near_endpoint_right.y, near_endpoint_right.z)); - p_8points[2] = p_transform.xform(Vector3(near_endpoint_left.x, near_endpoint_left.y, near_endpoint_left.z)); - p_8points[3] = p_transform.xform(Vector3(near_endpoint_left.x, -near_endpoint_left.y, near_endpoint_left.z)); - p_8points[4] = p_transform.xform(Vector3(far_endpoint_right.x, far_endpoint_right.y, far_endpoint_right.z)); - p_8points[5] = p_transform.xform(Vector3(far_endpoint_right.x, -far_endpoint_right.y, far_endpoint_right.z)); - p_8points[6] = p_transform.xform(Vector3(far_endpoint_left.x, far_endpoint_left.y, far_endpoint_left.z)); - p_8points[7] = p_transform.xform(Vector3(far_endpoint_left.x, -far_endpoint_left.y, far_endpoint_left.z)); - return true; + } Vector CameraMatrix::get_projection_planes(const Transform &p_transform) const { @@ -610,6 +562,12 @@ int CameraMatrix::get_pixels_per_meter(int p_for_pixel_width) const { return int((result.x * 0.5 + 0.5) * p_for_pixel_width); } +bool CameraMatrix::is_orthogonal() const { + + return matrix[3][3]==1.0; +} + + real_t CameraMatrix::get_fov() const { const real_t *matrix = (const real_t *)this->matrix; diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h index 175d0cdb1b2..87cc4b95b81 100644 --- a/core/math/camera_matrix.h +++ b/core/math/camera_matrix.h @@ -69,6 +69,7 @@ struct CameraMatrix { real_t get_z_near() const; real_t get_aspect() const; real_t get_fov() const; + bool is_orthogonal() const; Vector get_projection_planes(const Transform &p_transform) const; @@ -83,6 +84,7 @@ struct CameraMatrix { Plane xform4(const Plane &p_vec4) const; _FORCE_INLINE_ Vector3 xform(const Vector3 &p_vec3) const; + operator String() const; void scale_translate_to_fit(const Rect3 &p_aabb); diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp index 9732a1ff37f..4051de7afb7 100644 --- a/core/math/matrix3.cpp +++ b/core/math/matrix3.cpp @@ -234,7 +234,22 @@ Basis Basis::scaled(const Vector3 &p_scale) const { return m; } +void Basis::set_scale(const Vector3 &p_scale) { + + set_axis(0, get_axis(0).normalized() * p_scale.x); + set_axis(1, get_axis(1).normalized() * p_scale.y); + set_axis(2, get_axis(2).normalized() * p_scale.z); +} + Vector3 Basis::get_scale() const { + + return Vector3( + Vector3(elements[0][0], elements[1][0], elements[2][0]).length(), + Vector3(elements[0][1], elements[1][1], elements[2][1]).length(), + Vector3(elements[0][2], elements[1][2], elements[2][2]).length()); +} + +Vector3 Basis::get_signed_scale() const { // FIXME: We are assuming M = R.S (R is rotation and S is scaling), and use polar decomposition to extract R and S. // A polar decomposition is M = O.P, where O is an orthogonal matrix (meaning rotation and reflection) and // P is a positive semi-definite matrix (meaning it contains absolute values of scaling along its diagonal). diff --git a/core/math/matrix3.h b/core/math/matrix3.h index 9c9080ac467..23429888e0c 100644 --- a/core/math/matrix3.h +++ b/core/math/matrix3.h @@ -97,7 +97,9 @@ public: void scale(const Vector3 &p_scale); Basis scaled(const Vector3 &p_scale) const; + void set_scale(const Vector3 &p_scale); Vector3 get_scale() const; + Vector3 get_signed_scale() const; // transposed dot products _FORCE_INLINE_ real_t tdotx(const Vector3 &v) const { diff --git a/core/math/transform.cpp b/core/math/transform.cpp index 60df69a5095..638a39ab731 100644 --- a/core/math/transform.cpp +++ b/core/math/transform.cpp @@ -118,17 +118,17 @@ Transform Transform::interpolate_with(const Transform &p_transform, real_t p_c) /* not sure if very "efficient" but good enough? */ - Vector3 src_scale = basis.get_scale(); - Quat src_rot = basis; + Vector3 src_scale = basis.get_signed_scale(); + Quat src_rot = basis.orthonormalized(); Vector3 src_loc = origin; - Vector3 dst_scale = p_transform.basis.get_scale(); + Vector3 dst_scale = p_transform.basis.get_signed_scale(); Quat dst_rot = p_transform.basis; Vector3 dst_loc = p_transform.origin; - Transform dst; - dst.basis = src_rot.slerp(dst_rot, p_c); - dst.basis.scale(src_scale.linear_interpolate(dst_scale, p_c)); + Transform dst; //this could be made faster by using a single function in Basis.. + dst.basis = src_rot.slerp(dst_rot, p_c).normalized(); + dst.basis.set_scale(src_scale.linear_interpolate(dst_scale, p_c)); dst.origin = src_loc.linear_interpolate(dst_loc, p_c); return dst; diff --git a/core/object.h b/core/object.h index 6e1ed4308e2..644e2b82709 100644 --- a/core/object.h +++ b/core/object.h @@ -567,12 +567,6 @@ public: template static T *cast_to(Object *p_object) { -#ifdef DEBUG_ENABLED - // TODO there are some legitimate reasons to pass NULL as p_object. - // we need to figure out how to deal with that in debug mode. - // This code will return NULL for a NULL input in release mode also. - ERR_FAIL_COND_V(p_object == NULL, NULL); -#endif #ifndef NO_SAFE_CAST return dynamic_cast(p_object); #else @@ -587,12 +581,6 @@ public: template static const T *cast_to(const Object *p_object) { -#ifdef DEBUG_ENABLED - // TODO there are some legitimate reasons to pass NULL as p_object. - // we need to figure out how to deal with that in debug mode. - // This code will return NULL for a NULL input in release mode also. - ERR_FAIL_COND_V(p_object == NULL, NULL); -#endif #ifndef NO_SAFE_CAST return dynamic_cast(p_object); #else diff --git a/core/resource.cpp b/core/resource.cpp index 37d42226b4f..78e20bada44 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -69,12 +69,11 @@ void Resource::set_path(const String &p_path, bool p_take_over) { ResourceCache::resources.get(p_path)->set_name(""); ResourceCache::lock->write_unlock(); } else { - ERR_EXPLAIN("Another resource is loaded from path: " + p_path); - ResourceCache::lock->read_lock(); bool exists = ResourceCache::resources.has(p_path); ResourceCache::lock->read_unlock(); + ERR_EXPLAIN("Another resource is loaded from path: " + p_path); ERR_FAIL_COND(exists); } } diff --git a/core/script_language.h b/core/script_language.h index 342d8c80722..2261737f9ac 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -206,6 +206,7 @@ public: virtual int find_function(const String &p_function, const String &p_code) const = 0; virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const = 0; virtual Error open_in_external_editor(const Ref