2024-04-11 07:35:15 -04:00
|
|
|
#ifndef __LEGOUNKNOWN100DB7F4_H
|
|
|
|
#define __LEGOUNKNOWN100DB7F4_H
|
|
|
|
|
|
|
|
#include "legoedge.h"
|
2024-05-18 11:48:07 -04:00
|
|
|
#include "legowegedge.h"
|
2024-04-11 07:35:15 -04:00
|
|
|
#include "mxgeometry/mxgeometry3d.h"
|
|
|
|
|
2024-07-28 14:13:18 -04:00
|
|
|
#include <assert.h>
|
|
|
|
|
2024-04-11 07:35:15 -04:00
|
|
|
// VTABLE: LEGO1 0x100db7f4
|
|
|
|
// SIZE 0x40
|
2024-05-11 13:45:13 -04:00
|
|
|
struct LegoUnknown100db7f4 : public LegoEdge {
|
2024-04-11 07:35:15 -04:00
|
|
|
public:
|
2024-05-11 13:45:13 -04:00
|
|
|
enum {
|
2024-05-13 08:39:43 -04:00
|
|
|
c_bit1 = 0x01,
|
|
|
|
c_bit2 = 0x02,
|
2024-05-11 13:45:13 -04:00
|
|
|
c_bit3 = 0x04,
|
|
|
|
c_bit4 = 0x08
|
|
|
|
};
|
|
|
|
|
2024-05-11 12:23:18 -04:00
|
|
|
LegoUnknown100db7f4();
|
|
|
|
|
2024-04-11 07:35:15 -04:00
|
|
|
// FUNCTION: LEGO1 0x1002ddc0
|
2024-05-11 09:32:11 -04:00
|
|
|
// FUNCTION: BETA10 0x100372a0
|
2024-04-11 07:35:15 -04:00
|
|
|
LegoResult FUN_1002ddc0(LegoWEEdge& p_f, Vector3& p_point)
|
|
|
|
{
|
2024-12-06 14:50:40 -05:00
|
|
|
if (p_f.IsEqual(m_faceA)) {
|
2024-10-06 10:50:34 -04:00
|
|
|
p_point[0] = -m_unk0x28.index_operator(0);
|
|
|
|
p_point[1] = -m_unk0x28.index_operator(1);
|
|
|
|
p_point[2] = -m_unk0x28.index_operator(2);
|
2024-04-11 07:35:15 -04:00
|
|
|
}
|
|
|
|
else {
|
2024-07-28 14:13:18 -04:00
|
|
|
// clang-format off
|
2024-12-06 14:50:40 -05:00
|
|
|
assert(p_f.IsEqual( m_faceB ));
|
2024-07-28 14:13:18 -04:00
|
|
|
// clang-format on
|
2024-04-11 07:35:15 -04:00
|
|
|
p_point = m_unk0x28;
|
|
|
|
}
|
|
|
|
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
2024-05-18 11:48:07 -04:00
|
|
|
// FUNCTION: BETA10 0x1004a830
|
2024-12-06 14:50:40 -05:00
|
|
|
LegoU32 BETA_1004a830(LegoWEGEdge& p_face, LegoU8 p_mask)
|
2024-05-18 11:48:07 -04:00
|
|
|
{
|
2024-12-06 14:50:40 -05:00
|
|
|
assert(p_face.IsEqual(m_faceA) || p_face.IsEqual(m_faceB));
|
|
|
|
return (p_face.IsEqual(m_faceB) && (m_flags & c_bit1) && (p_face.GetMask0x03() & p_mask) == p_mask) ||
|
|
|
|
(p_face.IsEqual(m_faceA) && (m_flags & c_bit2) && (p_face.GetMask0x03() & p_mask) == p_mask);
|
2024-05-18 11:48:07 -04:00
|
|
|
}
|
|
|
|
|
2024-05-20 14:27:00 -04:00
|
|
|
// FUNCTION: BETA10 0x100b53b0
|
2024-12-06 14:50:40 -05:00
|
|
|
LegoU32 BETA_100b53b0(LegoWEGEdge& p_face)
|
2024-05-20 14:27:00 -04:00
|
|
|
{
|
2024-12-06 14:50:40 -05:00
|
|
|
// clang-format off
|
|
|
|
assert(p_face.IsEqual( m_faceA ) || p_face.IsEqual( m_faceB ));
|
|
|
|
// clang-format on
|
|
|
|
return (p_face.IsEqual(m_faceA) && (m_flags & c_bit1)) || (p_face.IsEqual(m_faceB) && (m_flags & c_bit2));
|
2024-05-20 14:27:00 -04:00
|
|
|
}
|
|
|
|
|
2024-05-18 11:48:07 -04:00
|
|
|
// FUNCTION: BETA10 0x1001cbe0
|
|
|
|
LegoWEEdge* OtherFace(LegoWEEdge* p_other)
|
|
|
|
{
|
|
|
|
if (m_faceA == p_other) {
|
|
|
|
return m_faceB;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return m_faceA;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-12-06 14:50:40 -05:00
|
|
|
// FUNCTION: BETA10 0x100bd4a0
|
|
|
|
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);
|
|
|
|
return sqrt(point.LenSquared());
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: BETA10 0x100bd540
|
|
|
|
LegoFloat DistanceBetweenMidpoints(const LegoUnknown100db7f4& p_other)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
return sqrt(point1.LenSquared());
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: BETA10 0x1001cc60
|
2024-05-13 08:39:43 -04:00
|
|
|
LegoU32 GetMask0x03() { return m_flags & (c_bit1 | c_bit2); }
|
|
|
|
|
2024-05-11 12:23:18 -04:00
|
|
|
// SYNTHETIC: LEGO1 0x1009a6c0
|
|
|
|
// LegoUnknown100db7f4::`scalar deleting destructor'
|
|
|
|
|
2024-05-11 13:45:13 -04:00
|
|
|
LegoU16 m_flags; // 0x24
|
2024-04-11 07:35:15 -04:00
|
|
|
Mx3DPointFloat m_unk0x28; // 0x28
|
2024-05-19 11:24:09 -04:00
|
|
|
float m_unk0x3c; // 0x3c
|
2024-04-11 07:35:15 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __LEGOUNKNOWN100DB7F4_H
|