use mvc for the testbed, update almost all tests, bugfixes, improvements, cleanup
Since I started altering the testbed for better maintainability, I prefered to drop this (tested) large change with a single commit. Some changes below: Put some globals in their correct place, Now Testbed uses the MVC pattern (Model-View Controller). This way it becomes better to maintain than using no pattern in my opinion. Fixed some bugs in the debug draw interface. Of course, updated almost all tests because of the differences. Update script.
This commit is contained in:
@@ -117,6 +117,11 @@ public :
|
||||
u32 m_flags;
|
||||
};
|
||||
|
||||
// The debug drawer interface used by Bounce.
|
||||
// You should set this to an implementation
|
||||
// before calling any function that uses the interface.
|
||||
extern b3Draw* b3Draw_draw;
|
||||
|
||||
inline void b3Draw::SetFlags(u32 flags)
|
||||
{
|
||||
m_flags = flags;
|
||||
|
@@ -46,6 +46,12 @@ struct b3Mat22
|
||||
b3Vec2 x, y;
|
||||
};
|
||||
|
||||
// Zero matrix
|
||||
extern const b3Mat22 b3Mat22_zero;
|
||||
|
||||
// Identity matrix
|
||||
extern const b3Mat22 b3Mat22_identity;
|
||||
|
||||
// Multiply a matrix times a vector.
|
||||
inline b3Vec2 operator*(const b3Mat22& A, const b3Vec2& v)
|
||||
{
|
||||
|
@@ -90,8 +90,8 @@ struct b3Mat33
|
||||
};
|
||||
|
||||
// Usefull constants.
|
||||
extern b3Mat33 b3Mat33_zero;
|
||||
extern b3Mat33 b3Mat33_identity;
|
||||
extern const b3Mat33 b3Mat33_zero;
|
||||
extern const b3Mat33 b3Mat33_identity;
|
||||
|
||||
// Add two matrices.
|
||||
inline b3Mat33 operator+(const b3Mat33& A, const b3Mat33& B)
|
||||
|
@@ -141,6 +141,9 @@ struct b3Quat
|
||||
float32 x, y, z, w;
|
||||
};
|
||||
|
||||
// Identity quaternion
|
||||
extern const b3Quat b3Quat_identity;
|
||||
|
||||
// Add two quaternions.
|
||||
inline b3Quat operator+(const b3Quat& a, const b3Quat& b)
|
||||
{
|
||||
|
@@ -31,6 +31,13 @@ struct b3Transform
|
||||
// Default ctor does nothing for performance.
|
||||
b3Transform() { }
|
||||
|
||||
// Set this transform from a rotation matrix and a translation vector.
|
||||
b3Transform(const b3Mat33& _rotation, const b3Vec3& _translation)
|
||||
{
|
||||
rotation = _rotation;
|
||||
position = _translation;
|
||||
}
|
||||
|
||||
// Set this transform from a rotation quaternion and a translation vector.
|
||||
b3Transform(const b3Quat& _rotation, const b3Vec3& _translation)
|
||||
{
|
||||
@@ -49,6 +56,9 @@ struct b3Transform
|
||||
b3Vec3 position; // in fact a translation
|
||||
};
|
||||
|
||||
// Identity transformation
|
||||
extern const b3Transform b3Transform_identity;
|
||||
|
||||
// Multiply a transform times a vector.
|
||||
inline b3Vec3 b3Mul(const b3Transform& T, const b3Vec3& v)
|
||||
{
|
||||
|
@@ -91,6 +91,15 @@ struct b3Vec2
|
||||
float32 x, y;
|
||||
};
|
||||
|
||||
// Zero vector
|
||||
extern const b3Vec2 b3Vec2_zero;
|
||||
|
||||
// Left vector
|
||||
extern const b3Vec2 b3Vec2_x;
|
||||
|
||||
// Right vector
|
||||
extern const b3Vec2 b3Vec2_y;
|
||||
|
||||
// Negate a vector.
|
||||
inline b3Vec2 operator-(const b3Vec2& v)
|
||||
{
|
||||
|
@@ -106,6 +106,18 @@ struct b3Vec3
|
||||
float32 x, y, z;
|
||||
};
|
||||
|
||||
// Zero vector
|
||||
extern const b3Vec3 b3Vec3_zero;
|
||||
|
||||
// Right vector
|
||||
extern const b3Vec3 b3Vec3_x;
|
||||
|
||||
// Up vector
|
||||
extern const b3Vec3 b3Vec3_y;
|
||||
|
||||
// Forward vector
|
||||
extern const b3Vec3 b3Vec3_z;
|
||||
|
||||
// Negate a vector.
|
||||
inline b3Vec3 operator-(const b3Vec3& v)
|
||||
{
|
||||
|
Reference in New Issue
Block a user