Merge remote-tracking branch 'origin/Physics' into GameLogicBranch
This commit is contained in:
commit
c06a53addb
|
@ -29,7 +29,7 @@ namespace LinearAlgebra
|
|||
Matrix2x2( );
|
||||
Matrix2x2( const ScalarType &m11, const ScalarType &m12,
|
||||
const ScalarType &m21, const ScalarType &m22 );
|
||||
Matrix2x2( const Vector2<ScalarType> vec[2] );
|
||||
explicit Matrix2x2( const Vector2<ScalarType> vec[2] );
|
||||
Matrix2x2( const Vector2<ScalarType> &vec1, const Vector2<ScalarType> &vec2 );
|
||||
explicit Matrix2x2( const ScalarType element[4] );
|
||||
Matrix2x2( const Matrix2x2<ScalarType> &matrix );
|
||||
|
@ -80,7 +80,7 @@ namespace LinearAlgebra
|
|||
Matrix3x3( const ScalarType &m11, const ScalarType &m12, const ScalarType &m13,
|
||||
const ScalarType &m21, const ScalarType &m22, const ScalarType &m23,
|
||||
const ScalarType &m31, const ScalarType &m32, const ScalarType &m33 );
|
||||
Matrix3x3( const Vector3<ScalarType> vec[3] );
|
||||
explicit Matrix3x3( const Vector3<ScalarType> vec[3] );
|
||||
Matrix3x3( const Vector3<ScalarType> &vec1, const Vector3<ScalarType> &vec2, const Vector3<ScalarType> &vec3 );
|
||||
explicit Matrix3x3( const ScalarType element[9] );
|
||||
Matrix3x3( const Matrix3x3<ScalarType> &matrix );
|
||||
|
@ -132,7 +132,7 @@ namespace LinearAlgebra
|
|||
const ScalarType &m21, const ScalarType &m22, const ScalarType &m23, const ScalarType &m24,
|
||||
const ScalarType &m31, const ScalarType &m32, const ScalarType &m33, const ScalarType &m34,
|
||||
const ScalarType &m41, const ScalarType &m42, const ScalarType &m43, const ScalarType &m44 );
|
||||
Matrix4x4( const Vector4<ScalarType> vec[4] );
|
||||
explicit Matrix4x4( const Vector4<ScalarType> vec[4] );
|
||||
Matrix4x4( const Vector4<ScalarType> &vec1, const Vector4<ScalarType> &vec2, const Vector4<ScalarType> &vec3, const Vector4<ScalarType> &vec4 );
|
||||
explicit Matrix4x4( const ScalarType element[16] );
|
||||
Matrix4x4( const Matrix4x4<ScalarType> &matrix );
|
||||
|
|
|
@ -8,13 +8,19 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math3D;
|
||||
|
||||
Box::Box( )
|
||||
: ICollideable(Type_box), rotation(Float4x4::identity), center(0.0f), boundingOffset(0.5f)
|
||||
{}
|
||||
Box::Box( ) : ICollideable(Type_box)
|
||||
{
|
||||
this->rotation = Float4x4::identity;
|
||||
this->center =0.0f;
|
||||
this->boundingOffset = Float3(0.5f);
|
||||
}
|
||||
|
||||
Box::Box( const Float4x4 &r, const Float3 &p, const Float3 &s )
|
||||
: ICollideable(Type_box), rotation(r), center(p), boundingOffset(s*0.5)
|
||||
{}
|
||||
Box::Box( const Float4x4 &r, const Float3 &p, const Float3 &s ) : ICollideable(Type_box)
|
||||
{
|
||||
this->rotation = r;
|
||||
this->center = p;
|
||||
this->boundingOffset = Float3(s*0.5);
|
||||
}
|
||||
|
||||
Box::~Box( ) {}
|
||||
|
||||
|
|
|
@ -8,10 +8,24 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math3D;
|
||||
|
||||
BoxAxisAligned::BoxAxisAligned( ) : ICollideable(Type_box_axis_aligned), minVertex(-0.5f,-0.5f,-0.5f), maxVertex(0.5f,0.5f,0.5f) {}
|
||||
BoxAxisAligned::BoxAxisAligned( const Float3 &_minVertex, const Float3 &_maxVertex ) : ICollideable(Type_box_axis_aligned), minVertex(_minVertex), maxVertex(_maxVertex) {}
|
||||
BoxAxisAligned::BoxAxisAligned( const Float &leftClip, const Float &rightClip, const Float &topClip, const Float &bottomClip, const Float &nearClip, const Float &farClip )
|
||||
: ICollideable(Type_box_axis_aligned), minVertex(leftClip, bottomClip, nearClip), maxVertex(rightClip, topClip, farClip) {}
|
||||
BoxAxisAligned::BoxAxisAligned( ) : ICollideable(Type_box_axis_aligned)
|
||||
{
|
||||
this->minVertex = Float3(-0.5f,-0.5f,-0.5f );
|
||||
this->maxVertex = Float3( 0.5f, 0.5f, 0.5f );
|
||||
}
|
||||
|
||||
BoxAxisAligned::BoxAxisAligned( const Float3 &_minVertex, const Float3 &_maxVertex ) : ICollideable(Type_box_axis_aligned)
|
||||
{
|
||||
this->minVertex = _minVertex;
|
||||
this->maxVertex = _maxVertex;
|
||||
}
|
||||
|
||||
BoxAxisAligned::BoxAxisAligned( const Float &leftClip, const Float &rightClip, const Float &topClip, const Float &bottomClip, const Float &nearClip, const Float &farClip ) : ICollideable(Type_box_axis_aligned)
|
||||
{
|
||||
this->minVertex = Float3( leftClip, bottomClip, nearClip );
|
||||
this->maxVertex = Float3( rightClip, topClip, farClip );
|
||||
}
|
||||
|
||||
BoxAxisAligned::~BoxAxisAligned( ) {}
|
||||
|
||||
BoxAxisAligned & BoxAxisAligned::operator = ( const BoxAxisAligned &box )
|
||||
|
@ -22,7 +36,9 @@ BoxAxisAligned & BoxAxisAligned::operator = ( const BoxAxisAligned &box )
|
|||
}
|
||||
|
||||
::Utility::DynamicMemory::UniquePointer<ICollideable> BoxAxisAligned::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new BoxAxisAligned(*this) ); }
|
||||
{
|
||||
return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new BoxAxisAligned(*this) );
|
||||
}
|
||||
|
||||
bool BoxAxisAligned::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
|
|
|
@ -74,13 +74,22 @@ namespace PrivateStatic
|
|||
}
|
||||
}
|
||||
|
||||
Frustrum::Frustrum() : ICollideable(Type_frustrum),
|
||||
leftPlane(Float3::standard_unit_x, -0.5f), rightPlane(-Float3::standard_unit_x, 0.5f),
|
||||
bottomPlane(Float3::standard_unit_y, -0.5f), topPlane(-Float3::standard_unit_y, 0.5f),
|
||||
nearPlane(Float3::standard_unit_z, -0.5f), farPlane(-Float3::standard_unit_z, 0.5f) {}
|
||||
Frustrum::Frustrum() : ICollideable(Type_frustrum)
|
||||
{
|
||||
this->leftPlane = Plane( Float3::standard_unit_x, -0.5f );
|
||||
this->rightPlane = Plane(-Float3::standard_unit_x, 0.5f ),
|
||||
this->bottomPlane = Plane( Float3::standard_unit_y, -0.5f );
|
||||
this->topPlane = Plane(-Float3::standard_unit_y, 0.5f );
|
||||
this->nearPlane = Plane( Float3::standard_unit_z, -0.5f );
|
||||
this->farPlane = Plane(-Float3::standard_unit_z, 0.5f );
|
||||
}
|
||||
|
||||
Frustrum::Frustrum( const Float4x4 &vp ) : ICollideable(Type_frustrum)
|
||||
{ PrivateStatic::VP_ToPlanes( this->leftPlane, this->rightPlane, this->bottomPlane, this->topPlane, this->nearPlane, this->farPlane, vp ); }
|
||||
{
|
||||
PrivateStatic::VP_ToPlanes( this->leftPlane, this->rightPlane, this->bottomPlane,
|
||||
this->topPlane, this->nearPlane, this->farPlane,
|
||||
vp );
|
||||
}
|
||||
|
||||
Frustrum::~Frustrum() {}
|
||||
|
||||
|
|
|
@ -6,7 +6,5 @@
|
|||
|
||||
using namespace ::Oyster::Collision3D;
|
||||
|
||||
ICollideable::ICollideable( Type _type )
|
||||
: type(_type) {}
|
||||
|
||||
ICollideable::ICollideable( Type _type ) : type(_type) {}
|
||||
ICollideable::~ICollideable() {}
|
|
@ -8,9 +8,24 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math3D;
|
||||
|
||||
Line::Line( ) : ICollideable(Type_line), ray(), length(0.0f) {}
|
||||
Line::Line( const class Ray &_ray, const Float &_length ) : ICollideable(Type_line), ray(_ray), length(_length) {}
|
||||
Line::Line( const Float3 &origin, const Float3 &normalizedDirection, const Float &_length ) : ICollideable(Type_line), ray(origin, normalizedDirection), length(_length) {}
|
||||
Line::Line( ) : ICollideable(Type_line)
|
||||
{
|
||||
this->ray = Ray();
|
||||
this->length = 0.0f;
|
||||
}
|
||||
|
||||
Line::Line( const class Ray &_ray, const Float &_length ) : ICollideable(Type_line)
|
||||
{
|
||||
this->ray = _ray;
|
||||
this->length = _length;
|
||||
}
|
||||
|
||||
Line::Line( const Float3 &origin, const Float3 &normalizedDirection, const Float &_length ) : ICollideable(Type_line)
|
||||
{
|
||||
this->ray = Ray( origin, normalizedDirection );
|
||||
this->length = _length;
|
||||
}
|
||||
|
||||
Line::~Line( ) {}
|
||||
|
||||
Line & Line::operator = ( const Line &line )
|
||||
|
|
|
@ -8,8 +8,18 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math;
|
||||
|
||||
Plane::Plane( ) : ICollideable(Type_plane), normal(), phasing(0.0f) {}
|
||||
Plane::Plane( const Float3 &n, const Float &p ) : ICollideable(Type_plane), normal(n), phasing(p) {}
|
||||
Plane::Plane( ) : ICollideable(Type_plane)
|
||||
{
|
||||
this->normal = Float3::standard_unit_z;
|
||||
this->phasing = 0.0f;
|
||||
}
|
||||
|
||||
Plane::Plane( const Float3 &n, const Float &p ) : ICollideable(Type_plane)
|
||||
{
|
||||
this->normal = n;
|
||||
this->phasing = p;
|
||||
}
|
||||
|
||||
Plane::~Plane( ) {}
|
||||
|
||||
Plane & Plane::operator = ( const Plane &plane )
|
||||
|
|
|
@ -8,8 +8,16 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math3D;
|
||||
|
||||
Point::Point( ) : ICollideable(Type_point), center() {}
|
||||
Point::Point( const Float3 &pos ) : ICollideable(Type_point), center(pos) {}
|
||||
Point::Point( ) : ICollideable(Type_point)
|
||||
{
|
||||
this->center = Float3::null;
|
||||
}
|
||||
|
||||
Point::Point( const Float3 &pos ) : ICollideable(Type_point)
|
||||
{
|
||||
this->center = pos;
|
||||
}
|
||||
|
||||
Point::~Point( ) {}
|
||||
|
||||
Point & Point::operator = ( const Point &point )
|
||||
|
@ -19,7 +27,9 @@ Point & Point::operator = ( const Point &point )
|
|||
}
|
||||
|
||||
::Utility::DynamicMemory::UniquePointer<ICollideable> Point::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Point(*this) ); }
|
||||
{
|
||||
return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Point(*this) );
|
||||
}
|
||||
|
||||
bool Point::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
|
|
|
@ -8,8 +8,20 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math3D;
|
||||
|
||||
Ray::Ray( ) : ICollideable(Type_ray), origin(), direction(), collisionDistance(0.0f) {}
|
||||
Ray::Ray( const Float3 &o, const ::Oyster::Math::Float3 &d ) : ICollideable(Type_ray), origin(o), direction(d), collisionDistance(0.0f) {}
|
||||
Ray::Ray( ) : ICollideable(Type_ray)
|
||||
{
|
||||
this->origin = Float3::null;
|
||||
this->direction = Float3::standard_unit_z;
|
||||
this->collisionDistance = 0.0f;
|
||||
}
|
||||
|
||||
Ray::Ray( const Float3 &o, const ::Oyster::Math::Float3 &d ) : ICollideable(Type_ray)
|
||||
{
|
||||
this->origin = o;
|
||||
this->direction = d;
|
||||
this->collisionDistance = 0.0f;
|
||||
}
|
||||
|
||||
Ray::~Ray( ) {}
|
||||
|
||||
Ray & Ray::operator = ( const Ray &ray )
|
||||
|
@ -20,7 +32,9 @@ Ray & Ray::operator = ( const Ray &ray )
|
|||
}
|
||||
|
||||
::Utility::DynamicMemory::UniquePointer<ICollideable> Ray::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Ray(*this) ); }
|
||||
{
|
||||
return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Ray(*this) );
|
||||
}
|
||||
|
||||
bool Ray::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
|
|
|
@ -4,8 +4,18 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math;
|
||||
|
||||
Sphere::Sphere( ) : ICollideable(Type_sphere), center(), radius(0.0f) { }
|
||||
Sphere::Sphere( const Float3 &_position, const Float &_radius ) : ICollideable(Type_sphere), center(_position), radius(_radius) {}
|
||||
Sphere::Sphere( ) : ICollideable(Type_sphere)
|
||||
{
|
||||
this->center = Float3::null;
|
||||
this->radius = 0.0f;
|
||||
}
|
||||
|
||||
Sphere::Sphere( const Float3 &_position, const Float &_radius ) : ICollideable(Type_sphere)
|
||||
{
|
||||
this->center = _position;
|
||||
this->radius = _radius;
|
||||
}
|
||||
|
||||
Sphere::~Sphere( ) {}
|
||||
|
||||
Sphere & Sphere::operator = ( const Sphere &sphere )
|
||||
|
|
Loading…
Reference in New Issue