Danbias/Code/OysterPhysics3D/Universe.cpp

35 lines
827 B
C++
Raw Normal View History

#include "Universe.h"
#include "OysterCollision3D.h"
using namespace ::Oyster::Collision3D;
using namespace ::Utility::DynamicMemory;
Universe::Universe() : ICollideable(Type_universe) {}
Universe::~Universe() {}
Universe & Universe::operator = ( const Universe &universe )
{ return *this; }
UniquePointer<ICollideable> Universe::Clone( ) const
{ return UniquePointer<ICollideable>( new Universe(*this) ); }
bool Universe::Intersects( const ICollideable *target ) const
{ // universe touches everything
switch( target->type )
{
case Type_ray:
((Ray*)target)->collisionDistance = 0.0f;
break;
case Type_line:
((Line*)target)->ray.collisionDistance = 0.0f;
break;
default: break;
}
return true;
}
2013-11-12 00:10:48 +01:00
bool Universe::Contains( const ICollideable *target ) const
{ return true; } // universe contains everything