Browse Source

Physics: Moved Point constructor to source file.

Point has virtual functions, this avoids creating vtable for it in every
compilation unit.
vectorfields
Vladimír Vondruš 14 years ago
parent
commit
c78cc95284
  1. 1
      src/Physics/CMakeLists.txt
  2. 26
      src/Physics/Point.cpp
  3. 6
      src/Physics/Point.h

1
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

26
src/Physics/Point.cpp

@ -0,0 +1,26 @@
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
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();
}
}}

6
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; }

Loading…
Cancel
Save