mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
Implement the use of the new vmap3-format by Lynx3d (mad props to you for this, and thanks for the talks earlier) + reduced Vmap size to less than one third, and improve precision + indoor/outdoor check which allows automatic unmounting of players + additional area information from WMOAreaTable.dbc, removed existing "hacks" + WMO liquid information for swimming and fishing correctly in buildings/cities/caves/instances (lava and slime WILL hurt from now on!) - buildfiles for windows are not properly done, and will need to be sorted out NOTE: Do NOT annoy Lynx3d about this, any issues with this "port" is entirely our fault ! THIS REVISION IS CONSIDERED UNSTABLE AND CONTAINS WORK IN PROGRESS - USE AT YOUR OWN RISK! --HG-- branch : trunk
70 lines
1.6 KiB
C++
70 lines
1.6 KiB
C++
#ifndef G3D_MATRIX2_H
|
|
#define G3D_MATRIX2_H
|
|
|
|
#include "G3D/platform.h"
|
|
#include "G3D/Vector2.h"
|
|
|
|
namespace G3D {
|
|
|
|
/** @beta */
|
|
class Matrix2 {
|
|
private:
|
|
|
|
float data[2][2];
|
|
|
|
public:
|
|
|
|
inline Matrix2() {
|
|
data[0][0] = 1.0f; data[0][1] = 0.0f;
|
|
data[1][0] = 0.0f; data[1][1] = 1.0f;
|
|
}
|
|
|
|
inline Matrix2(float v00, float v01, float v10, float v11) {
|
|
data[0][0] = v00; data[0][1] = v01;
|
|
data[1][0] = v10; data[1][1] = v11;
|
|
}
|
|
|
|
inline Vector2 operator*(const Vector2& v) const {
|
|
return Vector2(data[0][0] * v[0] + data[0][1] * v[1],
|
|
data[1][0] * v[0] + data[1][1] * v[1]);
|
|
}
|
|
|
|
inline Matrix2 inverse() const {
|
|
return Matrix2(data[0][0], data[1][0],
|
|
data[0][1], data[1][1]) * (1.0f / determinant());
|
|
}
|
|
|
|
inline Matrix2 transpose() const {
|
|
return Matrix2(data[0][0], data[1][0],
|
|
data[0][1], data[1][1]);
|
|
}
|
|
|
|
inline float determinant() const {
|
|
return data[0][0] * data[1][1] - data[0][1] * data[1][0];
|
|
}
|
|
|
|
inline Matrix2 operator*(float f) const {
|
|
return Matrix2(data[0][0] * f, data[0][1] * f,
|
|
data[1][0] * f, data[1][1] * f);
|
|
}
|
|
|
|
inline Matrix2 operator/(float f) const {
|
|
return Matrix2(data[0][0] / f, data[0][1] / f,
|
|
data[1][0] / f, data[1][1] / f);
|
|
}
|
|
|
|
inline float* operator[](int i) {
|
|
debugAssert(i >= 0 && i <= 2);
|
|
return data[i];
|
|
}
|
|
|
|
inline const float* operator[](int i) const {
|
|
debugAssert(i >= 0 && i <= 1);
|
|
return data[i];
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|