compile errors fixed
This commit is contained in:
parent
dbb0c38432
commit
96bf20e5ae
|
@ -671,14 +671,14 @@ namespace Oyster { namespace Collision3D { namespace Utility
|
||||||
|
|
||||||
bool Intersect( const BoxAxisAligned &box, const Sphere &sphere, Float4 &worldPointOfContact )
|
bool Intersect( const BoxAxisAligned &box, const Sphere &sphere, Float4 &worldPointOfContact )
|
||||||
{ // by Robin Engman
|
{ // by Robin Engman
|
||||||
|
if( Intersect(box, sphere) )
|
||||||
if(Intersect(box, sphere))
|
|
||||||
{
|
{
|
||||||
Float distance;
|
Float distance;
|
||||||
Float3 boxMiddle = (box.maxVertex - box.minVertex)*0.5f;
|
Float4 boxMiddle = (box.maxVertex - box.minVertex) * 0.5f;
|
||||||
Ray ray(boxMiddle, Float3(sphere.center - boxMiddle).Normalize());
|
Ray ray( boxMiddle, (sphere.center - boxMiddle).Normalize() );
|
||||||
Intersect( sphere, ray, distance );
|
Intersect( sphere, ray, distance );
|
||||||
worldPointOfContact = ray.origin + ray.direction * distance;
|
worldPointOfContact = ray.origin + ray.direction * distance;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -784,10 +784,11 @@ namespace Oyster { namespace Collision3D { namespace Utility
|
||||||
if( Intersect(box, sphere) )
|
if( Intersect(box, sphere) )
|
||||||
{
|
{
|
||||||
Float distance;
|
Float distance;
|
||||||
Ray ray( sphere.center, Float3(box.center - sphere.center) );
|
Ray ray( sphere.center, box.center - sphere.center );
|
||||||
|
|
||||||
Intersect( box, ray, distance );
|
Intersect( box, ray, distance );
|
||||||
worldPointOfContact = ray.origin + ray.direction*distance;
|
worldPointOfContact = ray.origin + ray.direction*distance;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -22,6 +22,13 @@ Ray::Ray( const Float3 &o, const Float3 &d ) : ICollideable(Type_ray)
|
||||||
this->collisionDistance = 0.0f;
|
this->collisionDistance = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ray::Ray( const Float4 &o, const Float4 &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 )
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace Oyster { namespace Collision3D
|
||||||
|
|
||||||
Ray( );
|
Ray( );
|
||||||
Ray( const ::Oyster::Math::Float3 &origin, const ::Oyster::Math::Float3 &normalizedDirection );
|
Ray( const ::Oyster::Math::Float3 &origin, const ::Oyster::Math::Float3 &normalizedDirection );
|
||||||
|
Ray( const ::Oyster::Math::Float4 &origin, const ::Oyster::Math::Float4 &normalizedDirection );
|
||||||
virtual ~Ray( );
|
virtual ~Ray( );
|
||||||
|
|
||||||
Ray & operator = ( const Ray &ray );
|
Ray & operator = ( const Ray &ray );
|
||||||
|
|
Loading…
Reference in New Issue