diff options
Diffstat (limited to 'core/math')
37 files changed, 116 insertions, 101 deletions
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 021391da83..e4f93289e9 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -29,9 +29,10 @@ /*************************************************************************/ #include "a_star.h" -#include "geometry.h" + +#include "core/math/geometry.h" +#include "core/script_language.h" #include "scene/scene_string_names.h" -#include "script_language.h" int AStar::get_available_point_id() const { diff --git a/core/math/a_star.h b/core/math/a_star.h index 8c1b5f64cb..d2ef765006 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -31,8 +31,9 @@ #ifndef ASTAR_H #define ASTAR_H -#include "reference.h" -#include "self_list.h" +#include "core/reference.h" +#include "core/self_list.h" + /** A* pathfinding algorithm diff --git a/core/math/aabb.cpp b/core/math/aabb.cpp index e2e71dda92..d0cb2b5195 100644 --- a/core/math/aabb.cpp +++ b/core/math/aabb.cpp @@ -30,7 +30,7 @@ #include "aabb.h" -#include "print_string.h" +#include "core/print_string.h" real_t AABB::get_area() const { diff --git a/core/math/aabb.h b/core/math/aabb.h index cdb8eb48a3..0b03b7d314 100644 --- a/core/math/aabb.h +++ b/core/math/aabb.h @@ -31,9 +31,9 @@ #ifndef AABB_H #define AABB_H -#include "math_defs.h" -#include "plane.h" -#include "vector3.h" +#include "core/math/math_defs.h" +#include "core/math/plane.h" +#include "core/math/vector3.h" /** * AABB / AABB (Axis Aligned Bounding Box) diff --git a/core/math/audio_frame.h b/core/math/audio_frame.h index 67ba025e1c..fde26e8056 100644 --- a/core/math/audio_frame.h +++ b/core/math/audio_frame.h @@ -31,7 +31,7 @@ #ifndef AUDIOFRAME_H #define AUDIOFRAME_H -#include "typedefs.h" +#include "core/typedefs.h" static inline float undenormalise(volatile float f) { union { diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp index 24096de551..6e51c56357 100644 --- a/core/math/bsp_tree.cpp +++ b/core/math/bsp_tree.cpp @@ -29,8 +29,9 @@ /*************************************************************************/ #include "bsp_tree.h" -#include "error_macros.h" -#include "print_string.h" + +#include "core/error_macros.h" +#include "core/print_string.h" void BSP_Tree::from_aabb(const AABB &p_aabb) { diff --git a/core/math/bsp_tree.h b/core/math/bsp_tree.h index fb16818ae7..b06e6b8539 100644 --- a/core/math/bsp_tree.h +++ b/core/math/bsp_tree.h @@ -31,13 +31,13 @@ #ifndef BSP_TREE_H #define BSP_TREE_H -#include "aabb.h" -#include "dvector.h" -#include "face3.h" -#include "method_ptrcall.h" -#include "plane.h" -#include "variant.h" -#include "vector.h" +#include "core/dvector.h" +#include "core/math/aabb.h" +#include "core/math/face3.h" +#include "core/math/plane.h" +#include "core/method_ptrcall.h" +#include "core/variant.h" +#include "core/vector.h" /** @author Juan Linietsky <reduzio@gmail.com> */ diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 1ab9b3532e..3a082d5720 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -29,8 +29,9 @@ /*************************************************************************/ #include "camera_matrix.h" -#include "math_funcs.h" -#include "print_string.h" + +#include "core/math/math_funcs.h" +#include "core/print_string.h" void CameraMatrix::set_identity() { diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h index a689c7238a..bd20908ad9 100644 --- a/core/math/camera_matrix.h +++ b/core/math/camera_matrix.h @@ -31,8 +31,9 @@ #ifndef CAMERA_MATRIX_H #define CAMERA_MATRIX_H -#include "rect2.h" -#include "transform.h" +#include "core/math/rect2.h" +#include "core/math/transform.h" + /** @author Juan Linietsky <reduzio@gmail.com> */ diff --git a/core/math/delaunay.h b/core/math/delaunay.h index d47dc5240b..9c5eef9069 100644 --- a/core/math/delaunay.h +++ b/core/math/delaunay.h @@ -31,7 +31,7 @@ #ifndef DELAUNAY_H #define DELAUNAY_H -#include "rect2.h" +#include "core/math/rect2.h" class Delaunay2D { public: diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 53e6aae36c..c0d7f874d2 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -30,13 +30,13 @@ #include "expression.h" -#include "class_db.h" -#include "func_ref.h" -#include "io/marshalls.h" -#include "math_funcs.h" -#include "os/os.h" -#include "reference.h" -#include "variant_parser.h" +#include "core/class_db.h" +#include "core/func_ref.h" +#include "core/io/marshalls.h" +#include "core/math/math_funcs.h" +#include "core/os/os.h" +#include "core/reference.h" +#include "core/variant_parser.h" const char *Expression::func_name[Expression::FUNC_MAX] = { "sin", diff --git a/core/math/face3.cpp b/core/math/face3.cpp index 801f2a3b4d..aa46fde7f7 100644 --- a/core/math/face3.cpp +++ b/core/math/face3.cpp @@ -29,7 +29,8 @@ /*************************************************************************/ #include "face3.h" -#include "geometry.h" + +#include "core/math/geometry.h" int Face3::split_by_plane(const Plane &p_plane, Face3 p_res[3], bool p_is_point_over[3]) const { diff --git a/core/math/face3.h b/core/math/face3.h index faed0fa8d4..b41daf04d4 100644 --- a/core/math/face3.h +++ b/core/math/face3.h @@ -31,10 +31,10 @@ #ifndef FACE3_H #define FACE3_H -#include "aabb.h" -#include "plane.h" -#include "transform.h" -#include "vector3.h" +#include "core/math/aabb.h" +#include "core/math/plane.h" +#include "core/math/transform.h" +#include "core/math/vector3.h" class Face3 { public: diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp index d8cb657b5e..be5e40e4e6 100644 --- a/core/math/geometry.cpp +++ b/core/math/geometry.cpp @@ -29,7 +29,8 @@ /*************************************************************************/ #include "geometry.h" -#include "print_string.h" + +#include "core/print_string.h" bool Geometry::is_point_in_polygon(const Vector2 &p_point, const Vector<Vector2> &p_polygon) { diff --git a/core/math/geometry.h b/core/math/geometry.h index 83b9467a30..a813a90774 100644 --- a/core/math/geometry.h +++ b/core/math/geometry.h @@ -31,14 +31,15 @@ #ifndef GEOMETRY_H #define GEOMETRY_H -#include "dvector.h" -#include "face3.h" -#include "object.h" -#include "print_string.h" -#include "rect2.h" -#include "triangulate.h" -#include "vector.h" -#include "vector3.h" +#include "core/dvector.h" +#include "core/math/face3.h" +#include "core/math/rect2.h" +#include "core/math/triangulate.h" +#include "core/math/vector3.h" +#include "core/object.h" +#include "core/print_string.h" +#include "core/vector.h" + /** @author Juan Linietsky <reduzio@gmail.com> */ diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 992084a653..472baf0484 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -31,8 +31,8 @@ #ifndef MATH_FUNCS_H #define MATH_FUNCS_H -#include "math_defs.h" -#include "typedefs.h" +#include "core/math/math_defs.h" +#include "core/typedefs.h" #include "thirdparty/misc/pcg.h" diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp index 7db41756ed..fca54b1556 100644 --- a/core/math/matrix3.cpp +++ b/core/math/matrix3.cpp @@ -29,9 +29,11 @@ /*************************************************************************/ #include "matrix3.h" -#include "math_funcs.h" -#include "os/copymem.h" -#include "print_string.h" + +#include "core/math/math_funcs.h" +#include "core/os/copymem.h" +#include "core/print_string.h" + #define cofac(row1, col1, row2, col2) \ (elements[row1][col1] * elements[row2][col2] - elements[row1][col2] * elements[row2][col1]) diff --git a/core/math/matrix3.h b/core/math/matrix3.h index 9ff1a97dc9..35bf75bbe4 100644 --- a/core/math/matrix3.h +++ b/core/math/matrix3.h @@ -28,16 +28,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "vector3.h" +// Circular dependency between Vector3 and Basis :/ +#include "core/math/vector3.h" #ifndef MATRIX3_H #define MATRIX3_H -#include "quat.h" +#include "core/math/quat.h" /** @author Juan Linietsky <reduzio@gmail.com> */ + class Basis { public: Vector3 elements[3]; diff --git a/core/math/octree.h b/core/math/octree.h index 4e3d6257f0..cd89743a5a 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -31,12 +31,12 @@ #ifndef OCTREE_H #define OCTREE_H -#include "aabb.h" -#include "list.h" -#include "map.h" -#include "print_string.h" -#include "variant.h" -#include "vector3.h" +#include "core/list.h" +#include "core/map.h" +#include "core/math/aabb.h" +#include "core/math/vector3.h" +#include "core/print_string.h" +#include "core/variant.h" /** @author Juan Linietsky <reduzio@gmail.com> @@ -478,7 +478,7 @@ void Octree<T, use_pairs, AL>::_insert_element(Element *p_element, Octant *p_oct splits++; } } else { - /* check againt AABB where child should be */ + /* check against AABB where child should be */ AABB aabb = p_octant->aabb; aabb.size *= 0.5; diff --git a/core/math/plane.cpp b/core/math/plane.cpp index 78bb1771a4..3c597d57f8 100644 --- a/core/math/plane.cpp +++ b/core/math/plane.cpp @@ -30,7 +30,7 @@ #include "plane.h" -#include "math_funcs.h" +#include "core/math/math_funcs.h" #define _PLANE_EQ_DOT_EPSILON 0.999 #define _PLANE_EQ_D_EPSILON 0.0001 diff --git a/core/math/plane.h b/core/math/plane.h index e567422dd0..4eedebb79e 100644 --- a/core/math/plane.h +++ b/core/math/plane.h @@ -31,7 +31,7 @@ #ifndef PLANE_H #define PLANE_H -#include "vector3.h" +#include "core/math/vector3.h" class Plane { public: diff --git a/core/math/quat.cpp b/core/math/quat.cpp index 2251571146..d660ce4553 100644 --- a/core/math/quat.cpp +++ b/core/math/quat.cpp @@ -29,8 +29,9 @@ /*************************************************************************/ #include "quat.h" -#include "matrix3.h" -#include "print_string.h" + +#include "core/math/matrix3.h" +#include "core/print_string.h" // set_euler_xyz expects a vector containing the Euler angles in the format // (ax,ay,az), where ax is the angle of rotation around x axis, diff --git a/core/math/quat.h b/core/math/quat.h index 6dc8d66f60..10d3846c87 100644 --- a/core/math/quat.h +++ b/core/math/quat.h @@ -28,18 +28,20 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "vector3.h" +// Circular dependency between Vector3 and Basis :/ +#include "core/math/vector3.h" #ifndef QUAT_H #define QUAT_H -#include "math_defs.h" -#include "math_funcs.h" -#include "ustring.h" +#include "core/math/math_defs.h" +#include "core/math/math_funcs.h" +#include "core/ustring.h" /** @author Juan Linietsky <reduzio@gmail.com> */ + class Quat { public: real_t x, y, z, w; diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index 9d4f4f66b7..23823b339a 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -29,7 +29,8 @@ /*************************************************************************/ #include "quick_hull.h" -#include "map.h" + +#include "core/map.h" uint32_t QuickHull::debug_stop_after = 0xFFFFFFFF; diff --git a/core/math/quick_hull.h b/core/math/quick_hull.h index eef4a9adff..0ac2758323 100644 --- a/core/math/quick_hull.h +++ b/core/math/quick_hull.h @@ -31,10 +31,10 @@ #ifndef QUICK_HULL_H #define QUICK_HULL_H -#include "aabb.h" -#include "geometry.h" -#include "list.h" -#include "set.h" +#include "core/list.h" +#include "core/math/aabb.h" +#include "core/math/geometry.h" +#include "core/set.h" class QuickHull { diff --git a/core/math/rect2.cpp b/core/math/rect2.cpp index 480bccdff1..24c1c8c984 100644 --- a/core/math/rect2.cpp +++ b/core/math/rect2.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "transform_2d.h" // Includes rect2.h but Rect2 needs Transform2D +#include "core/math/transform_2d.h" // Includes rect2.h but Rect2 needs Transform2D bool Rect2::intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos, Point2 *r_normal) const { diff --git a/core/math/rect2.h b/core/math/rect2.h index 20329bee0d..96c0e177d3 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -31,7 +31,7 @@ #ifndef RECT2_H #define RECT2_H -#include "vector2.h" // also includes math_funcs and ustring +#include "core/math/vector2.h" // also includes math_funcs and ustring struct Transform2D; diff --git a/core/math/transform.cpp b/core/math/transform.cpp index 976e0f174e..75257a6e60 100644 --- a/core/math/transform.cpp +++ b/core/math/transform.cpp @@ -29,9 +29,10 @@ /*************************************************************************/ #include "transform.h" -#include "math_funcs.h" -#include "os/copymem.h" -#include "print_string.h" + +#include "core/math/math_funcs.h" +#include "core/os/copymem.h" +#include "core/print_string.h" void Transform::affine_invert() { diff --git a/core/math/transform.h b/core/math/transform.h index c06eaec604..97c8bf9ab0 100644 --- a/core/math/transform.h +++ b/core/math/transform.h @@ -31,12 +31,14 @@ #ifndef TRANSFORM_H #define TRANSFORM_H -#include "aabb.h" -#include "matrix3.h" -#include "plane.h" +#include "core/math/aabb.h" +#include "core/math/matrix3.h" +#include "core/math/plane.h" + /** @author Juan Linietsky <reduzio@gmail.com> */ + class Transform { public: Basis basis; diff --git a/core/math/transform_2d.h b/core/math/transform_2d.h index bf73755f0d..c8fc3c39e3 100644 --- a/core/math/transform_2d.h +++ b/core/math/transform_2d.h @@ -31,7 +31,7 @@ #ifndef TRANSFORM_2D_H #define TRANSFORM_2D_H -#include "rect2.h" // also includes vector2, math_funcs, and ustring +#include "core/math/rect2.h" // also includes vector2, math_funcs, and ustring struct Transform2D { // Warning #1: basis of Transform2D is stored differently from Basis. In terms of elements array, the basis matrix looks like "on paper": diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp index 5475f733c3..6b8dc5eeb3 100644 --- a/core/math/triangle_mesh.cpp +++ b/core/math/triangle_mesh.cpp @@ -29,7 +29,8 @@ /*************************************************************************/ #include "triangle_mesh.h" -#include "sort.h" + +#include "core/sort.h" int TriangleMesh::_create_bvh(BVH *p_bvh, BVH **p_bb, int p_from, int p_size, int p_depth, int &max_depth, int &max_alloc) { diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h index bf793fc50f..e5f181fba7 100644 --- a/core/math/triangle_mesh.h +++ b/core/math/triangle_mesh.h @@ -31,8 +31,9 @@ #ifndef TRIANGLE_MESH_H #define TRIANGLE_MESH_H -#include "face3.h" -#include "reference.h" +#include "core/math/face3.h" +#include "core/reference.h" + class TriangleMesh : public Reference { GDCLASS(TriangleMesh, Reference); diff --git a/core/math/triangulate.cpp b/core/math/triangulate.cpp index 0edc0ea039..69ffc95946 100644 --- a/core/math/triangulate.cpp +++ b/core/math/triangulate.cpp @@ -186,7 +186,7 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul nv--; - /* resest error detection counter */ + /* reset error detection counter */ count = 2 * nv; } } diff --git a/core/math/triangulate.h b/core/math/triangulate.h index a0f56f5f27..2b0557ee55 100644 --- a/core/math/triangulate.h +++ b/core/math/triangulate.h @@ -31,7 +31,7 @@ #ifndef TRIANGULATE_H #define TRIANGULATE_H -#include "vector2.h" +#include "core/math/vector2.h" /* http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml diff --git a/core/math/vector2.h b/core/math/vector2.h index fbcdc80b60..df49484aaf 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -31,8 +31,8 @@ #ifndef VECTOR2_H #define VECTOR2_H -#include "math_funcs.h" -#include "ustring.h" +#include "core/math/math_funcs.h" +#include "core/ustring.h" struct Vector2i; diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp index 78d52d5cd1..5dbb01493d 100644 --- a/core/math/vector3.cpp +++ b/core/math/vector3.cpp @@ -29,7 +29,8 @@ /*************************************************************************/ #include "vector3.h" -#include "matrix3.h" + +#include "core/math/matrix3.h" void Vector3::rotate(const Vector3 &p_axis, real_t p_phi) { diff --git a/core/math/vector3.h b/core/math/vector3.h index 5f0e8919ff..5302832eeb 100644 --- a/core/math/vector3.h +++ b/core/math/vector3.h @@ -31,10 +31,10 @@ #ifndef VECTOR3_H #define VECTOR3_H -#include "math_defs.h" -#include "math_funcs.h" -#include "typedefs.h" -#include "ustring.h" +#include "core/math/math_defs.h" +#include "core/math/math_funcs.h" +#include "core/typedefs.h" +#include "core/ustring.h" class Basis; @@ -150,13 +150,8 @@ struct Vector3 { } }; -#ifdef VECTOR3_IMPL_OVERRIDE - -#include "vector3_inline.h" - -#else - -#include "matrix3.h" +// Should be included after class definition, otherwise we get circular refs +#include "core/math/matrix3.h" Vector3 Vector3::cross(const Vector3 &p_b) const { @@ -451,6 +446,4 @@ Vector3 Vector3::reflect(const Vector3 &p_normal) const { return 2.0 * p_normal * this->dot(p_normal) - *this; } -#endif - #endif // VECTOR3_H |