mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 08:24:16 +00:00
(Proposal) Introduce arithmetic operators to Vector2 (#1193)
This commit is contained in:

committed by
GitHub

parent
4d8098a6c2
commit
94ce89cbaa
@@ -168,7 +168,7 @@ LegoResult LegoAnimScene::FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix)
|
||||
}
|
||||
|
||||
local54 = localcc;
|
||||
((Vector3&) local54).Sub(localb8);
|
||||
local54 -= localb8;
|
||||
|
||||
if (local54.Unitize() == 0) {
|
||||
local5c.EqualsCross(&local68, &local54);
|
||||
@@ -177,7 +177,7 @@ LegoResult LegoAnimScene::FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix)
|
||||
local68.EqualsCross(&local54, &local5c);
|
||||
|
||||
localcc = p_matrix[3];
|
||||
((Vector3&) localcc).Add(localb0[3]);
|
||||
localcc += localb0[3];
|
||||
|
||||
p_matrix[3][0] = p_matrix[3][1] = p_matrix[3][2] = localb0[3][0] = localb0[3][1] = localb0[3][2] = 0;
|
||||
|
||||
|
@@ -71,9 +71,9 @@ public:
|
||||
LegoFloat DistanceToMidpoint(const Vector3& p_vec)
|
||||
{
|
||||
Mx3DPointFloat point(*m_pointA);
|
||||
((Vector3&) point).Add(*m_pointB);
|
||||
((Vector3&) point).Mul(0.5f);
|
||||
((Vector3&) point).Sub(p_vec);
|
||||
point += *m_pointB;
|
||||
point *= 0.5f;
|
||||
point -= p_vec;
|
||||
return sqrt(point.LenSquared());
|
||||
}
|
||||
|
||||
@@ -82,11 +82,11 @@ public:
|
||||
{
|
||||
Mx3DPointFloat point1(*m_pointA);
|
||||
Mx3DPointFloat point2(*p_other.m_pointA);
|
||||
((Vector3&) point1).Add(*m_pointB);
|
||||
((Vector3&) point1).Mul(0.5f);
|
||||
((Vector3&) point2).Add(*p_other.m_pointB);
|
||||
((Vector3&) point2).Mul(0.5f);
|
||||
((Vector3&) point1).Sub(point2);
|
||||
point1 += *m_pointB;
|
||||
point1 *= 0.5f;
|
||||
point2 += *p_other.m_pointB;
|
||||
point2 *= 0.5f;
|
||||
point1 -= point2;
|
||||
return sqrt(point1.LenSquared());
|
||||
}
|
||||
|
||||
|
@@ -42,9 +42,9 @@ LegoResult LegoUnknown::FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, L
|
||||
}
|
||||
else if (p_f1 >= 0.999) {
|
||||
v1 = m_unk0x00[0];
|
||||
((Vector3&) v1).Add(m_unk0x00[1]);
|
||||
((Vector3&) v1).Add(m_unk0x00[2]);
|
||||
((Vector3&) v1).Add(m_unk0x00[3]);
|
||||
v1 += m_unk0x00[1];
|
||||
v1 += m_unk0x00[2];
|
||||
v1 += m_unk0x00[3];
|
||||
|
||||
for (LegoS32 i = 0; i < 3; i++) {
|
||||
v4[i] = m_unk0x00[1][i] + m_unk0x00[2][i] * 2.0f + m_unk0x00[3][i] * 3.0f;
|
||||
@@ -61,7 +61,7 @@ LegoResult LegoUnknown::FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, L
|
||||
}
|
||||
|
||||
if (p_und) {
|
||||
((Vector3&) v4).Mul(-1.0f);
|
||||
v4 *= -1.0f;
|
||||
}
|
||||
|
||||
if (v4.Unitize() != 0) {
|
||||
|
@@ -600,8 +600,8 @@ LegoU32 LegoROI::FUN_100a9410(
|
||||
{
|
||||
if (p_collideBox) {
|
||||
Mx3DPointFloat v2(p_v2);
|
||||
((Vector3&) v2).Mul(p_f1);
|
||||
((Vector3&) v2).Add(p_v1);
|
||||
v2 *= p_f1;
|
||||
v2 += p_v1;
|
||||
|
||||
Mx4DPointFloat localc0;
|
||||
Mx4DPointFloat local9c;
|
||||
@@ -621,8 +621,8 @@ LegoU32 LegoROI::FUN_100a9410(
|
||||
localc0[3] = local9c[3] = local168[3] = 1.0f;
|
||||
|
||||
local38 = local58;
|
||||
((Vector3&) local38).Add(locala8);
|
||||
((Vector3&) local38).Mul(0.5f);
|
||||
local38 += locala8;
|
||||
local38 *= 0.5f;
|
||||
|
||||
local70 = localc0;
|
||||
localc0.SetMatrixProduct(&local70, (float*) m_local2world.GetData());
|
||||
@@ -647,7 +647,7 @@ LegoU32 LegoROI::FUN_100a9410(
|
||||
}
|
||||
|
||||
if (local150[i][3] + local38.Dot(&local38, &local150[i]) < 0.0f) {
|
||||
((Vector4&) local150[i]).Mul(-1.0f);
|
||||
local150[i] *= -1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,8 +659,8 @@ LegoU32 LegoROI::FUN_100a9410(
|
||||
|
||||
if (local50 >= 0.0f && local50 <= p_f1) {
|
||||
Mx3DPointFloat local17c(p_v2);
|
||||
((Vector3&) local17c).Mul(local50);
|
||||
((Vector3&) local17c).Add(local4c);
|
||||
local17c *= local50;
|
||||
local17c += local4c;
|
||||
|
||||
LegoS32 j;
|
||||
for (j = 0; j < 6; j++) {
|
||||
@@ -680,7 +680,7 @@ LegoU32 LegoROI::FUN_100a9410(
|
||||
}
|
||||
else {
|
||||
Mx3DPointFloat v1(p_v1);
|
||||
((Vector3&) v1).Sub(GetWorldBoundingSphere().Center());
|
||||
v1 -= GetWorldBoundingSphere().Center();
|
||||
|
||||
float local10 = GetWorldBoundingSphere().Radius();
|
||||
float local8 = p_v2.Dot(&p_v2, &p_v2);
|
||||
@@ -716,8 +716,8 @@ LegoU32 LegoROI::FUN_100a9410(
|
||||
|
||||
if (local1c >= 0.0f && p_f1 >= local1c) {
|
||||
p_v3 = p_v2;
|
||||
p_v3.Mul(local1c);
|
||||
p_v3.Add(p_v1);
|
||||
p_v3 *= local1c;
|
||||
p_v3 += p_v1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -744,8 +744,8 @@ void TimeROI::FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time)
|
||||
Mx3DPointFloat targetPosition(p_matrix[3]);
|
||||
Vector3 vec(m_local2world[3]);
|
||||
|
||||
((Vector3&) targetPosition).Sub(vec);
|
||||
((Vector3&) targetPosition).Div(time * 0.001);
|
||||
targetPosition -= vec;
|
||||
targetPosition /= time * 0.001;
|
||||
|
||||
FUN_100a5a30(targetPosition);
|
||||
}
|
||||
|
Reference in New Issue
Block a user