ICollideable edited
For some reason the Intersects() and Contains() methods were taking a pointer as parameter then I am certain that I wrote it as a &-reference. If someone edited this, there is no GIT history logged about it. Please, DO NOT CHANGE this again, thanks
This commit is contained in:
parent
bc988eff0d
commit
311beaac14
|
@ -31,28 +31,28 @@ Box & Box::operator = ( const Box &box )
|
|||
return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Box(*this) );
|
||||
}
|
||||
|
||||
bool Box::Intersects( const ICollideable *target ) const
|
||||
bool Box::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_universe: return true;
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)target, ((Ray*)target)->collisionDistance );
|
||||
case Type_sphere: return Utility::Intersect( *this, *(Sphere*)target );
|
||||
case Type_plane: return Utility::Intersect( *this, *(Plane*)target );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, ((Ray*)&target)->collisionDistance );
|
||||
case Type_sphere: return Utility::Intersect( *this, *(Sphere*)&target );
|
||||
case Type_plane: return Utility::Intersect( *this, *(Plane*)&target );
|
||||
// case Type_triangle: return false; // TODO: :
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *this, *(BoxAxisAligned*)target );
|
||||
case Type_box: return Utility::Intersect( *this, *(Box*)target );
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *this, *(BoxAxisAligned*)&target );
|
||||
case Type_box: return Utility::Intersect( *this, *(Box*)&target );
|
||||
// case Type_frustrum: return false; // TODO: :
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Box::Contains( const ICollideable *target ) const
|
||||
bool Box::Contains( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target );
|
||||
// case Type_sphere: return false; // TODO:
|
||||
// case Type_triangle: return false; // TODO:
|
||||
// case Type_box_axis_aligned: return false; // TODO:
|
||||
|
|
|
@ -33,8 +33,8 @@ namespace Oyster { namespace Collision3D
|
|||
Box & operator = ( const Box &box );
|
||||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable *target ) const;
|
||||
bool Contains( const ICollideable *target ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
} }
|
||||
|
||||
|
|
|
@ -24,26 +24,26 @@ BoxAxisAligned & BoxAxisAligned::operator = ( const BoxAxisAligned &box )
|
|||
::Utility::DynamicMemory::UniquePointer<ICollideable> BoxAxisAligned::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new BoxAxisAligned(*this) ); }
|
||||
|
||||
bool BoxAxisAligned::Intersects( const ICollideable *target ) const
|
||||
bool BoxAxisAligned::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_universe: return true;
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)target, ((Ray*)target)->collisionDistance );
|
||||
case Type_sphere: return Utility::Intersect( *this, *(Sphere*)target );
|
||||
case Type_plane: return Utility::Intersect( *this, *(Plane*)target );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, ((Ray*)&target)->collisionDistance );
|
||||
case Type_sphere: return Utility::Intersect( *this, *(Sphere*)&target );
|
||||
case Type_plane: return Utility::Intersect( *this, *(Plane*)&target );
|
||||
// case Type_triangle: return false; // TODO:
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *this, *(BoxAxisAligned*)target );
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *this, *(BoxAxisAligned*)&target );
|
||||
// case Type_box: return false; // TODO:
|
||||
// case Type_frustrum: return false; // TODO:
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool BoxAxisAligned::Contains( const ICollideable *target ) const
|
||||
bool BoxAxisAligned::Contains( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
// case Type_point: return false; // TODO:
|
||||
// case Type_sphere: return false; // TODO:
|
||||
|
|
|
@ -28,8 +28,8 @@ namespace Oyster { namespace Collision3D
|
|||
BoxAxisAligned & operator = ( const BoxAxisAligned &box );
|
||||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable *target ) const;
|
||||
bool Contains( const ICollideable *target ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
} }
|
||||
|
||||
|
|
|
@ -191,29 +191,29 @@ void Frustrum::WriteToByte( unsigned int &nextIndex, unsigned char targetMem[] )
|
|||
::Utility::DynamicMemory::UniquePointer<ICollideable> Frustrum::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Frustrum(*this) ); }
|
||||
|
||||
bool Frustrum::Intersects( const ICollideable *target ) const
|
||||
bool Frustrum::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_universe: return true;
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)target, ((Ray*)target)->collisionDistance );
|
||||
case Type_sphere: return Utility::Intersect( *this, *(Sphere*)target );
|
||||
case Type_plane: return Utility::Intersect( *this, *(Plane*)target );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, ((Ray*)&target)->collisionDistance );
|
||||
case Type_sphere: return Utility::Intersect( *this, *(Sphere*)&target );
|
||||
case Type_plane: return Utility::Intersect( *this, *(Plane*)&target );
|
||||
// case Type_triangle: return false; // TODO:
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *this, *(BoxAxisAligned*)target );
|
||||
case Type_box: return Utility::Intersect( *this, *(Box*)target );
|
||||
case Type_frustrum: return Utility::Intersect( *this, *(Frustrum*)target );
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *this, *(BoxAxisAligned*)&target );
|
||||
case Type_box: return Utility::Intersect( *this, *(Box*)&target );
|
||||
case Type_frustrum: return Utility::Intersect( *this, *(Frustrum*)&target );
|
||||
// case Type_line: return false; // TODO:
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Frustrum::Contains( const ICollideable *target ) const
|
||||
bool Frustrum::Contains( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target );
|
||||
// case Type_ray: return false; // TODO:
|
||||
// case Type_sphere: return false; // TODO:
|
||||
// case Type_plane: return false; // TODO:
|
||||
|
|
|
@ -38,8 +38,8 @@ namespace Oyster { namespace Collision3D
|
|||
void WriteToByte( unsigned char targetMem[], unsigned int &nextIndex ) const; /// DEPRECATED
|
||||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable *target ) const;
|
||||
bool Contains( const ICollideable *target ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
|
||||
// INLINE IMPLEMENTATIONS ///////////////////////////////////////
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "Utilities.h"
|
||||
|
||||
namespace Oyster { namespace Collision3D /// Contains a collection of 3D shapes and intercollission algorithms.
|
||||
namespace Oyster { namespace Collision3D //! Contains a collection of 3D shapes and intercollission algorithms.
|
||||
{
|
||||
class ICollideable
|
||||
{
|
||||
|
@ -34,8 +34,8 @@ namespace Oyster { namespace Collision3D /// Contains a collection of 3D shapes
|
|||
virtual ~ICollideable();
|
||||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const = 0;
|
||||
virtual bool Intersects( const ICollideable *target ) const = 0;
|
||||
virtual bool Contains( const ICollideable *target ) const = 0;
|
||||
virtual bool Intersects( const ICollideable &target ) const = 0;
|
||||
virtual bool Contains( const ICollideable &target ) const = 0;
|
||||
};
|
||||
} }
|
||||
#endif
|
|
@ -23,9 +23,9 @@ Line & Line::operator = ( const Line &line )
|
|||
::Utility::DynamicMemory::UniquePointer<ICollideable> Line::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Line(*this) ); }
|
||||
|
||||
bool Line::Intersects( const ICollideable *target ) const
|
||||
bool Line::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
if( target->type == Type_universe )
|
||||
if( target.type == Type_universe )
|
||||
{
|
||||
this->ray.collisionDistance = 0.0f;
|
||||
return true;
|
||||
|
@ -38,5 +38,5 @@ bool Line::Intersects( const ICollideable *target ) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Line::Contains( const ICollideable *target ) const
|
||||
bool Line::Contains( const ICollideable &target ) const
|
||||
{ /* TODO: : */ return false; }
|
||||
|
|
|
@ -29,8 +29,8 @@ namespace Oyster { namespace Collision3D
|
|||
Line & operator = ( const Line &line );
|
||||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable *target ) const;
|
||||
bool Contains( const ICollideable *target ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
} }
|
||||
|
||||
|
|
|
@ -22,31 +22,31 @@ Plane & Plane::operator = ( const Plane &plane )
|
|||
::Utility::DynamicMemory::UniquePointer<ICollideable> Plane::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Plane(*this) ); }
|
||||
|
||||
bool Plane::Intersects( const ICollideable *target ) const
|
||||
bool Plane::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_universe: return true;
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)target, ((Ray*)target)->collisionDistance );
|
||||
case Type_sphere: return Utility::Intersect( *this, *(Sphere*)target );
|
||||
case Type_plane: return Utility::Intersect( *this, *(Plane*)target );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, ((Ray*)&target)->collisionDistance );
|
||||
case Type_sphere: return Utility::Intersect( *this, *(Sphere*)&target );
|
||||
case Type_plane: return Utility::Intersect( *this, *(Plane*)&target );
|
||||
// case Type_triangle: return false; // TODO:
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)target, *this );
|
||||
case Type_box: return Utility::Intersect( *(Box*)target, *this );
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)&target, *this );
|
||||
case Type_box: return Utility::Intersect( *(Box*)&target, *this );
|
||||
case Type_frustrum: return false; // TODO:
|
||||
case Type_line: return false; // TODO:
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Plane::Contains( const ICollideable *target ) const
|
||||
bool Plane::Contains( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target );
|
||||
case Type_ray: return Utility::Contains( *this, *(Ray*)target );
|
||||
case Type_plane: return Utility::Contains( *this, *(Plane*)target );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target );
|
||||
case Type_ray: return Utility::Contains( *this, *(Ray*)&target );
|
||||
case Type_plane: return Utility::Contains( *this, *(Plane*)&target );
|
||||
// case Type_triangle: return false; // TODO:
|
||||
default: return false;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ namespace Oyster { namespace Collision3D
|
|||
Plane & operator = ( const Plane &plane );
|
||||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable *target ) const;
|
||||
bool Contains( const ICollideable *target ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
} }
|
||||
|
||||
|
|
|
@ -21,28 +21,28 @@ Point & Point::operator = ( const Point &point )
|
|||
::Utility::DynamicMemory::UniquePointer<ICollideable> Point::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Point(*this) ); }
|
||||
|
||||
bool Point::Intersects( const ICollideable *target ) const
|
||||
bool Point::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_universe: return true;
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target );
|
||||
case Type_ray: return Utility::Intersect( *(Ray*)target, *this, ((Ray*)target)->collisionDistance );
|
||||
case Type_sphere: Utility::Intersect( *(Sphere*)target, *this );
|
||||
case Type_plane: return Utility::Intersect( *(Plane*)target, *this );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target );
|
||||
case Type_ray: return Utility::Intersect( *(Ray*)&target, *this, ((Ray*)&target)->collisionDistance );
|
||||
case Type_sphere: Utility::Intersect( *(Sphere*)&target, *this );
|
||||
case Type_plane: return Utility::Intersect( *(Plane*)&target, *this );
|
||||
//case Type_triangle: return false; // TODO:
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)target, *this );
|
||||
case Type_box: return Utility::Intersect( *(Box*)target, *this );
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)&target, *this );
|
||||
case Type_box: return Utility::Intersect( *(Box*)&target, *this );
|
||||
case Type_frustrum: return false; // TODO:
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Point::Contains( const ICollideable *target ) const
|
||||
bool Point::Contains( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target );
|
||||
default: return false;
|
||||
}
|
||||
}
|
|
@ -27,8 +27,8 @@ namespace Oyster { namespace Collision3D
|
|||
Point & operator = ( const Point &point );
|
||||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable *target ) const;
|
||||
bool Contains( const ICollideable *target ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
} }
|
||||
|
||||
|
|
|
@ -22,31 +22,31 @@ Ray & Ray::operator = ( const Ray &ray )
|
|||
::Utility::DynamicMemory::UniquePointer<ICollideable> Ray::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Ray(*this) ); }
|
||||
|
||||
bool Ray::Intersects( const ICollideable *target ) const
|
||||
bool Ray::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_universe:
|
||||
this->collisionDistance = 0.0f;
|
||||
return true;
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target, this->collisionDistance );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)target, this->collisionDistance, ((Ray*)target)->collisionDistance );
|
||||
case Type_sphere: return Utility::Intersect( *(Sphere*)target, *this, this->collisionDistance );
|
||||
case Type_plane: return Utility::Intersect( *(Plane*)target, *this, this->collisionDistance );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target, this->collisionDistance );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, this->collisionDistance, ((Ray*)&target)->collisionDistance );
|
||||
case Type_sphere: return Utility::Intersect( *(Sphere*)&target, *this, this->collisionDistance );
|
||||
case Type_plane: return Utility::Intersect( *(Plane*)&target, *this, this->collisionDistance );
|
||||
// case Type_triangle: return false; // TODO:
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)target, *this, this->collisionDistance );
|
||||
case Type_box: return Utility::Intersect( *(Box*)target, *this, this->collisionDistance );
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)&target, *this, this->collisionDistance );
|
||||
case Type_box: return Utility::Intersect( *(Box*)&target, *this, this->collisionDistance );
|
||||
case Type_frustrum: return false; // TODO:
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Ray::Contains( const ICollideable *target ) const
|
||||
bool Ray::Contains( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target, this->collisionDistance );
|
||||
case Type_ray: Utility::Contains( *this, *(Ray*)target );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target, this->collisionDistance );
|
||||
case Type_ray: Utility::Contains( *this, *(Ray*)&target );
|
||||
default: return false;
|
||||
}
|
||||
}
|
|
@ -36,8 +36,8 @@ namespace Oyster { namespace Collision3D
|
|||
Ray & operator = ( const Ray &ray );
|
||||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable *target ) const;
|
||||
bool Contains( const ICollideable *target ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
} }
|
||||
|
||||
|
|
|
@ -18,29 +18,29 @@ Sphere & Sphere::operator = ( const Sphere &sphere )
|
|||
::Utility::DynamicMemory::UniquePointer<ICollideable> Sphere::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Sphere(*this) ); }
|
||||
|
||||
bool Sphere::Intersects( const ICollideable *target ) const
|
||||
bool Sphere::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_universe: return true;
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)target, ((Ray*)target)->collisionDistance );
|
||||
case Type_sphere: Utility::Intersect( *this, *(Sphere*)target );
|
||||
case Type_plane: return Utility::Intersect( *(Plane*)target, *this );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, ((Ray*)&target)->collisionDistance );
|
||||
case Type_sphere: Utility::Intersect( *this, *(Sphere*)&target );
|
||||
case Type_plane: return Utility::Intersect( *(Plane*)&target, *this );
|
||||
// case Type_triangle: return false; // TODO:
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)target, *this );
|
||||
case Type_box: return Utility::Intersect( *(Box*)target, *this );
|
||||
case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)&target, *this );
|
||||
case Type_box: return Utility::Intersect( *(Box*)&target, *this );
|
||||
case Type_frustrum: return false; // TODO:
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Sphere::Contains( const ICollideable *target ) const
|
||||
bool Sphere::Contains( const ICollideable &target ) const
|
||||
{
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)target );
|
||||
case Type_sphere: return Utility::Contains( *this, *(Sphere*)target );
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target );
|
||||
case Type_sphere: return Utility::Contains( *this, *(Sphere*)&target );
|
||||
// case Type_triangle: return false; // TODO:
|
||||
case Type_box_axis_aligned: return false; // TODO:
|
||||
case Type_box: return false; // TODO:
|
||||
|
|
|
@ -27,8 +27,8 @@ namespace Oyster { namespace Collision3D
|
|||
Sphere & operator = ( const Sphere &sphere );
|
||||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable *target ) const;
|
||||
bool Contains( const ICollideable *target ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
} }
|
||||
|
||||
|
|
|
@ -13,15 +13,15 @@ Universe & Universe::operator = ( const Universe &universe )
|
|||
UniquePointer<ICollideable> Universe::Clone( ) const
|
||||
{ return UniquePointer<ICollideable>( new Universe(*this) ); }
|
||||
|
||||
bool Universe::Intersects( const ICollideable *target ) const
|
||||
bool Universe::Intersects( const ICollideable &target ) const
|
||||
{ // universe touches everything
|
||||
switch( target->type )
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_ray:
|
||||
((Ray*)target)->collisionDistance = 0.0f;
|
||||
((Ray*)&target)->collisionDistance = 0.0f;
|
||||
break;
|
||||
case Type_line:
|
||||
((Line*)target)->ray.collisionDistance = 0.0f;
|
||||
((Line*)&target)->ray.collisionDistance = 0.0f;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
@ -29,6 +29,6 @@ bool Universe::Intersects( const ICollideable *target ) const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Universe::Contains( const ICollideable *target ) const
|
||||
bool Universe::Contains( const ICollideable &target ) const
|
||||
{ return true; } // universe contains everything
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ namespace Oyster { namespace Collision3D
|
|||
Universe & operator = ( const Universe &universe );
|
||||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable *target ) const;
|
||||
bool Contains( const ICollideable *target ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
} }
|
||||
|
||||
|
|
Loading…
Reference in New Issue