mirror of
https://github.com/isledecomp/isle.git
synced 2026-02-01 04:31:16 +00:00
Add Vector3/Vector4 to Data vector
This commit is contained in:
parent
c56423baa3
commit
123f143514
@ -65,7 +65,7 @@ class Matrix4Impl {
|
|||||||
virtual void ToQuaternion(Vector4Impl* p_resultQuat);
|
virtual void ToQuaternion(Vector4Impl* p_resultQuat);
|
||||||
virtual int FUN_10002710(const Vector3Impl* p_vec);
|
virtual int FUN_10002710(const Vector3Impl* p_vec);
|
||||||
|
|
||||||
inline float& operator[](size_t idx) { return (*m_data)[idx >> 2][idx & 3]; }
|
inline float& operator[](size_t idx) { return ((float*) m_data)[idx]; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Matrix4* m_data;
|
Matrix4* m_data;
|
||||||
@ -75,8 +75,8 @@ class Matrix4Impl {
|
|||||||
// SIZE 0x48
|
// SIZE 0x48
|
||||||
class Matrix4Data : public Matrix4Impl {
|
class Matrix4Data : public Matrix4Impl {
|
||||||
public:
|
public:
|
||||||
inline Matrix4Data() : Matrix4Impl(m) {}
|
inline Matrix4Data() : Matrix4Impl(m_matrix) {}
|
||||||
inline Matrix4Data(Matrix4Data& p_other) : Matrix4Impl(m) { m = *p_other.m_data; }
|
inline Matrix4Data(Matrix4Data& p_other) : Matrix4Impl(m_matrix) { m_matrix = *p_other.m_data; }
|
||||||
inline Matrix4& GetMatrix() { return *m_data; }
|
inline Matrix4& GetMatrix() { return *m_data; }
|
||||||
|
|
||||||
// No idea why there's another equals. Maybe to some other type like the
|
// No idea why there's another equals. Maybe to some other type like the
|
||||||
@ -84,7 +84,7 @@ class Matrix4Data : public Matrix4Impl {
|
|||||||
// vtable + 0x44
|
// vtable + 0x44
|
||||||
virtual void operator=(const Matrix4Data& p_other);
|
virtual void operator=(const Matrix4Data& p_other);
|
||||||
|
|
||||||
Matrix4 m;
|
Matrix4 m_matrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MATRIX_H
|
#endif // MATRIX_H
|
||||||
|
|||||||
@ -186,43 +186,31 @@ class Vector4Impl : public Vector3Impl {
|
|||||||
// SIZE 0x14
|
// SIZE 0x14
|
||||||
class Vector3Data : public Vector3Impl {
|
class Vector3Data : public Vector3Impl {
|
||||||
public:
|
public:
|
||||||
inline Vector3Data() : Vector3Impl(storage) {}
|
inline Vector3Data() : Vector3Impl(m_vector.elements) {}
|
||||||
inline Vector3Data(float p_x, float p_y, float p_z) : Vector3Impl(storage), x(p_x), y(p_y), z(p_z) {}
|
inline Vector3Data(float p_x, float p_y, float p_z) : Vector3Impl(m_vector.elements), m_vector(p_x, p_y, p_z) {}
|
||||||
|
|
||||||
union {
|
|
||||||
float storage[3];
|
|
||||||
struct {
|
|
||||||
float x;
|
|
||||||
float y;
|
|
||||||
float z;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
void CopyFrom(Vector3Data& p_other)
|
void CopyFrom(Vector3Data& p_other)
|
||||||
{
|
{
|
||||||
EqualsImpl(p_other.m_data);
|
EqualsImpl(p_other.m_data);
|
||||||
|
|
||||||
float* dest = this->storage;
|
float* dest = m_vector.elements;
|
||||||
float* src = p_other.storage;
|
float* src = p_other.m_vector.elements;
|
||||||
for (size_t i = sizeof(storage) / sizeof(float); i > 0; --i)
|
for (size_t i = sizeof(m_vector) / sizeof(float); i > 0; --i)
|
||||||
*dest++ = *src++;
|
*dest++ = *src++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Vector3 m_vector;
|
||||||
};
|
};
|
||||||
|
|
||||||
// VTABLE 0x100d41e8
|
// VTABLE 0x100d41e8
|
||||||
// SIZE 0x18
|
// SIZE 0x18
|
||||||
class Vector4Data : public Vector4Impl {
|
class Vector4Data : public Vector4Impl {
|
||||||
public:
|
public:
|
||||||
inline Vector4Data() : Vector4Impl(storage) {}
|
inline Vector4Data() : Vector4Impl(m_vector.elements) {}
|
||||||
union {
|
|
||||||
float storage[4];
|
private:
|
||||||
struct {
|
Vector4 m_vector;
|
||||||
float x;
|
|
||||||
float y;
|
|
||||||
float z;
|
|
||||||
float w;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VECTOR_H
|
#endif // VECTOR_H
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user