From 3324da528de574840b94ca9b9089877736089bd1 Mon Sep 17 00:00:00 2001 From: Erik Persson Date: Wed, 12 Feb 2014 10:16:00 +0100 Subject: [PATCH] GFERIK - added icollideable cone --- Code/OysterPhysics3D/Cone.cpp | 44 +++++++++++++++++++ Code/OysterPhysics3D/Cone.h | 40 +++++++++++++++++ Code/OysterPhysics3D/ICollideable.h | 3 +- Code/OysterPhysics3D/OysterPhysics3D.vcxproj | 2 + .../OysterPhysics3D.vcxproj.filters | 6 +++ 5 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 Code/OysterPhysics3D/Cone.cpp create mode 100644 Code/OysterPhysics3D/Cone.h diff --git a/Code/OysterPhysics3D/Cone.cpp b/Code/OysterPhysics3D/Cone.cpp new file mode 100644 index 00000000..a336f820 --- /dev/null +++ b/Code/OysterPhysics3D/Cone.cpp @@ -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; +} + diff --git a/Code/OysterPhysics3D/Cone.h b/Code/OysterPhysics3D/Cone.h new file mode 100644 index 00000000..533a1b9c --- /dev/null +++ b/Code/OysterPhysics3D/Cone.h @@ -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 \ No newline at end of file diff --git a/Code/OysterPhysics3D/ICollideable.h b/Code/OysterPhysics3D/ICollideable.h index 3e63200e..1caf23cf 100644 --- a/Code/OysterPhysics3D/ICollideable.h +++ b/Code/OysterPhysics3D/ICollideable.h @@ -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; diff --git a/Code/OysterPhysics3D/OysterPhysics3D.vcxproj b/Code/OysterPhysics3D/OysterPhysics3D.vcxproj index dffeca4f..2998c1bb 100644 --- a/Code/OysterPhysics3D/OysterPhysics3D.vcxproj +++ b/Code/OysterPhysics3D/OysterPhysics3D.vcxproj @@ -154,6 +154,7 @@ + @@ -172,6 +173,7 @@ + diff --git a/Code/OysterPhysics3D/OysterPhysics3D.vcxproj.filters b/Code/OysterPhysics3D/OysterPhysics3D.vcxproj.filters index f6b6d934..4947a4d7 100644 --- a/Code/OysterPhysics3D/OysterPhysics3D.vcxproj.filters +++ b/Code/OysterPhysics3D/OysterPhysics3D.vcxproj.filters @@ -81,6 +81,9 @@ Header Files\Collision + + Header Files\Collision + @@ -131,5 +134,8 @@ Source Files\Physics + + Source Files\Collision + \ No newline at end of file