diff --git a/Code/OysterPhysics3D/Box.cpp b/Code/OysterPhysics3D/Box.cpp index ba97c5c5..e9f04b04 100644 --- a/Code/OysterPhysics3D/Box.cpp +++ b/Code/OysterPhysics3D/Box.cpp @@ -31,28 +31,28 @@ Box & Box::operator = ( const Box &box ) return ::Utility::DynamicMemory::UniquePointer( 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: diff --git a/Code/OysterPhysics3D/Box.h b/Code/OysterPhysics3D/Box.h index ee46d6b6..d40c9f30 100644 --- a/Code/OysterPhysics3D/Box.h +++ b/Code/OysterPhysics3D/Box.h @@ -33,8 +33,8 @@ namespace Oyster { namespace Collision3D Box & operator = ( const Box &box ); virtual ::Utility::DynamicMemory::UniquePointer 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; }; } } diff --git a/Code/OysterPhysics3D/BoxAxisAligned.cpp b/Code/OysterPhysics3D/BoxAxisAligned.cpp index 04bc53f1..bdd9d0a9 100644 --- a/Code/OysterPhysics3D/BoxAxisAligned.cpp +++ b/Code/OysterPhysics3D/BoxAxisAligned.cpp @@ -24,26 +24,26 @@ BoxAxisAligned & BoxAxisAligned::operator = ( const BoxAxisAligned &box ) ::Utility::DynamicMemory::UniquePointer BoxAxisAligned::Clone( ) const { return ::Utility::DynamicMemory::UniquePointer( 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: diff --git a/Code/OysterPhysics3D/BoxAxisAligned.h b/Code/OysterPhysics3D/BoxAxisAligned.h index 9810c39a..a0e109b2 100644 --- a/Code/OysterPhysics3D/BoxAxisAligned.h +++ b/Code/OysterPhysics3D/BoxAxisAligned.h @@ -28,8 +28,8 @@ namespace Oyster { namespace Collision3D BoxAxisAligned & operator = ( const BoxAxisAligned &box ); virtual ::Utility::DynamicMemory::UniquePointer 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; }; } } diff --git a/Code/OysterPhysics3D/Frustrum.cpp b/Code/OysterPhysics3D/Frustrum.cpp index 9e45f579..a826a4e0 100644 --- a/Code/OysterPhysics3D/Frustrum.cpp +++ b/Code/OysterPhysics3D/Frustrum.cpp @@ -191,29 +191,29 @@ void Frustrum::WriteToByte( unsigned int &nextIndex, unsigned char targetMem[] ) ::Utility::DynamicMemory::UniquePointer Frustrum::Clone( ) const { return ::Utility::DynamicMemory::UniquePointer( 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: diff --git a/Code/OysterPhysics3D/Frustrum.h b/Code/OysterPhysics3D/Frustrum.h index c711c9af..afd8d8bd 100644 --- a/Code/OysterPhysics3D/Frustrum.h +++ b/Code/OysterPhysics3D/Frustrum.h @@ -38,8 +38,8 @@ namespace Oyster { namespace Collision3D void WriteToByte( unsigned char targetMem[], unsigned int &nextIndex ) const; /// DEPRECATED virtual ::Utility::DynamicMemory::UniquePointer 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 /////////////////////////////////////// diff --git a/Code/OysterPhysics3D/ICollideable.h b/Code/OysterPhysics3D/ICollideable.h index 4b620506..34a86f7b 100644 --- a/Code/OysterPhysics3D/ICollideable.h +++ b/Code/OysterPhysics3D/ICollideable.h @@ -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 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 \ No newline at end of file diff --git a/Code/OysterPhysics3D/Line.cpp b/Code/OysterPhysics3D/Line.cpp index 7093f6b2..6258c9d9 100644 --- a/Code/OysterPhysics3D/Line.cpp +++ b/Code/OysterPhysics3D/Line.cpp @@ -23,9 +23,9 @@ Line & Line::operator = ( const Line &line ) ::Utility::DynamicMemory::UniquePointer Line::Clone( ) const { return ::Utility::DynamicMemory::UniquePointer( 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; } diff --git a/Code/OysterPhysics3D/Line.h b/Code/OysterPhysics3D/Line.h index fecc0bd2..f062c0dc 100644 --- a/Code/OysterPhysics3D/Line.h +++ b/Code/OysterPhysics3D/Line.h @@ -29,8 +29,8 @@ namespace Oyster { namespace Collision3D Line & operator = ( const Line &line ); virtual ::Utility::DynamicMemory::UniquePointer 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; }; } } diff --git a/Code/OysterPhysics3D/Plane.cpp b/Code/OysterPhysics3D/Plane.cpp index d495584c..48a76883 100644 --- a/Code/OysterPhysics3D/Plane.cpp +++ b/Code/OysterPhysics3D/Plane.cpp @@ -22,31 +22,31 @@ Plane & Plane::operator = ( const Plane &plane ) ::Utility::DynamicMemory::UniquePointer Plane::Clone( ) const { return ::Utility::DynamicMemory::UniquePointer( 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; } diff --git a/Code/OysterPhysics3D/Plane.h b/Code/OysterPhysics3D/Plane.h index d44c92bd..b69c5c9f 100644 --- a/Code/OysterPhysics3D/Plane.h +++ b/Code/OysterPhysics3D/Plane.h @@ -28,8 +28,8 @@ namespace Oyster { namespace Collision3D Plane & operator = ( const Plane &plane ); virtual ::Utility::DynamicMemory::UniquePointer 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; }; } } diff --git a/Code/OysterPhysics3D/Point.cpp b/Code/OysterPhysics3D/Point.cpp index bf1057f3..a100359b 100644 --- a/Code/OysterPhysics3D/Point.cpp +++ b/Code/OysterPhysics3D/Point.cpp @@ -21,28 +21,28 @@ Point & Point::operator = ( const Point &point ) ::Utility::DynamicMemory::UniquePointer Point::Clone( ) const { return ::Utility::DynamicMemory::UniquePointer( 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; } } \ No newline at end of file diff --git a/Code/OysterPhysics3D/Point.h b/Code/OysterPhysics3D/Point.h index 2529ae0c..42561909 100644 --- a/Code/OysterPhysics3D/Point.h +++ b/Code/OysterPhysics3D/Point.h @@ -27,8 +27,8 @@ namespace Oyster { namespace Collision3D Point & operator = ( const Point &point ); virtual ::Utility::DynamicMemory::UniquePointer 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; }; } } diff --git a/Code/OysterPhysics3D/Ray.cpp b/Code/OysterPhysics3D/Ray.cpp index 1983a9ba..6d501335 100644 --- a/Code/OysterPhysics3D/Ray.cpp +++ b/Code/OysterPhysics3D/Ray.cpp @@ -22,31 +22,31 @@ Ray & Ray::operator = ( const Ray &ray ) ::Utility::DynamicMemory::UniquePointer Ray::Clone( ) const { return ::Utility::DynamicMemory::UniquePointer( 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; } } \ No newline at end of file diff --git a/Code/OysterPhysics3D/Ray.h b/Code/OysterPhysics3D/Ray.h index 4132c0b8..5f24ea81 100644 --- a/Code/OysterPhysics3D/Ray.h +++ b/Code/OysterPhysics3D/Ray.h @@ -36,8 +36,8 @@ namespace Oyster { namespace Collision3D Ray & operator = ( const Ray &ray ); virtual ::Utility::DynamicMemory::UniquePointer 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; }; } } diff --git a/Code/OysterPhysics3D/Sphere.cpp b/Code/OysterPhysics3D/Sphere.cpp index 324abeeb..e30ad384 100644 --- a/Code/OysterPhysics3D/Sphere.cpp +++ b/Code/OysterPhysics3D/Sphere.cpp @@ -18,29 +18,29 @@ Sphere & Sphere::operator = ( const Sphere &sphere ) ::Utility::DynamicMemory::UniquePointer Sphere::Clone( ) const { return ::Utility::DynamicMemory::UniquePointer( 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: diff --git a/Code/OysterPhysics3D/Sphere.h b/Code/OysterPhysics3D/Sphere.h index 881c8928..8e73de0b 100644 --- a/Code/OysterPhysics3D/Sphere.h +++ b/Code/OysterPhysics3D/Sphere.h @@ -27,8 +27,8 @@ namespace Oyster { namespace Collision3D Sphere & operator = ( const Sphere &sphere ); virtual ::Utility::DynamicMemory::UniquePointer 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; }; } } diff --git a/Code/OysterPhysics3D/Universe.cpp b/Code/OysterPhysics3D/Universe.cpp index f473ff2c..725e2839 100644 --- a/Code/OysterPhysics3D/Universe.cpp +++ b/Code/OysterPhysics3D/Universe.cpp @@ -13,15 +13,15 @@ Universe & Universe::operator = ( const Universe &universe ) UniquePointer Universe::Clone( ) const { return UniquePointer( 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 diff --git a/Code/OysterPhysics3D/Universe.h b/Code/OysterPhysics3D/Universe.h index fd06a454..ff8366be 100644 --- a/Code/OysterPhysics3D/Universe.h +++ b/Code/OysterPhysics3D/Universe.h @@ -19,8 +19,8 @@ namespace Oyster { namespace Collision3D Universe & operator = ( const Universe &universe ); virtual ::Utility::DynamicMemory::UniquePointer 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; }; } }