diff --git a/Code/OysterMath/Matrix.h b/Code/OysterMath/Matrix.h index c5c8735e..c7b6b9e0 100644 --- a/Code/OysterMath/Matrix.h +++ b/Code/OysterMath/Matrix.h @@ -29,7 +29,7 @@ namespace LinearAlgebra Matrix2x2( ); Matrix2x2( const ScalarType &m11, const ScalarType &m12, const ScalarType &m21, const ScalarType &m22 ); - Matrix2x2( const Vector2 vec[2] ); + explicit Matrix2x2( const Vector2 vec[2] ); Matrix2x2( const Vector2 &vec1, const Vector2 &vec2 ); explicit Matrix2x2( const ScalarType element[4] ); Matrix2x2( const Matrix2x2 &matrix ); @@ -80,7 +80,7 @@ namespace LinearAlgebra Matrix3x3( const ScalarType &m11, const ScalarType &m12, const ScalarType &m13, const ScalarType &m21, const ScalarType &m22, const ScalarType &m23, const ScalarType &m31, const ScalarType &m32, const ScalarType &m33 ); - Matrix3x3( const Vector3 vec[3] ); + explicit Matrix3x3( const Vector3 vec[3] ); Matrix3x3( const Vector3 &vec1, const Vector3 &vec2, const Vector3 &vec3 ); explicit Matrix3x3( const ScalarType element[9] ); Matrix3x3( const Matrix3x3 &matrix ); @@ -132,7 +132,7 @@ namespace LinearAlgebra const ScalarType &m21, const ScalarType &m22, const ScalarType &m23, const ScalarType &m24, const ScalarType &m31, const ScalarType &m32, const ScalarType &m33, const ScalarType &m34, const ScalarType &m41, const ScalarType &m42, const ScalarType &m43, const ScalarType &m44 ); - Matrix4x4( const Vector4 vec[4] ); + explicit Matrix4x4( const Vector4 vec[4] ); Matrix4x4( const Vector4 &vec1, const Vector4 &vec2, const Vector4 &vec3, const Vector4 &vec4 ); explicit Matrix4x4( const ScalarType element[16] ); Matrix4x4( const Matrix4x4 &matrix ); diff --git a/Code/OysterPhysics3D/Box.cpp b/Code/OysterPhysics3D/Box.cpp index e9f04b04..382c6732 100644 --- a/Code/OysterPhysics3D/Box.cpp +++ b/Code/OysterPhysics3D/Box.cpp @@ -8,13 +8,19 @@ using namespace ::Oyster::Collision3D; using namespace ::Oyster::Math3D; -Box::Box( ) - : ICollideable(Type_box), rotation(Float4x4::identity), center(0.0f), boundingOffset(0.5f) -{} +Box::Box( ) : ICollideable(Type_box) +{ + this->rotation = Float4x4::identity; + this->center =0.0f; + this->boundingOffset = Float3(0.5f); +} -Box::Box( const Float4x4 &r, const Float3 &p, const Float3 &s ) - : ICollideable(Type_box), rotation(r), center(p), boundingOffset(s*0.5) -{} +Box::Box( const Float4x4 &r, const Float3 &p, const Float3 &s ) : ICollideable(Type_box) +{ + this->rotation = r; + this->center = p; + this->boundingOffset = Float3(s*0.5); +} Box::~Box( ) {} diff --git a/Code/OysterPhysics3D/BoxAxisAligned.cpp b/Code/OysterPhysics3D/BoxAxisAligned.cpp index bdd9d0a9..f50f4b6d 100644 --- a/Code/OysterPhysics3D/BoxAxisAligned.cpp +++ b/Code/OysterPhysics3D/BoxAxisAligned.cpp @@ -8,10 +8,24 @@ using namespace ::Oyster::Collision3D; using namespace ::Oyster::Math3D; -BoxAxisAligned::BoxAxisAligned( ) : ICollideable(Type_box_axis_aligned), minVertex(-0.5f,-0.5f,-0.5f), maxVertex(0.5f,0.5f,0.5f) {} -BoxAxisAligned::BoxAxisAligned( const Float3 &_minVertex, const Float3 &_maxVertex ) : ICollideable(Type_box_axis_aligned), minVertex(_minVertex), maxVertex(_maxVertex) {} -BoxAxisAligned::BoxAxisAligned( const Float &leftClip, const Float &rightClip, const Float &topClip, const Float &bottomClip, const Float &nearClip, const Float &farClip ) - : ICollideable(Type_box_axis_aligned), minVertex(leftClip, bottomClip, nearClip), maxVertex(rightClip, topClip, farClip) {} +BoxAxisAligned::BoxAxisAligned( ) : ICollideable(Type_box_axis_aligned) +{ + this->minVertex = Float3(-0.5f,-0.5f,-0.5f ); + this->maxVertex = Float3( 0.5f, 0.5f, 0.5f ); +} + +BoxAxisAligned::BoxAxisAligned( const Float3 &_minVertex, const Float3 &_maxVertex ) : ICollideable(Type_box_axis_aligned) +{ + this->minVertex = _minVertex; + this->maxVertex = _maxVertex; +} + +BoxAxisAligned::BoxAxisAligned( const Float &leftClip, const Float &rightClip, const Float &topClip, const Float &bottomClip, const Float &nearClip, const Float &farClip ) : ICollideable(Type_box_axis_aligned) +{ + this->minVertex = Float3( leftClip, bottomClip, nearClip ); + this->maxVertex = Float3( rightClip, topClip, farClip ); +} + BoxAxisAligned::~BoxAxisAligned( ) {} BoxAxisAligned & BoxAxisAligned::operator = ( const BoxAxisAligned &box ) @@ -22,7 +36,9 @@ BoxAxisAligned & BoxAxisAligned::operator = ( const BoxAxisAligned &box ) } ::Utility::DynamicMemory::UniquePointer BoxAxisAligned::Clone( ) const -{ return ::Utility::DynamicMemory::UniquePointer( new BoxAxisAligned(*this) ); } +{ + return ::Utility::DynamicMemory::UniquePointer( new BoxAxisAligned(*this) ); +} bool BoxAxisAligned::Intersects( const ICollideable &target ) const { diff --git a/Code/OysterPhysics3D/Frustrum.cpp b/Code/OysterPhysics3D/Frustrum.cpp index a826a4e0..7099c2ce 100644 --- a/Code/OysterPhysics3D/Frustrum.cpp +++ b/Code/OysterPhysics3D/Frustrum.cpp @@ -74,13 +74,22 @@ namespace PrivateStatic } } -Frustrum::Frustrum() : ICollideable(Type_frustrum), - leftPlane(Float3::standard_unit_x, -0.5f), rightPlane(-Float3::standard_unit_x, 0.5f), - bottomPlane(Float3::standard_unit_y, -0.5f), topPlane(-Float3::standard_unit_y, 0.5f), - nearPlane(Float3::standard_unit_z, -0.5f), farPlane(-Float3::standard_unit_z, 0.5f) {} +Frustrum::Frustrum() : ICollideable(Type_frustrum) +{ + this->leftPlane = Plane( Float3::standard_unit_x, -0.5f ); + this->rightPlane = Plane(-Float3::standard_unit_x, 0.5f ), + this->bottomPlane = Plane( Float3::standard_unit_y, -0.5f ); + this->topPlane = Plane(-Float3::standard_unit_y, 0.5f ); + this->nearPlane = Plane( Float3::standard_unit_z, -0.5f ); + this->farPlane = Plane(-Float3::standard_unit_z, 0.5f ); +} Frustrum::Frustrum( const Float4x4 &vp ) : ICollideable(Type_frustrum) -{ PrivateStatic::VP_ToPlanes( this->leftPlane, this->rightPlane, this->bottomPlane, this->topPlane, this->nearPlane, this->farPlane, vp ); } +{ + PrivateStatic::VP_ToPlanes( this->leftPlane, this->rightPlane, this->bottomPlane, + this->topPlane, this->nearPlane, this->farPlane, + vp ); +} Frustrum::~Frustrum() {} diff --git a/Code/OysterPhysics3D/ICollideable.cpp b/Code/OysterPhysics3D/ICollideable.cpp index 89effa36..b0af99e4 100644 --- a/Code/OysterPhysics3D/ICollideable.cpp +++ b/Code/OysterPhysics3D/ICollideable.cpp @@ -6,7 +6,5 @@ using namespace ::Oyster::Collision3D; -ICollideable::ICollideable( Type _type ) - : type(_type) {} - +ICollideable::ICollideable( Type _type ) : type(_type) {} ICollideable::~ICollideable() {} \ No newline at end of file diff --git a/Code/OysterPhysics3D/Line.cpp b/Code/OysterPhysics3D/Line.cpp index 6258c9d9..17fe55f7 100644 --- a/Code/OysterPhysics3D/Line.cpp +++ b/Code/OysterPhysics3D/Line.cpp @@ -8,9 +8,24 @@ using namespace ::Oyster::Collision3D; using namespace ::Oyster::Math3D; -Line::Line( ) : ICollideable(Type_line), ray(), length(0.0f) {} -Line::Line( const class Ray &_ray, const Float &_length ) : ICollideable(Type_line), ray(_ray), length(_length) {} -Line::Line( const Float3 &origin, const Float3 &normalizedDirection, const Float &_length ) : ICollideable(Type_line), ray(origin, normalizedDirection), length(_length) {} +Line::Line( ) : ICollideable(Type_line) +{ + this->ray = Ray(); + this->length = 0.0f; +} + +Line::Line( const class Ray &_ray, const Float &_length ) : ICollideable(Type_line) +{ + this->ray = _ray; + this->length = _length; +} + +Line::Line( const Float3 &origin, const Float3 &normalizedDirection, const Float &_length ) : ICollideable(Type_line) +{ + this->ray = Ray( origin, normalizedDirection ); + this->length = _length; +} + Line::~Line( ) {} Line & Line::operator = ( const Line &line ) diff --git a/Code/OysterPhysics3D/Plane.cpp b/Code/OysterPhysics3D/Plane.cpp index 48a76883..a1a16b14 100644 --- a/Code/OysterPhysics3D/Plane.cpp +++ b/Code/OysterPhysics3D/Plane.cpp @@ -8,8 +8,18 @@ using namespace ::Oyster::Collision3D; using namespace ::Oyster::Math; -Plane::Plane( ) : ICollideable(Type_plane), normal(), phasing(0.0f) {} -Plane::Plane( const Float3 &n, const Float &p ) : ICollideable(Type_plane), normal(n), phasing(p) {} +Plane::Plane( ) : ICollideable(Type_plane) +{ + this->normal = Float3::standard_unit_z; + this->phasing = 0.0f; +} + +Plane::Plane( const Float3 &n, const Float &p ) : ICollideable(Type_plane) +{ + this->normal = n; + this->phasing = p; +} + Plane::~Plane( ) {} Plane & Plane::operator = ( const Plane &plane ) diff --git a/Code/OysterPhysics3D/Point.cpp b/Code/OysterPhysics3D/Point.cpp index a100359b..cf1186c9 100644 --- a/Code/OysterPhysics3D/Point.cpp +++ b/Code/OysterPhysics3D/Point.cpp @@ -8,8 +8,16 @@ using namespace ::Oyster::Collision3D; using namespace ::Oyster::Math3D; -Point::Point( ) : ICollideable(Type_point), center() {} -Point::Point( const Float3 &pos ) : ICollideable(Type_point), center(pos) {} +Point::Point( ) : ICollideable(Type_point) +{ + this->center = Float3::null; +} + +Point::Point( const Float3 &pos ) : ICollideable(Type_point) +{ + this->center = pos; +} + Point::~Point( ) {} Point & Point::operator = ( const Point &point ) @@ -19,7 +27,9 @@ Point & Point::operator = ( const Point &point ) } ::Utility::DynamicMemory::UniquePointer Point::Clone( ) const -{ return ::Utility::DynamicMemory::UniquePointer( new Point(*this) ); } +{ + return ::Utility::DynamicMemory::UniquePointer( new Point(*this) ); +} bool Point::Intersects( const ICollideable &target ) const { diff --git a/Code/OysterPhysics3D/Ray.cpp b/Code/OysterPhysics3D/Ray.cpp index 6d501335..09fb13ec 100644 --- a/Code/OysterPhysics3D/Ray.cpp +++ b/Code/OysterPhysics3D/Ray.cpp @@ -8,8 +8,20 @@ using namespace ::Oyster::Collision3D; using namespace ::Oyster::Math3D; -Ray::Ray( ) : ICollideable(Type_ray), origin(), direction(), collisionDistance(0.0f) {} -Ray::Ray( const Float3 &o, const ::Oyster::Math::Float3 &d ) : ICollideable(Type_ray), origin(o), direction(d), collisionDistance(0.0f) {} +Ray::Ray( ) : ICollideable(Type_ray) +{ + this->origin = Float3::null; + this->direction = Float3::standard_unit_z; + this->collisionDistance = 0.0f; +} + +Ray::Ray( const Float3 &o, const ::Oyster::Math::Float3 &d ) : ICollideable(Type_ray) +{ + this->origin = o; + this->direction = d; + this->collisionDistance = 0.0f; +} + Ray::~Ray( ) {} Ray & Ray::operator = ( const Ray &ray ) @@ -20,7 +32,9 @@ Ray & Ray::operator = ( const Ray &ray ) } ::Utility::DynamicMemory::UniquePointer Ray::Clone( ) const -{ return ::Utility::DynamicMemory::UniquePointer( new Ray(*this) ); } +{ + return ::Utility::DynamicMemory::UniquePointer( new Ray(*this) ); +} bool Ray::Intersects( const ICollideable &target ) const { diff --git a/Code/OysterPhysics3D/Sphere.cpp b/Code/OysterPhysics3D/Sphere.cpp index e30ad384..0cc8bc3b 100644 --- a/Code/OysterPhysics3D/Sphere.cpp +++ b/Code/OysterPhysics3D/Sphere.cpp @@ -4,8 +4,18 @@ using namespace ::Oyster::Collision3D; using namespace ::Oyster::Math; -Sphere::Sphere( ) : ICollideable(Type_sphere), center(), radius(0.0f) { } -Sphere::Sphere( const Float3 &_position, const Float &_radius ) : ICollideable(Type_sphere), center(_position), radius(_radius) {} +Sphere::Sphere( ) : ICollideable(Type_sphere) +{ + this->center = Float3::null; + this->radius = 0.0f; +} + +Sphere::Sphere( const Float3 &_position, const Float &_radius ) : ICollideable(Type_sphere) +{ + this->center = _position; + this->radius = _radius; +} + Sphere::~Sphere( ) {} Sphere & Sphere::operator = ( const Sphere &sphere )