Merge pull request #66962 from aaronfranke/core-struct-includes

Enhancements to includes in core data structures
This commit is contained in:
Rémi Verschelde 2022-10-06 08:57:05 +02:00
commit e727606f7b
11 changed files with 21 additions and 14 deletions

View File

@ -403,6 +403,7 @@ Variant AABB::intersects_segment_bind(const Vector3 &p_from, const Vector3 &p_to
}
return Variant();
}
Variant AABB::intersects_ray_bind(const Vector3 &p_from, const Vector3 &p_dir) const {
Vector3 inters;
if (intersects_ray(p_from, p_dir, &inters)) {

View File

@ -101,7 +101,7 @@ struct _NO_DISCARD_ AABB {
_FORCE_INLINE_ void expand_to(const Vector3 &p_vector); /** expand to contain a point if necessary */
_FORCE_INLINE_ AABB abs() const {
return AABB(Vector3(position.x + MIN(size.x, 0), position.y + MIN(size.y, 0), position.z + MIN(size.z, 0)), size.abs());
return AABB(Vector3(position.x + MIN(size.x, (real_t)0), position.y + MIN(size.y, (real_t)0), position.z + MIN(size.z, (real_t)0)), size.abs());
}
Variant intersects_segment_bind(const Vector3 &p_from, const Vector3 &p_to) const;

View File

@ -32,7 +32,8 @@
#define COLOR_H
#include "core/math/math_funcs.h"
#include "core/string/ustring.h"
class String;
struct _NO_DISCARD_ Color {
union {

View File

@ -147,6 +147,7 @@ Variant Plane::intersect_3_bind(const Plane &p_plane1, const Plane &p_plane2) co
return Variant();
}
}
Variant Plane::intersects_ray_bind(const Vector3 &p_from, const Vector3 &p_dir) const {
Vector3 inters;
if (intersects_ray(p_from, p_dir, &inters)) {
@ -155,6 +156,7 @@ Variant Plane::intersects_ray_bind(const Vector3 &p_from, const Vector3 &p_dir)
return Variant();
}
}
Variant Plane::intersects_segment_bind(const Vector3 &p_begin, const Vector3 &p_end) const {
Vector3 inters;
if (intersects_segment(p_begin, p_end, &inters)) {

View File

@ -838,8 +838,9 @@ float Projection::get_lod_multiplier() const {
return 1.0 / (zn / width);
}
//usage is lod_size / (lod_distance * multiplier) < threshold
// Usage is lod_size / (lod_distance * multiplier) < threshold
}
void Projection::make_scale(const Vector3 &p_scale) {
set_identity();
columns[0][0] = p_scale.x;

View File

@ -31,10 +31,11 @@
#ifndef PROJECTION_H
#define PROJECTION_H
#include "core/math/math_defs.h"
#include "core/math/vector3.h"
#include "core/math/vector4.h"
#include "core/templates/vector.h"
template <class T>
class Vector;
struct AABB;
struct Plane;
@ -42,7 +43,7 @@ struct Rect2;
struct Transform3D;
struct Vector2;
struct Projection {
struct _NO_DISCARD_ Projection {
enum Planes {
PLANE_NEAR,
PLANE_FAR,

View File

@ -31,10 +31,10 @@
#ifndef QUATERNION_H
#define QUATERNION_H
#include "core/math/math_defs.h"
#include "core/math/math_funcs.h"
#include "core/math/vector3.h"
#include "core/string/ustring.h"
class String;
struct _NO_DISCARD_ Quaternion {
union {

View File

@ -281,7 +281,7 @@ struct _NO_DISCARD_ Rect2 {
}
_FORCE_INLINE_ Rect2 abs() const {
return Rect2(Point2(position.x + MIN(size.x, 0), position.y + MIN(size.y, 0)), size.abs());
return Rect2(Point2(position.x + MIN(size.x, (real_t)0), position.y + MIN(size.y, (real_t)0)), size.abs());
}
Vector2 get_support(const Vector2 &p_normal) const {

View File

@ -34,6 +34,7 @@
#include "core/math/aabb.h"
#include "core/math/basis.h"
#include "core/math/plane.h"
#include "core/templates/vector.h"
struct _NO_DISCARD_ Transform3D {
Basis basis;

View File

@ -31,10 +31,10 @@
#ifndef VECTOR4_H
#define VECTOR4_H
#include "core/math/math_defs.h"
#include "core/error/error_macros.h"
#include "core/math/math_funcs.h"
#include "core/math/vector3.h"
#include "core/string/ustring.h"
class String;
struct _NO_DISCARD_ Vector4 {
static const int AXIS_COUNT = 4;