From c78cc95284d9f352cfd05f7b32660c0206048ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 6 Sep 2012 19:31:54 +0200 Subject: [PATCH] Physics: Moved Point constructor to source file. Point has virtual functions, this avoids creating vtable for it in every compilation unit. --- src/Physics/CMakeLists.txt | 1 + src/Physics/Point.cpp | 26 ++++++++++++++++++++++++++ src/Physics/Point.h | 6 ++---- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 src/Physics/Point.cpp diff --git a/src/Physics/CMakeLists.txt b/src/Physics/CMakeLists.txt index 8201d490b..a42842084 100644 --- a/src/Physics/CMakeLists.txt +++ b/src/Physics/CMakeLists.txt @@ -4,6 +4,7 @@ set(MagnumPhysics_SRCS Capsule.cpp Line.cpp Plane.cpp + Point.cpp ShapeGroup.cpp Sphere.cpp) set(MagnumPhysics_HEADERS diff --git a/src/Physics/Point.cpp b/src/Physics/Point.cpp new file mode 100644 index 000000000..eef45829f --- /dev/null +++ b/src/Physics/Point.cpp @@ -0,0 +1,26 @@ +/* + Copyright © 2010, 2011, 2012 Vladimír Vondruš + + This file is part of Magnum. + + Magnum is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 3 + only, as published by the Free Software Foundation. + + Magnum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License version 3 for more details. +*/ + +#include "Point.h" + +#include "Math/Matrix4.h" + +namespace Magnum { namespace Physics { + +void Point::applyTransformation(const Matrix4& transformation) { + _transformedPosition = (transformation*Vector4(_position)).xyz(); +} + +}} diff --git a/src/Physics/Point.h b/src/Physics/Point.h index 80e465fbc..32f5e5d4b 100644 --- a/src/Physics/Point.h +++ b/src/Physics/Point.h @@ -24,14 +24,12 @@ namespace Magnum { namespace Physics { /** @brief %Point */ -class Point: public AbstractShape { +class PHYSICS_EXPORT Point: public AbstractShape { public: /** @brief Constructor */ inline Point(const Vector3& position): _position(position), _transformedPosition(position) {} - inline void applyTransformation(const Matrix4& transformation) { - _transformedPosition = (transformation*Vector4(_position)).xyz(); - } + void applyTransformation(const Matrix4& transformation); /** @brief Position */ inline Vector3 position() const { return _position; }