GFERIK - added icollideable cone

This commit is contained in:
Erik Persson 2014-02-12 10:16:00 +01:00
parent 7541994419
commit 3324da528d
5 changed files with 94 additions and 1 deletions

View File

@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////
// Created by Erik Persson 2014
/////////////////////////////////////////////////////////////////////
#include "Cone.h"
#include "OysterCollision3D.h"
using namespace ::Oyster::Collision3D;
using namespace ::Oyster::Math3D;
Cone::Cone( ) : ICollideable(Type_cone)
{
this->radius = 1;
this->height = Oyster::Math::Float3(0,0,0);
}
Cone::Cone( const ::Oyster::Math::Float3 &height, const Oyster::Math::Float3 &position, const ::Oyster::Math::Float &radius )
{
this->radius = radius;
this->height = height;
this->position = position;
}
Cone::Cone( const ::Oyster::Math::Float4 &height, const Oyster::Math::Float4 &position, const ::Oyster::Math::Float &radius )
{
this->radius = radius;
this->height = (Oyster::Math::Float3)height;
this->position = (Oyster::Math::Float3)position;
}
Cone::~Cone( )
{
}
Cone & Cone::operator = ( const Cone &cone )
{
this->radius = cone.radius;
this->height = cone.height;
this->position = cone.position;
return *this;
}

View File

@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////
// Created by Erik Persson 2014
/////////////////////////////////////////////////////////////////////
#pragma once
#ifndef OYSTER_COLLISION_3D_CONE_H
#define OYSTER_COLLISION_3D_CONE_H
#include "OysterMath.h"
#include "ICollideable.h"
namespace Oyster
{
namespace Collision3D
{
class Cone : public ICollideable
{
public:
Cone();
Cone( const ::Oyster::Math::Float3 &height, const Oyster::Math::Float3 &position, const ::Oyster::Math::Float &radius );
Cone( const ::Oyster::Math::Float4 &height, const Oyster::Math::Float4 &position, const ::Oyster::Math::Float &radius );
virtual ~Cone( );
Cone & operator = ( const Cone &Cone );
private:
Oyster::Math::Float3 height;
Oyster::Math::Float3 position;
Oyster::Math::Float radius;
};
}
}
#endif

View File

@ -26,7 +26,8 @@ namespace Oyster { namespace Collision3D //! Contains a collection of 3D shapes
Type_box_axis_aligned,
Type_box,
Type_frustrum,
Type_line
Type_line,
Type_cone,
};
const Type type;

View File

@ -154,6 +154,7 @@
<ClInclude Include="BoxAxisAligned.h" />
<ClInclude Include="FluidDrag.h" />
<ClInclude Include="Frustrum.h" />
<ClInclude Include="Cone.h" />
<ClInclude Include="ICollideable.h" />
<ClInclude Include="Inertia.h" />
<ClInclude Include="Line.h" />
@ -172,6 +173,7 @@
<ItemGroup>
<ClCompile Include="Box.cpp" />
<ClCompile Include="BoxAxisAligned.cpp" />
<ClCompile Include="Cone.cpp" />
<ClCompile Include="FluidDrag.cpp" />
<ClCompile Include="Frustrum.cpp" />
<ClCompile Include="ICollideable.cpp" />

View File

@ -81,6 +81,9 @@
<ClInclude Include="Universe.h">
<Filter>Header Files\Collision</Filter>
</ClInclude>
<ClInclude Include="Cone.h">
<Filter>Header Files\Collision</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Box.cpp">
@ -131,5 +134,8 @@
<ClCompile Include="Inertia.cpp">
<Filter>Source Files\Physics</Filter>
</ClCompile>
<ClCompile Include="Cone.cpp">
<Filter>Source Files\Collision</Filter>
</ClCompile>
</ItemGroup>
</Project>