Evil Incompotent Compiler fix

Sometimes the compiler decides to not compile constructors properly. :(
Edited all constructors in Collision3D to reduce chance of this.
This commit is contained in:
Dander7BD 2013-11-27 15:20:29 +01:00
parent 62b1c68479
commit 36741de19b
9 changed files with 120 additions and 32 deletions

View File

@ -8,13 +8,19 @@
using namespace ::Oyster::Collision3D; using namespace ::Oyster::Collision3D;
using namespace ::Oyster::Math3D; using namespace ::Oyster::Math3D;
Box::Box( ) Box::Box( ) : ICollideable(Type_box)
: ICollideable(Type_box), rotation(Float4x4::identity), center(0.0f), boundingOffset(0.5f) {
{} this->rotation = Float4x4::identity;
this->center =0.0f;
this->boundingOffset = Float3(0.5f);
}
Box::Box( const Float4x4 &r, const Float3 &p, const Float3 &s ) Box::Box( const Float4x4 &r, const Float3 &p, const Float3 &s ) : ICollideable(Type_box)
: ICollideable(Type_box), rotation(r), center(p), boundingOffset(s*0.5) {
{} this->rotation = r;
this->center = p;
this->boundingOffset = Float3(s*0.5);
}
Box::~Box( ) {} Box::~Box( ) {}

View File

@ -8,10 +8,24 @@
using namespace ::Oyster::Collision3D; using namespace ::Oyster::Collision3D;
using namespace ::Oyster::Math3D; 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( ) : ICollideable(Type_box_axis_aligned)
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 ) this->minVertex = Float3(-0.5f,-0.5f,-0.5f );
: ICollideable(Type_box_axis_aligned), minVertex(leftClip, bottomClip, nearClip), maxVertex(rightClip, topClip, farClip) {} 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( ) {}
BoxAxisAligned & BoxAxisAligned::operator = ( const BoxAxisAligned &box ) BoxAxisAligned & BoxAxisAligned::operator = ( const BoxAxisAligned &box )
@ -22,7 +36,9 @@ BoxAxisAligned & BoxAxisAligned::operator = ( const BoxAxisAligned &box )
} }
::Utility::DynamicMemory::UniquePointer<ICollideable> BoxAxisAligned::Clone( ) const ::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 bool BoxAxisAligned::Intersects( const ICollideable &target ) const
{ {

View File

@ -74,13 +74,22 @@ namespace PrivateStatic
} }
} }
Frustrum::Frustrum() : ICollideable(Type_frustrum), 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), this->leftPlane = Plane( Float3::standard_unit_x, -0.5f );
nearPlane(Float3::standard_unit_z, -0.5f), farPlane(-Float3::standard_unit_z, 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) 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() {} Frustrum::~Frustrum() {}

View File

@ -6,7 +6,5 @@
using namespace ::Oyster::Collision3D; using namespace ::Oyster::Collision3D;
ICollideable::ICollideable( Type _type ) ICollideable::ICollideable( Type _type ) : type(_type) {}
: type(_type) {}
ICollideable::~ICollideable() {} ICollideable::~ICollideable() {}

View File

@ -8,9 +8,24 @@
using namespace ::Oyster::Collision3D; using namespace ::Oyster::Collision3D;
using namespace ::Oyster::Math3D; using namespace ::Oyster::Math3D;
Line::Line( ) : ICollideable(Type_line), ray(), length(0.0f) {} Line::Line( ) : ICollideable(Type_line)
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) {} 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( ) {}
Line & Line::operator = ( const Line &line ) Line & Line::operator = ( const Line &line )

View File

@ -8,8 +8,18 @@
using namespace ::Oyster::Collision3D; using namespace ::Oyster::Collision3D;
using namespace ::Oyster::Math; using namespace ::Oyster::Math;
Plane::Plane( ) : ICollideable(Type_plane), normal(), phasing(0.0f) {} Plane::Plane( ) : ICollideable(Type_plane)
Plane::Plane( const Float3 &n, const Float &p ) : ICollideable(Type_plane), normal(n), phasing(p) {} {
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( ) {}
Plane & Plane::operator = ( const Plane &plane ) Plane & Plane::operator = ( const Plane &plane )

View File

@ -8,8 +8,16 @@
using namespace ::Oyster::Collision3D; using namespace ::Oyster::Collision3D;
using namespace ::Oyster::Math3D; using namespace ::Oyster::Math3D;
Point::Point( ) : ICollideable(Type_point), center() {} Point::Point( ) : ICollideable(Type_point)
Point::Point( const Float3 &pos ) : ICollideable(Type_point), center(pos) {} {
this->center = Float3::null;
}
Point::Point( const Float3 &pos ) : ICollideable(Type_point)
{
this->center = pos;
}
Point::~Point( ) {} Point::~Point( ) {}
Point & Point::operator = ( const 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 ::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 bool Point::Intersects( const ICollideable &target ) const
{ {

View File

@ -8,8 +8,20 @@
using namespace ::Oyster::Collision3D; using namespace ::Oyster::Collision3D;
using namespace ::Oyster::Math3D; using namespace ::Oyster::Math3D;
Ray::Ray( ) : ICollideable(Type_ray), origin(), direction(), collisionDistance(0.0f) {} Ray::Ray( ) : ICollideable(Type_ray)
Ray::Ray( const Float3 &o, const ::Oyster::Math::Float3 &d ) : ICollideable(Type_ray), origin(o), direction(d), collisionDistance(0.0f) {} {
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( ) {}
Ray & Ray::operator = ( const 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 ::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 bool Ray::Intersects( const ICollideable &target ) const
{ {

View File

@ -4,8 +4,18 @@
using namespace ::Oyster::Collision3D; using namespace ::Oyster::Collision3D;
using namespace ::Oyster::Math; using namespace ::Oyster::Math;
Sphere::Sphere( ) : ICollideable(Type_sphere), center(), radius(0.0f) { } Sphere::Sphere( ) : ICollideable(Type_sphere)
Sphere::Sphere( const Float3 &_position, const Float &_radius ) : ICollideable(Type_sphere), center(_position), radius(_radius) {} {
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( ) {}
Sphere & Sphere::operator = ( const Sphere &sphere ) Sphere & Sphere::operator = ( const Sphere &sphere )