Float literals - fix main primitives to use .f
Converts float literals from double format (e.g. 0.0) to float format (e.g. 0.0f) where appropriate for 32 bit calculations.
This commit is contained in:
parent
38c851a3fa
commit
5298e16e80
21 changed files with 222 additions and 222 deletions
|
|
@ -49,7 +49,7 @@ struct _NO_DISCARD_ Rect2 {
|
|||
|
||||
real_t get_area() const { return size.width * size.height; }
|
||||
|
||||
_FORCE_INLINE_ Vector2 get_center() const { return position + (size * 0.5); }
|
||||
_FORCE_INLINE_ Vector2 get_center() const { return position + (size * 0.5f); }
|
||||
|
||||
inline bool intersects(const Rect2 &p_rect, const bool p_include_borders = false) const {
|
||||
#ifdef MATH_CHECKS
|
||||
|
|
@ -285,7 +285,7 @@ struct _NO_DISCARD_ Rect2 {
|
|||
}
|
||||
|
||||
Vector2 get_support(const Vector2 &p_normal) const {
|
||||
Vector2 half_extents = size * 0.5;
|
||||
Vector2 half_extents = size * 0.5f;
|
||||
Vector2 ofs = position + half_extents;
|
||||
return Vector2(
|
||||
(p_normal.x > 0) ? -half_extents.x : half_extents.x,
|
||||
|
|
@ -307,14 +307,14 @@ struct _NO_DISCARD_ Rect2 {
|
|||
|
||||
Vector2 r = (b - a);
|
||||
float l = r.length();
|
||||
if (l == 0.0) {
|
||||
if (l == 0.0f) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//check inside
|
||||
Vector2 tg = r.orthogonal();
|
||||
float s = tg.dot(center) - tg.dot(a);
|
||||
if (s < 0.0) {
|
||||
if (s < 0.0f) {
|
||||
side_plus++;
|
||||
} else {
|
||||
side_minus++;
|
||||
|
|
@ -322,7 +322,7 @@ struct _NO_DISCARD_ Rect2 {
|
|||
|
||||
//check ray box
|
||||
r /= l;
|
||||
Vector2 ir(1.0 / r.x, 1.0 / r.y);
|
||||
Vector2 ir(1.0f / r.x, 1.0f / r.y);
|
||||
|
||||
// lb is the corner of AABB with minimal coordinates - left bottom, rt is maximal corner
|
||||
// r.org is origin of ray
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue