isle/LEGO1/mxvector.h

178 lines
4.2 KiB
C
Raw Normal View History

#ifndef MXVECTOR_H
#define MXVECTOR_H
#include "mxtypes.h"
2023-10-24 19:38:27 -04:00
#include <vec.h>
// VTABLE 0x100d4288
// SIZE 0x8
2023-10-24 19:38:27 -04:00
class MxVector2 {
public:
2023-10-24 19:38:27 -04:00
// OFFSET: LEGO1 0x1000c0f0
inline MxVector2(float* p_data) { this->SetData(p_data); }
// vtable + 0x00 (no virtual destructor)
virtual void AddScalarImpl(float p_value) = 0;
virtual void AddVectorImpl(float* p_value) = 0;
virtual void SubVectorImpl(float* p_value) = 0;
virtual void MullScalarImpl(float* p_value) = 0;
// vtable + 0x10
virtual void MullVectorImpl(float* p_value) = 0;
virtual void DivScalarImpl(float* p_value) = 0;
virtual float DotImpl(float* p_a, float* p_b) const = 0;
// OFFSET: LEGO1 0x10002060
virtual void SetData(float* p_data) { this->m_data = p_data; }
// vtable + 0x20
virtual void EqualsImpl(float* p_data) = 0;
virtual const float* GetData() const;
virtual float* GetData();
virtual void Clear() = 0;
// vtable + 0x30
virtual float Dot(MxVector2* p_a, float* p_b) const;
virtual float Dot(float* p_a, MxVector2* p_b) const;
virtual float Dot(MxVector2* p_a, MxVector2* p_b) const;
virtual float Dot(float* p_a, float* p_b) const;
// vtable + 0x40
virtual float LenSquared() const = 0;
virtual MxResult Unitize();
// vtable + 0x48
virtual void AddVector(MxVector2* p_other);
virtual void AddVector(float* p_other);
virtual void AddScalar(float p_value);
// vtable + 0x54
virtual void SubVector(MxVector2* p_other);
virtual void SubVector(float* p_other);
// vtable + 0x5C
virtual void MullScalar(float* p_value);
virtual void MullVector(MxVector2* p_other);
virtual void MullVector(float* p_other);
virtual void DivScalar(float* p_value);
// vtable + 0x6C
virtual void SetVector(MxVector2* p_other);
virtual void SetVector(float* p_other);
inline float& operator[](size_t idx) { return m_data[idx]; }
inline const float& operator[](size_t idx) const { return m_data[idx]; }
protected:
2023-10-24 19:38:27 -04:00
float* m_data;
};
// VTABLE 0x100d4518
// SIZE 0x8
2023-10-24 19:38:27 -04:00
class MxVector3 : public MxVector2 {
public:
2023-10-24 19:38:27 -04:00
inline MxVector3(float* p_data) : MxVector2(p_data) {}
2023-10-24 19:38:27 -04:00
void AddScalarImpl(float p_value);
2023-10-24 19:38:27 -04:00
void AddVectorImpl(float* p_value);
2023-10-24 19:38:27 -04:00
void SubVectorImpl(float* p_value);
void MullScalarImpl(float* p_value);
void MullVectorImpl(float* p_value);
void DivScalarImpl(float* p_value);
float DotImpl(float* p_a, float* p_b) const;
2023-10-24 19:38:27 -04:00
void EqualsImpl(float* p_data);
2023-10-24 19:38:27 -04:00
void Clear();
2023-10-24 19:38:27 -04:00
float LenSquared() const;
2023-10-24 19:38:27 -04:00
// vtable + 0x74
virtual void EqualsCrossImpl(float* p_a, float* p_b);
virtual void EqualsCross(float* p_a, MxVector3* p_b);
virtual void EqualsCross(MxVector3* p_a, float* p_b);
virtual void EqualsCross(MxVector3* p_a, MxVector3* p_b);
virtual void EqualsScalar(float* p_value);
2023-10-24 19:38:27 -04:00
inline void Fill(float p_value) { EqualsScalar(&p_value); }
};
// VTABLE 0x100d45a0
// SIZE 0x8
2023-10-24 19:38:27 -04:00
class MxVector4 : public MxVector3 {
public:
2023-10-24 19:38:27 -04:00
inline MxVector4(float* p_data) : MxVector3(p_data) {}
2023-10-24 19:38:27 -04:00
void AddScalarImpl(float p_value);
2023-10-24 19:38:27 -04:00
void AddVectorImpl(float* p_value);
2023-10-24 19:38:27 -04:00
void SubVectorImpl(float* p_value);
void MullScalarImpl(float* p_value);
void MullVectorImpl(float* p_value);
void DivScalarImpl(float* p_value);
float DotImpl(float* p_a, float* p_b) const;
2023-10-24 19:38:27 -04:00
void EqualsImpl(float* p_data);
2023-10-24 19:38:27 -04:00
void Clear();
2023-10-24 19:38:27 -04:00
float LenSquared() const;
2023-10-24 19:38:27 -04:00
void EqualsScalar(float* p_value);
2023-10-24 19:38:27 -04:00
// vtable + 0x84
virtual void SetMatrixProduct(MxVector4* p_a, float* p_b);
virtual void SetMatrixProductImpl(float* p_vec, float* p_mat);
virtual MxResult NormalizeQuaternion();
virtual void UnknownQuaternionOp(MxVector4* p_a, MxVector4* p_b);
};
// VTABLE 0x100d4488
// SIZE 0x14
2023-10-24 19:38:27 -04:00
class MxVector3Data : public MxVector3 {
public:
2023-10-24 19:38:27 -04:00
inline MxVector3Data() : MxVector3(storage) {}
inline MxVector3Data(float p_x, float p_y, float p_z) : MxVector3(storage), x(p_x), y(p_y), z(p_z) {}
union {
float storage[3];
struct {
float x;
float y;
float z;
};
};
void CopyFrom(MxVector3Data& p_other)
{
EqualsImpl(p_other.m_data);
float* dest = this->storage;
float* src = p_other.storage;
for (size_t i = sizeof(storage) / sizeof(float); i > 0; --i)
*dest++ = *src++;
}
};
// VTABLE 0x100d41e8
// SIZE 0x18
2023-10-24 19:38:27 -04:00
class MxVector4Data : public MxVector4 {
public:
2023-10-24 19:38:27 -04:00
inline MxVector4Data() : MxVector4(storage) {}
union {
float storage[4];
struct {
float x;
float y;
float z;
float w;
};
};
};
#endif // MXVECTOR_H