Browse Source

SceneGraph: removed redundant `inline` keyword.

pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
d3c37a3962
  1. 2
      doc/scenegraph.dox
  2. 14
      src/SceneGraph/AbstractCamera.h
  3. 4
      src/SceneGraph/AbstractCamera.hpp
  4. 18
      src/SceneGraph/AbstractFeature.h
  5. 8
      src/SceneGraph/AbstractGroupedFeature.h
  6. 10
      src/SceneGraph/AbstractObject.h
  7. 22
      src/SceneGraph/Animable.h
  8. 4
      src/SceneGraph/AnimableGroup.h
  9. 2
      src/SceneGraph/Camera2D.h
  10. 6
      src/SceneGraph/Camera3D.h
  11. 2
      src/SceneGraph/Drawable.h
  12. 26
      src/SceneGraph/DualComplexTransformation.h
  13. 30
      src/SceneGraph/DualQuaternionTransformation.h
  14. 8
      src/SceneGraph/FeatureGroup.h
  15. 26
      src/SceneGraph/MatrixTransformation2D.h
  16. 30
      src/SceneGraph/MatrixTransformation3D.h
  17. 34
      src/SceneGraph/Object.h
  18. 4
      src/SceneGraph/Object.hpp
  19. 28
      src/SceneGraph/RigidMatrixTransformation2D.h
  20. 32
      src/SceneGraph/RigidMatrixTransformation3D.h
  21. 2
      src/SceneGraph/Scene.h
  22. 2
      src/SceneGraph/Test/CameraTest.cpp
  23. 2
      src/SceneGraph/Test/ObjectTest.cpp

2
doc/scenegraph.dox

@ -151,7 +151,7 @@ Simplified example:
@code
class Bomb: public Object3D, SceneGraph::Drawable3D<>, SceneGraph:.Animable3D<> {
public:
inline Bomb(Object3D* parent): Object3D(parent), SceneGraph::Drawable3D<>(this), SceneGraph::Animable3D<>(this) {}
Bomb(Object3D* parent): Object3D(parent), SceneGraph::Drawable3D<>(this), SceneGraph::Animable3D<>(this) {}
protected:
// drawing implementation for Drawable feature

14
src/SceneGraph/AbstractCamera.h

@ -88,7 +88,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature<dimensions
virtual ~AbstractCamera() = 0;
/** @brief Aspect ratio policy */
inline AspectRatioPolicy aspectRatioPolicy() const { return _aspectRatioPolicy; }
AspectRatioPolicy aspectRatioPolicy() const { return _aspectRatioPolicy; }
/**
* @brief Set aspect ratio policy
@ -102,7 +102,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature<dimensions
* Camera matrix describes world position relative to the camera and is
* applied as first.
*/
inline typename DimensionTraits<dimensions, T>::MatrixType cameraMatrix() {
typename DimensionTraits<dimensions, T>::MatrixType cameraMatrix() {
AbstractFeature<dimensions, T>::object()->setClean();
return _cameraMatrix;
}
@ -114,7 +114,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature<dimensions
* as last.
* @see projectionSize()
*/
inline typename DimensionTraits<dimensions, T>::MatrixType projectionMatrix() const { return _projectionMatrix; }
typename DimensionTraits<dimensions, T>::MatrixType projectionMatrix() const { return _projectionMatrix; }
/**
* @brief Size of (near) XY plane in current projection
@ -122,12 +122,12 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature<dimensions
* Returns size of near XY plane computed from projection matrix.
* @see projectionMatrix()
*/
inline Math::Vector2<T> projectionSize() const {
Math::Vector2<T> projectionSize() const {
return {T(2.0)/_projectionMatrix[0].x(), T(2.0)/_projectionMatrix[1].y()};
}
/** @brief Viewport size */
inline Vector2i viewport() const { return _viewport; }
Vector2i viewport() const { return _viewport; }
/**
* @brief Set viewport size
@ -147,12 +147,12 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature<dimensions
protected:
/** Recalculates camera matrix */
inline void cleanInverted(const typename DimensionTraits<dimensions, T>::MatrixType& invertedAbsoluteTransformationMatrix) override {
void cleanInverted(const typename DimensionTraits<dimensions, T>::MatrixType& invertedAbsoluteTransformationMatrix) override {
_cameraMatrix = invertedAbsoluteTransformationMatrix;
}
#ifndef DOXYGEN_GENERATING_OUTPUT
inline void fixAspectRatio() {
void fixAspectRatio() {
_projectionMatrix = Implementation::aspectRatioFix<dimensions, T>(_aspectRatioPolicy, {rawProjectionMatrix[0].x(), rawProjectionMatrix[1].y()}, _viewport)*rawProjectionMatrix;
}

4
src/SceneGraph/AbstractCamera.hpp

@ -42,13 +42,13 @@ template<UnsignedInt dimensions, class T> class Camera {};
template<class T> class Camera<2, T> {
public:
inline constexpr static Math::Matrix3<T> aspectRatioScale(const Math::Vector2<T>& scale) {
constexpr static Math::Matrix3<T> aspectRatioScale(const Math::Vector2<T>& scale) {
return Math::Matrix3<T>::scaling({scale.x(), scale.y()});
}
};
template<class T> class Camera<3, T> {
public:
inline constexpr static Math::Matrix4<T> aspectRatioScale(const Math::Vector2<T>& scale) {
constexpr static Math::Matrix4<T> aspectRatioScale(const Math::Vector2<T>& scale) {
return Math::Matrix4<T>::scaling({scale.x(), scale.y(), 1.0f});
}
};

18
src/SceneGraph/AbstractFeature.h

@ -108,7 +108,7 @@ parameter:
@code
class TransformingFeature: public SceneGraph::AbstractFeature3D<> {
public:
template<class T> inline TransformingFeature(SceneGraph::Object<T>* object):
template<class T> TransformingFeature(SceneGraph::Object<T>* object):
SceneGraph::AbstractFeature3D<>(object), transformation(object) {}
private:
@ -155,32 +155,32 @@ template<UnsignedInt dimensions, class T = Float> class AbstractFeature
virtual ~AbstractFeature() = 0;
/** @brief %Object holding this feature */
inline AbstractObject<dimensions, T>* object() {
AbstractObject<dimensions, T>* object() {
return Containers::LinkedListItem<AbstractFeature<dimensions, T>, AbstractObject<dimensions, T>>::list();
}
/** @overload */
inline const AbstractObject<dimensions, T>* object() const {
const AbstractObject<dimensions, T>* object() const {
return Containers::LinkedListItem<AbstractFeature<dimensions, T>, AbstractObject<dimensions, T>>::list();
}
/** @brief Previous feature or `nullptr`, if this is first feature */
inline AbstractFeature<dimensions, T>* previousFeature() {
AbstractFeature<dimensions, T>* previousFeature() {
return Containers::LinkedListItem<AbstractFeature<dimensions, T>, AbstractObject<dimensions, T>>::previous();
}
/** @overload */
inline const AbstractFeature<dimensions, T>* previousFeature() const {
const AbstractFeature<dimensions, T>* previousFeature() const {
return Containers::LinkedListItem<AbstractFeature<dimensions, T>, AbstractObject<dimensions, T>>::previous();
}
/** @brief Next feature or `nullptr`, if this is last feature */
inline AbstractFeature<dimensions, T>* nextFeature() {
AbstractFeature<dimensions, T>* nextFeature() {
return Containers::LinkedListItem<AbstractFeature<dimensions, T>, AbstractObject<dimensions, T>>::next();
}
/** @overload */
inline const AbstractFeature<dimensions, T>* nextFeature() const {
const AbstractFeature<dimensions, T>* nextFeature() const {
return Containers::LinkedListItem<AbstractFeature<dimensions, T>, AbstractObject<dimensions, T>>::next();
}
@ -237,7 +237,7 @@ template<UnsignedInt dimensions, class T = Float> class AbstractFeature
*
* @see @ref scenegraph-caching, clean(), cleanInverted()
*/
inline CachedTransformations cachedTransformations() const {
CachedTransformations cachedTransformations() const {
return _cachedTransformations;
}
@ -252,7 +252,7 @@ template<UnsignedInt dimensions, class T = Float> class AbstractFeature
* Nothing is enabled by default.
* @see @ref scenegraph-caching
*/
inline void setCachedTransformations(CachedTransformations transformations) {
void setCachedTransformations(CachedTransformations transformations) {
_cachedTransformations = transformations;
}

8
src/SceneGraph/AbstractGroupedFeature.h

@ -82,7 +82,7 @@ class AbstractGroupedFeature: public AbstractFeature<dimensions, T> {
* Adds the feature to the object and to group, if specified.
* @see FeatureGroup::add()
*/
inline explicit AbstractGroupedFeature(AbstractObject<dimensions, T>* object, FeatureGroup<dimensions, Derived, T>* group = nullptr): AbstractFeature<dimensions, T>(object), _group(nullptr) {
explicit AbstractGroupedFeature(AbstractObject<dimensions, T>* object, FeatureGroup<dimensions, Derived, T>* group = nullptr): AbstractFeature<dimensions, T>(object), _group(nullptr) {
if(group) group->add(static_cast<Derived*>(this));
}
@ -92,17 +92,17 @@ class AbstractGroupedFeature: public AbstractFeature<dimensions, T> {
* Removes the feature from object and from group, if it belongs to
* any.
*/
inline ~AbstractGroupedFeature() {
~AbstractGroupedFeature() {
if(_group) _group->remove(static_cast<Derived*>(this));
}
/** @brief Group this feature belongs to */
inline FeatureGroup<dimensions, Derived, T>* group() {
FeatureGroup<dimensions, Derived, T>* group() {
return _group;
}
/** @overload */
inline const FeatureGroup<dimensions, Derived, T>* group() const {
const FeatureGroup<dimensions, Derived, T>* group() const {
return _group;
}

10
src/SceneGraph/AbstractObject.h

@ -74,27 +74,27 @@ template<UnsignedInt dimensions, class T = Float> class AbstractObject
virtual ~AbstractObject();
/** @brief Whether this object has features */
inline bool hasFeatures() const {
bool hasFeatures() const {
return !Containers::LinkedList<AbstractFeature<dimensions, T>>::isEmpty();
}
/** @brief First object feature or `nullptr`, if this object has no features */
inline FeatureType* firstFeature() {
FeatureType* firstFeature() {
return Containers::LinkedList<AbstractFeature<dimensions, T>>::first();
}
/** @overload */
inline const FeatureType* firstFeature() const {
const FeatureType* firstFeature() const {
return Containers::LinkedList<AbstractFeature<dimensions, T>>::first();
}
/** @brief Last object feature or `nullptr`, if this object has no features */
inline FeatureType* lastFeature() {
FeatureType* lastFeature() {
return Containers::LinkedList<AbstractFeature<dimensions, T>>::last();
}
/** @overload */
inline const FeatureType* lastFeature() const {
const FeatureType* lastFeature() const {
return Containers::LinkedList<AbstractFeature<dimensions, T>>::last();
}

22
src/SceneGraph/Animable.h

@ -162,10 +162,10 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
~Animable();
/** @brief Animation duration */
inline Float duration() const { return _duration; }
Float duration() const { return _duration; }
/** @brief Animation state */
inline AnimationState state() const { return currentState; }
AnimationState state() const { return currentState; }
/**
* @brief Set animation state
@ -185,7 +185,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
*
* @see repeatCount()
*/
inline bool isRepeated() const { return _repeated; }
bool isRepeated() const { return _repeated; }
/**
* @brief Enable/disable repeated animation
@ -194,7 +194,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
* Default is `false`.
* @see setRepeatCount()
*/
inline Animable<dimensions, T>* setRepeated(bool repeated) {
Animable<dimensions, T>* setRepeated(bool repeated) {
_repeated = repeated;
return this;
}
@ -204,7 +204,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
*
* @see isRepeated()
*/
inline UnsignedShort repeatCount() const { return _repeatCount; }
UnsignedShort repeatCount() const { return _repeatCount; }
/**
* @brief Set repeat count
@ -214,7 +214,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
* infinitely repeated animation. Default is `0`.
* @see setRepeated()
*/
inline Animable<dimensions, T>* setRepeatCount(UnsignedShort count) {
Animable<dimensions, T>* setRepeatCount(UnsignedShort count) {
_repeatCount = count;
return this;
}
@ -236,7 +236,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
* infinite non-repeating animation. Default is `0.0f`.
*/
/* Protected so only animation implementer can change it */
inline Animable<dimensions, T>* setDuration(Float duration) {
Animable<dimensions, T>* setDuration(Float duration) {
_duration = duration;
return this;
}
@ -274,7 +274,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
*
* @see setState()
*/
inline virtual void animationStarted() {}
virtual void animationStarted() {}
/**
* @brief Action on animation pause
@ -288,7 +288,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
*
* @see setState()
*/
inline virtual void animationPaused() {}
virtual void animationPaused() {}
/**
* @brief Action on animation resume
@ -302,7 +302,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
*
* @see setState()
*/
inline virtual void animationResumed() {}
virtual void animationResumed() {}
/**
* @brief Action on animation stop
@ -319,7 +319,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
*
* @see setState()
*/
inline virtual void animationStopped() {}
virtual void animationStopped() {}
private:
Float _duration;

4
src/SceneGraph/AnimableGroup.h

@ -52,14 +52,14 @@ class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup: public FeatureGroup<dimensions, An
/**
* @brief Constructor
*/
inline explicit AnimableGroup(): _runningCount(0), wakeUp(false) {}
explicit AnimableGroup(): _runningCount(0), wakeUp(false) {}
/**
* @brief Count of running animations
*
* @see step()
*/
inline std::size_t runningCount() const { return _runningCount; }
std::size_t runningCount() const { return _runningCount; }
/**
* @brief Perform animation step

2
src/SceneGraph/Camera2D.h

@ -82,7 +82,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Camera2D: public AbstractCamera<2, T> {
/* Overloads to remove WTF-factor from method chaining order */
#ifndef DOXYGEN_GENERATING_OUTPUT
inline Camera2D<T>* setAspectRatioPolicy(AspectRatioPolicy policy) {
Camera2D<T>* setAspectRatioPolicy(AspectRatioPolicy policy) {
AbstractCamera<2, T>::setAspectRatioPolicy(policy);
return this;
}

6
src/SceneGraph/Camera3D.h

@ -108,14 +108,14 @@ class MAGNUM_SCENEGRAPH_EXPORT Camera3D: public AbstractCamera<3, T> {
Camera3D<T>* setPerspective(Math::Rad<T> fov, T aspectRatio, T near, T far);
/** @brief Near clipping plane */
inline T near() const { return _near; }
T near() const { return _near; }
/** @brief Far clipping plane */
inline T far() const { return _far; }
T far() const { return _far; }
/* Overloads to remove WTF-factor from method chaining order */
#ifndef DOXYGEN_GENERATING_OUTPUT
inline Camera3D<T>* setAspectRatioPolicy(AspectRatioPolicy policy) {
Camera3D<T>* setAspectRatioPolicy(AspectRatioPolicy policy) {
AbstractCamera<3, T>::setAspectRatioPolicy(policy);
return this;
}

2
src/SceneGraph/Drawable.h

@ -131,7 +131,7 @@ class Drawable: public AbstractGroupedFeature<dimensions, Drawable<dimensions, T
* Adds the feature to the object and also to the group, if specified.
* Otherwise you can use DrawableGroup::add().
*/
inline explicit Drawable(AbstractObject<dimensions, T>* object, DrawableGroup<dimensions, T>* drawables = nullptr): AbstractGroupedFeature<dimensions, Drawable<dimensions, T>, T>(object, drawables) {}
explicit Drawable(AbstractObject<dimensions, T>* object, DrawableGroup<dimensions, T>* drawables = nullptr): AbstractGroupedFeature<dimensions, Drawable<dimensions, T>, T>(object, drawables) {}
/**
* @brief Draw the object using given camera

26
src/SceneGraph/DualComplexTransformation.h

@ -52,23 +52,23 @@ class DualComplexTransformation: public AbstractTranslationRotation2D<T> {
typedef Math::DualComplex<T> DataType;
#ifndef DOXYGEN_GENERATING_OUTPUT
inline static Math::DualComplex<T> fromMatrix(const Math::Matrix3<T>& matrix) {
static Math::DualComplex<T> fromMatrix(const Math::Matrix3<T>& matrix) {
return Math::DualComplex<T>::fromMatrix(matrix);
}
inline constexpr static Math::Matrix3<T> toMatrix(const Math::DualComplex<T>& transformation) {
constexpr static Math::Matrix3<T> toMatrix(const Math::DualComplex<T>& transformation) {
return transformation.toMatrix();
}
inline static Math::DualComplex<T> compose(const Math::DualComplex<T>& parent, const Math::DualComplex<T>& child) {
static Math::DualComplex<T> compose(const Math::DualComplex<T>& parent, const Math::DualComplex<T>& child) {
return parent*child;
}
inline static Math::DualComplex<T> inverted(const Math::DualComplex<T>& transformation) {
static Math::DualComplex<T> inverted(const Math::DualComplex<T>& transformation) {
return transformation.invertedNormalized();
}
inline Math::DualComplex<T> transformation() const {
Math::DualComplex<T> transformation() const {
return _transformation;
}
#endif
@ -100,7 +100,7 @@ class DualComplexTransformation: public AbstractTranslationRotation2D<T> {
return this;
}
inline DualComplexTransformation<T>* resetTransformation() override {
DualComplexTransformation<T>* resetTransformation() override {
setTransformationInternal({});
return this;
}
@ -114,7 +114,7 @@ class DualComplexTransformation: public AbstractTranslationRotation2D<T> {
* Expects that the dual complex number is normalized.
* @see DualComplex::isNormalized()
*/
inline DualComplexTransformation<T>* transform(const Math::DualComplex<T>& transformation, TransformationType type = TransformationType::Global) {
DualComplexTransformation<T>* transform(const Math::DualComplex<T>& transformation, TransformationType type = TransformationType::Global) {
CORRADE_ASSERT(transformation.isNormalized(),
"SceneGraph::DualComplexTransformation::transform(): the dual complex number is not normalized", this);
transformInternal(transformation, type);
@ -125,7 +125,7 @@ class DualComplexTransformation: public AbstractTranslationRotation2D<T> {
* @copydoc AbstractTranslationRotationScaling2D::translate()
* Same as calling transform() with DualComplex::translation().
*/
inline DualComplexTransformation<T>* translate(const Math::Vector2<T>& vector, TransformationType type = TransformationType::Global) override {
DualComplexTransformation<T>* translate(const Math::Vector2<T>& vector, TransformationType type = TransformationType::Global) override {
transformInternal(Math::DualComplex<T>::translation(vector), type);
return this;
}
@ -139,7 +139,7 @@ class DualComplexTransformation: public AbstractTranslationRotation2D<T> {
* Same as calling transform() with DualComplex::rotation().
* @see normalizeRotation()
*/
inline DualComplexTransformation<T>* rotate(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
DualComplexTransformation<T>* rotate(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
transformInternal(Math::DualComplex<T>::rotation(angle), type);
return this;
}
@ -150,18 +150,18 @@ class DualComplexTransformation: public AbstractTranslationRotation2D<T> {
* if you want to move it above all.
* @return Pointer to self (for method chaining)
*/
inline DualComplexTransformation<T>* move(Object<DualComplexTransformation<T>>* under) {
DualComplexTransformation<T>* move(Object<DualComplexTransformation<T>>* under) {
static_cast<Object<DualComplexTransformation>*>(this)->Containers::template LinkedList<Object<DualComplexTransformation<T>>>::move(this, under);
return this;
}
protected:
/* Allow construction only from Object */
inline explicit DualComplexTransformation() = default;
explicit DualComplexTransformation() = default;
private:
/* No assertions fired, for internal use */
inline void setTransformationInternal(const Math::DualComplex<T>& transformation) {
void setTransformationInternal(const Math::DualComplex<T>& transformation) {
/* Setting transformation is forbidden for the scene */
/** @todo Assert for this? */
/** @todo Do this in some common code so we don't need to include Object? */
@ -172,7 +172,7 @@ class DualComplexTransformation: public AbstractTranslationRotation2D<T> {
}
/* No assertions fired, for internal use */
inline void transformInternal(const Math::DualComplex<T>& transformation, TransformationType type) {
void transformInternal(const Math::DualComplex<T>& transformation, TransformationType type) {
setTransformation(type == TransformationType::Global ?
transformation*_transformation : _transformation*transformation);
}

30
src/SceneGraph/DualQuaternionTransformation.h

@ -52,25 +52,25 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D<T> {
typedef Math::DualQuaternion<T> DataType;
#ifndef DOXYGEN_GENERATING_OUTPUT
inline static Math::DualQuaternion<T> fromMatrix(const Math::Matrix4<T>& matrix) {
static Math::DualQuaternion<T> fromMatrix(const Math::Matrix4<T>& matrix) {
CORRADE_ASSERT(matrix.isRigidTransformation(),
"SceneGraph::DualQuaternionTransformation::fromMatrix(): the matrix doesn't represent rigid transformation", {});
return Math::DualQuaternion<T>::fromMatrix(matrix);
}
inline constexpr static Math::Matrix4<T> toMatrix(const Math::DualQuaternion<T>& transformation) {
constexpr static Math::Matrix4<T> toMatrix(const Math::DualQuaternion<T>& transformation) {
return transformation.toMatrix();
}
inline static Math::DualQuaternion<T> compose(const Math::DualQuaternion<T>& parent, const Math::DualQuaternion<T>& child) {
static Math::DualQuaternion<T> compose(const Math::DualQuaternion<T>& parent, const Math::DualQuaternion<T>& child) {
return parent*child;
}
inline static Math::DualQuaternion<T> inverted(const Math::DualQuaternion<T>& transformation) {
static Math::DualQuaternion<T> inverted(const Math::DualQuaternion<T>& transformation) {
return transformation.invertedNormalized();
}
inline Math::DualQuaternion<T> transformation() const {
Math::DualQuaternion<T> transformation() const {
return _transformation;
}
#endif
@ -102,7 +102,7 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D<T> {
return this;
}
inline DualQuaternionTransformation<T>* resetTransformation() override {
DualQuaternionTransformation<T>* resetTransformation() override {
setTransformation({});
return this;
}
@ -116,7 +116,7 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D<T> {
* Expects that the dual quaternion is normalized.
* @see DualQuaternion::isNormalized()
*/
inline DualQuaternionTransformation<T>* transform(const Math::DualQuaternion<T>& transformation, TransformationType type = TransformationType::Global) {
DualQuaternionTransformation<T>* transform(const Math::DualQuaternion<T>& transformation, TransformationType type = TransformationType::Global) {
CORRADE_ASSERT(transformation.isNormalized(),
"SceneGraph::DualQuaternionTransformation::transform(): the dual quaternion is not normalized", this);
transformInternal(transformation, type);
@ -127,7 +127,7 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D<T> {
* @copydoc AbstractTranslationRotationScaling3D::translate()
* Same as calling transform() with DualQuaternion::translation().
*/
inline DualQuaternionTransformation<T>* translate(const Math::Vector3<T>& vector, TransformationType type = TransformationType::Global) override {
DualQuaternionTransformation<T>* translate(const Math::Vector3<T>& vector, TransformationType type = TransformationType::Global) override {
transformInternal(Math::DualQuaternion<T>::translation(vector), type);
return this;
}
@ -143,22 +143,22 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D<T> {
* @see Vector3::xAxis(), Vector3::yAxis(), Vector3::zAxis(),
* normalizeRotation()
*/
inline DualQuaternionTransformation<T>* rotate(Math::Rad<T> angle, const Math::Vector3<T>& normalizedAxis, TransformationType type = TransformationType::Global) override {
DualQuaternionTransformation<T>* rotate(Math::Rad<T> angle, const Math::Vector3<T>& normalizedAxis, TransformationType type = TransformationType::Global) override {
transformInternal(Math::DualQuaternion<T>::rotation(angle, normalizedAxis), type);
return this;
}
/* Overloads to remove WTF-factor from method chaining order */
#ifndef DOXYGEN_GENERATING_OUTPUT
inline DualQuaternionTransformation<T>* rotateX(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
DualQuaternionTransformation<T>* rotateX(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
AbstractTranslationRotation3D<T>::rotateX(angle, type);
return this;
}
inline DualQuaternionTransformation<T>* rotateY(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
DualQuaternionTransformation<T>* rotateY(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
AbstractTranslationRotation3D<T>::rotateY(angle, type);
return this;
}
inline DualQuaternionTransformation<T>* rotateZ(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
DualQuaternionTransformation<T>* rotateZ(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
AbstractTranslationRotation3D<T>::rotateZ(angle, type);
return this;
}
@ -166,11 +166,11 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D<T> {
protected:
/* Allow construction only from Object */
inline explicit DualQuaternionTransformation() = default;
explicit DualQuaternionTransformation() = default;
private:
/* No assertions fired, for internal use */
inline void setTransformationInternal(const Math::DualQuaternion<T>& transformation) {
void setTransformationInternal(const Math::DualQuaternion<T>& transformation) {
/* Setting transformation is forbidden for the scene */
/** @todo Assert for this? */
/** @todo Do this in some common code so we don't need to include Object? */
@ -181,7 +181,7 @@ class DualQuaternionTransformation: public AbstractTranslationRotation3D<T> {
}
/* No assertions fired, for internal use */
inline void transformInternal(const Math::DualQuaternion<T>& transformation, TransformationType type) {
void transformInternal(const Math::DualQuaternion<T>& transformation, TransformationType type) {
setTransformation(type == TransformationType::Global ?
transformation*_transformation : _transformation*transformation);
}

8
src/SceneGraph/FeatureGroup.h

@ -83,18 +83,18 @@ class FeatureGroup: public AbstractFeatureGroup<dimensions, T> {
virtual ~FeatureGroup();
/** @brief Whether the group is empty */
inline bool isEmpty() const { return this->features.empty(); }
bool isEmpty() const { return this->features.empty(); }
/** @brief Count of features in the group */
inline std::size_t size() const { return this->features.size(); }
std::size_t size() const { return this->features.size(); }
/** @brief Feature at given index */
inline Feature* operator[](std::size_t index) {
Feature* operator[](std::size_t index) {
return static_cast<Feature*>(this->features[index]);
}
/** @overload */
inline const Feature* operator[](std::size_t index) const {
const Feature* operator[](std::size_t index) const {
return static_cast<Feature*>(this->features[index]);
}

26
src/SceneGraph/MatrixTransformation2D.h

@ -51,23 +51,23 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D<T> {
typedef Math::Matrix3<T> DataType;
#ifndef DOXYGEN_GENERATING_OUTPUT
inline constexpr static Math::Matrix3<T> fromMatrix(const Math::Matrix3<T>& matrix) {
constexpr static Math::Matrix3<T> fromMatrix(const Math::Matrix3<T>& matrix) {
return matrix;
}
inline constexpr static Math::Matrix3<T> toMatrix(const Math::Matrix3<T>& transformation) {
constexpr static Math::Matrix3<T> toMatrix(const Math::Matrix3<T>& transformation) {
return transformation;
}
inline static Math::Matrix3<T> compose(const Math::Matrix3<T>& parent, const Math::Matrix3<T>& child) {
static Math::Matrix3<T> compose(const Math::Matrix3<T>& parent, const Math::Matrix3<T>& child) {
return parent*child;
}
inline static Math::Matrix3<T> inverted(const Math::Matrix3<T>& transformation) {
static Math::Matrix3<T> inverted(const Math::Matrix3<T>& transformation) {
return transformation.inverted();
}
inline Math::Matrix3<T> transformation() const {
Math::Matrix3<T> transformation() const {
return _transformation;
}
#endif
@ -94,13 +94,13 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D<T> {
* @param type Transformation type
* @return Pointer to self (for method chaining)
*/
inline MatrixTransformation2D<T>* transform(const Math::Matrix3<T>& transformation, TransformationType type = TransformationType::Global) {
MatrixTransformation2D<T>* transform(const Math::Matrix3<T>& transformation, TransformationType type = TransformationType::Global) {
setTransformation(type == TransformationType::Global ?
transformation*_transformation : _transformation*transformation);
return this;
}
inline MatrixTransformation2D<T>* resetTransformation() override {
MatrixTransformation2D<T>* resetTransformation() override {
setTransformation({});
return this;
}
@ -109,7 +109,7 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D<T> {
* @copydoc AbstractTranslationRotationScaling2D::translate()
* Same as calling transform() with Matrix3::translation().
*/
inline MatrixTransformation2D<T>* translate(const Math::Vector2<T>& vector, TransformationType type = TransformationType::Global) override {
MatrixTransformation2D<T>* translate(const Math::Vector2<T>& vector, TransformationType type = TransformationType::Global) override {
transform(Math::Matrix3<T>::translation(vector), type);
return this;
}
@ -118,7 +118,7 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D<T> {
* @copydoc AbstractTranslationRotationScaling2D::rotate()
* Same as calling transform() with Matrix3::rotation().
*/
inline MatrixTransformation2D<T>* rotate(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
MatrixTransformation2D<T>* rotate(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
transform(Math::Matrix3<T>::rotation(angle), type);
return this;
}
@ -127,7 +127,7 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D<T> {
* @copydoc AbstractTranslationRotationScaling2D::scale()
* Same as calling transform() with Matrix3::scaling().
*/
inline MatrixTransformation2D<T>* scale(const Math::Vector2<T>& vector, TransformationType type = TransformationType::Global) override {
MatrixTransformation2D<T>* scale(const Math::Vector2<T>& vector, TransformationType type = TransformationType::Global) override {
transform(Math::Matrix3<T>::scaling(vector), type);
return this;
}
@ -141,7 +141,7 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D<T> {
*
* Same as calling transform() with Matrix3::reflection().
*/
inline MatrixTransformation2D<T>* reflect(const Math::Vector2<T>& normal, TransformationType type = TransformationType::Global) {
MatrixTransformation2D<T>* reflect(const Math::Vector2<T>& normal, TransformationType type = TransformationType::Global) {
transform(Math::Matrix3<T>::reflection(normal), type);
return this;
}
@ -152,14 +152,14 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D<T> {
* if you want to move it above all.
* @return Pointer to self (for method chaining)
*/
inline MatrixTransformation2D<T>* move(Object<MatrixTransformation2D<T>>* under) {
MatrixTransformation2D<T>* move(Object<MatrixTransformation2D<T>>* under) {
static_cast<Object<MatrixTransformation2D>*>(this)->Containers::template LinkedList<Object<MatrixTransformation2D<T>>>::move(this, under);
return this;
}
protected:
/* Allow construction only from Object */
inline explicit MatrixTransformation2D() = default;
explicit MatrixTransformation2D() = default;
private:
Math::Matrix3<T> _transformation;

30
src/SceneGraph/MatrixTransformation3D.h

@ -51,23 +51,23 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
typedef Math::Matrix4<T> DataType;
#ifndef DOXYGEN_GENERATING_OUTPUT
inline constexpr static Math::Matrix4<T> fromMatrix(const Math::Matrix4<T>& matrix) {
constexpr static Math::Matrix4<T> fromMatrix(const Math::Matrix4<T>& matrix) {
return matrix;
}
inline constexpr static Math::Matrix4<T> toMatrix(const Math::Matrix4<T>& transformation) {
constexpr static Math::Matrix4<T> toMatrix(const Math::Matrix4<T>& transformation) {
return transformation;
}
inline static Math::Matrix4<T> compose(const Math::Matrix4<T>& parent, const Math::Matrix4<T>& child) {
static Math::Matrix4<T> compose(const Math::Matrix4<T>& parent, const Math::Matrix4<T>& child) {
return parent*child;
}
inline static Math::Matrix4<T> inverted(const Math::Matrix4<T>& transformation) {
static Math::Matrix4<T> inverted(const Math::Matrix4<T>& transformation) {
return transformation.inverted();
}
inline Math::Matrix4<T> transformation() const {
Math::Matrix4<T> transformation() const {
return _transformation;
}
#endif
@ -88,7 +88,7 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
return this;
}
inline MatrixTransformation3D<T>* resetTransformation() override {
MatrixTransformation3D<T>* resetTransformation() override {
setTransformation({});
return this;
}
@ -99,7 +99,7 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
* @param type Transformation type
* @return Pointer to self (for method chaining)
*/
inline MatrixTransformation3D<T>* transform(const Math::Matrix4<T>& transformation, TransformationType type = TransformationType::Global) {
MatrixTransformation3D<T>* transform(const Math::Matrix4<T>& transformation, TransformationType type = TransformationType::Global) {
setTransformation(type == TransformationType::Global ?
transformation*_transformation : _transformation*transformation);
return this;
@ -109,7 +109,7 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
* @copydoc AbstractTranslationRotationScaling3D::translate()
* Same as calling transform() with Matrix4::translation().
*/
inline MatrixTransformation3D<T>* translate(const Math::Vector3<T>& vector, TransformationType type = TransformationType::Global) override {
MatrixTransformation3D<T>* translate(const Math::Vector3<T>& vector, TransformationType type = TransformationType::Global) override {
transform(Math::Matrix4<T>::translation(vector), type);
return this;
}
@ -118,7 +118,7 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
* @copydoc AbstractTranslationRotationScaling3D::rotate()
* Same as calling transform() with Matrix4::rotation().
*/
inline MatrixTransformation3D<T>* rotate(Math::Rad<T> angle, const Math::Vector3<T>& normalizedAxis, TransformationType type = TransformationType::Global) override {
MatrixTransformation3D<T>* rotate(Math::Rad<T> angle, const Math::Vector3<T>& normalizedAxis, TransformationType type = TransformationType::Global) override {
transform(Math::Matrix4<T>::rotation(angle, normalizedAxis), type);
return this;
}
@ -131,7 +131,7 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
*
* Same as calling transform() with Matrix4::rotationX().
*/
inline MatrixTransformation3D<T>* rotateX(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
MatrixTransformation3D<T>* rotateX(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
transform(Math::Matrix4<T>::rotationX(angle), type);
return this;
}
@ -144,7 +144,7 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
*
* Same as calling transform() with Matrix4::rotationY().
*/
inline MatrixTransformation3D<T>* rotateY(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
MatrixTransformation3D<T>* rotateY(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
transform(Math::Matrix4<T>::rotationY(angle), type);
return this;
}
@ -157,7 +157,7 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
*
* Same as calling transform() with Matrix4::rotationZ().
*/
inline MatrixTransformation3D<T>* rotateZ(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
MatrixTransformation3D<T>* rotateZ(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
transform(Math::Matrix4<T>::rotationZ(angle), type);
return this;
}
@ -166,7 +166,7 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
* @copydoc AbstractTranslationRotationScaling3D::scale()
* Same as calling transform() with Matrix4::scaling().
*/
inline MatrixTransformation3D<T>* scale(const Math::Vector3<T>& vector, TransformationType type = TransformationType::Global) override {
MatrixTransformation3D<T>* scale(const Math::Vector3<T>& vector, TransformationType type = TransformationType::Global) override {
transform(Math::Matrix4<T>::scaling(vector), type);
return this;
}
@ -180,14 +180,14 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
*
* Same as calling transform() with Matrix4::reflection().
*/
inline MatrixTransformation3D<T>* reflect(const Math::Vector3<T>& normal, TransformationType type = TransformationType::Global) {
MatrixTransformation3D<T>* reflect(const Math::Vector3<T>& normal, TransformationType type = TransformationType::Global) {
transform(Math::Matrix4<T>::reflection(normal), type);
return this;
}
protected:
/* Allow construction only from Object */
inline explicit MatrixTransformation3D() = default;
explicit MatrixTransformation3D() = default;
private:
Math::Matrix4<T> _transformation;

34
src/SceneGraph/Object.h

@ -117,7 +117,7 @@ template<class Transformation> class MAGNUM_SCENEGRAPH_EXPORT Object: public Abs
* @brief Constructor
* @param parent Parent object
*/
inline explicit Object(Object<Transformation>* parent = nullptr): counter(0xFFFFu), flags(Flag::Dirty) {
explicit Object(Object<Transformation>* parent = nullptr): counter(0xFFFFu), flags(Flag::Dirty) {
setParent(parent);
}
@ -127,7 +127,7 @@ template<class Transformation> class MAGNUM_SCENEGRAPH_EXPORT Object: public Abs
* Removes itself from parent's children list and destroys all own
* children.
*/
inline virtual ~Object() {}
virtual ~Object() {}
/**
* @{ @name Scene hierarchy
@ -136,7 +136,7 @@ template<class Transformation> class MAGNUM_SCENEGRAPH_EXPORT Object: public Abs
*/
/** @brief Whether this object is scene */
virtual inline bool isScene() const { return false; }
virtual bool isScene() const { return false; }
/**
* @brief %Scene
@ -148,57 +148,57 @@ template<class Transformation> class MAGNUM_SCENEGRAPH_EXPORT Object: public Abs
const Scene<Transformation>* scene() const;
/** @brief Parent object or `nullptr`, if this is root object */
inline Object<Transformation>* parent() {
Object<Transformation>* parent() {
return Containers::LinkedListItem<Object<Transformation>, Object<Transformation>>::list();
}
/** @overload */
inline const Object<Transformation>* parent() const {
const Object<Transformation>* parent() const {
return Containers::LinkedListItem<Object<Transformation>, Object<Transformation>>::list();
}
/** @brief Previous sibling object or `nullptr`, if this is first object */
inline Object<Transformation>* previousSibling() {
Object<Transformation>* previousSibling() {
return Containers::LinkedListItem<Object<Transformation>, Object<Transformation>>::previous();
}
/** @overload */
inline const Object<Transformation>* previousSibling() const {
const Object<Transformation>* previousSibling() const {
return Containers::LinkedListItem<Object<Transformation>, Object<Transformation>>::previous();
}
/** @brief Next sibling object or `nullptr`, if this is last object */
inline Object<Transformation>* nextSibling() {
Object<Transformation>* nextSibling() {
return Containers::LinkedListItem<Object<Transformation>, Object<Transformation>>::next();
}
/** @overload */
inline const Object<Transformation>* nextSibling() const {
const Object<Transformation>* nextSibling() const {
return Containers::LinkedListItem<Object<Transformation>, Object<Transformation>>::next();
}
/** @brief Whether this object has children */
inline bool hasChildren() const {
bool hasChildren() const {
return !Containers::LinkedList<Object<Transformation>>::isEmpty();
}
/** @brief First child object or `nullptr`, if this object has no children */
inline Object<Transformation>* firstChild() {
Object<Transformation>* firstChild() {
return Containers::LinkedList<Object<Transformation>>::first();
}
/** @overload */
inline const Object<Transformation>* firstChild() const {
const Object<Transformation>* firstChild() const {
return Containers::LinkedList<Object<Transformation>>::first();
}
/** @brief Last child object or `nullptr`, if this object has no children */
inline Object<Transformation>* lastChild() {
Object<Transformation>* lastChild() {
return Containers::LinkedList<Object<Transformation>>::last();
}
/** @overload */
inline const Object<Transformation>* lastChild() const {
const Object<Transformation>* lastChild() const {
return Containers::LinkedList<Object<Transformation>>::last();
}
@ -223,11 +223,11 @@ template<class Transformation> class MAGNUM_SCENEGRAPH_EXPORT Object: public Abs
/** @{ @name Object transformation */
inline typename DimensionTraits<Transformation::Dimensions, typename Transformation::Type>::MatrixType transformationMatrix() const override {
typename DimensionTraits<Transformation::Dimensions, typename Transformation::Type>::MatrixType transformationMatrix() const override {
return Transformation::toMatrix(Transformation::transformation());
}
inline typename DimensionTraits<Transformation::Dimensions, typename Transformation::Type>::MatrixType absoluteTransformationMatrix() const override {
typename DimensionTraits<Transformation::Dimensions, typename Transformation::Type>::MatrixType absoluteTransformationMatrix() const override {
return Transformation::toMatrix(absoluteTransformation());
}
@ -251,7 +251,7 @@ template<class Transformation> class MAGNUM_SCENEGRAPH_EXPORT Object: public Abs
/*@}*/
inline bool isDirty() const override { return !!(flags & Flag::Dirty); }
bool isDirty() const override { return !!(flags & Flag::Dirty); }
void setDirty() override;
void setClean() override;

4
src/SceneGraph/Object.hpp

@ -41,8 +41,8 @@ namespace Magnum { namespace SceneGraph {
template<UnsignedInt dimensions, class T> AbstractObject<dimensions, T>::AbstractObject() {}
template<UnsignedInt dimensions, class T> AbstractObject<dimensions, T>::~AbstractObject() {}
template<UnsignedInt dimensions, class T> inline AbstractTransformation<dimensions, T>::AbstractTransformation() {}
template<UnsignedInt dimensions, class T> inline AbstractTransformation<dimensions, T>::~AbstractTransformation() {}
template<UnsignedInt dimensions, class T> AbstractTransformation<dimensions, T>::AbstractTransformation() {}
template<UnsignedInt dimensions, class T> AbstractTransformation<dimensions, T>::~AbstractTransformation() {}
template<class Transformation> Scene<Transformation>* Object<Transformation>::scene() {
return static_cast<Scene<Transformation>*>(sceneObject());

28
src/SceneGraph/RigidMatrixTransformation2D.h

@ -54,25 +54,25 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D<T> {
typedef Math::Matrix3<T> DataType;
#ifndef DOXYGEN_GENERATING_OUTPUT
inline static Math::Matrix3<T> fromMatrix(const Math::Matrix3<T>& matrix) {
static Math::Matrix3<T> fromMatrix(const Math::Matrix3<T>& matrix) {
CORRADE_ASSERT(matrix.isRigidTransformation(),
"SceneGraph::RigidMatrixTransformation2D::fromMatrix(): the matrix doesn't represent rigid transformation", {});
return matrix;
}
inline constexpr static Math::Matrix3<T> toMatrix(const Math::Matrix3<T>& transformation) {
constexpr static Math::Matrix3<T> toMatrix(const Math::Matrix3<T>& transformation) {
return transformation;
}
inline static Math::Matrix3<T> compose(const Math::Matrix3<T>& parent, const Math::Matrix3<T>& child) {
static Math::Matrix3<T> compose(const Math::Matrix3<T>& parent, const Math::Matrix3<T>& child) {
return parent*child;
}
inline static Math::Matrix3<T> inverted(const Math::Matrix3<T>& transformation) {
static Math::Matrix3<T> inverted(const Math::Matrix3<T>& transformation) {
return transformation.invertedRigid();
}
inline Math::Matrix3<T> transformation() const {
Math::Matrix3<T> transformation() const {
return _transformation;
}
#endif
@ -105,7 +105,7 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D<T> {
return this;
}
inline RigidMatrixTransformation2D<T>* resetTransformation() override {
RigidMatrixTransformation2D<T>* resetTransformation() override {
setTransformationInternal({});
return this;
}
@ -119,7 +119,7 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D<T> {
* Expects that the matrix represents rigid transformation.
* @see Matrix3::isRigidTransformation()
*/
inline RigidMatrixTransformation2D<T>* transform(const Math::Matrix3<T>& transformation, TransformationType type = TransformationType::Global) {
RigidMatrixTransformation2D<T>* transform(const Math::Matrix3<T>& transformation, TransformationType type = TransformationType::Global) {
CORRADE_ASSERT(transformation.isRigidTransformation(),
"SceneGraph::RigidMatrixTransformation2D::transform(): the matrix doesn't represent rigid transformation", this);
transformInternal(transformation, type);
@ -130,7 +130,7 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D<T> {
* @copydoc AbstractTranslationRotationScaling2D::translate()
* Same as calling transform() with Matrix3::translation().
*/
inline RigidMatrixTransformation2D<T>* translate(const Math::Vector2<T>& vector, TransformationType type = TransformationType::Global) override {
RigidMatrixTransformation2D<T>* translate(const Math::Vector2<T>& vector, TransformationType type = TransformationType::Global) override {
transformInternal(Math::Matrix3<T>::translation(vector), type);
return this;
}
@ -144,7 +144,7 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D<T> {
* Same as calling transform() with Matrix3::rotation().
* @see normalizeRotation()
*/
inline RigidMatrixTransformation2D<T>* rotate(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
RigidMatrixTransformation2D<T>* rotate(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
transformInternal(Math::Matrix3<T>::rotation(angle), type);
return this;
}
@ -158,7 +158,7 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D<T> {
*
* Same as calling transform() with Matrix3::reflection().
*/
inline RigidMatrixTransformation2D<T>* reflect(const Math::Vector2<T>& normal, TransformationType type = TransformationType::Global) {
RigidMatrixTransformation2D<T>* reflect(const Math::Vector2<T>& normal, TransformationType type = TransformationType::Global) {
transformInternal(Math::Matrix3<T>::reflection(normal), type);
return this;
}
@ -169,18 +169,18 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D<T> {
* if you want to move it above all.
* @return Pointer to self (for method chaining)
*/
inline RigidMatrixTransformation2D<T>* move(Object<RigidMatrixTransformation2D<T>>* under) {
RigidMatrixTransformation2D<T>* move(Object<RigidMatrixTransformation2D<T>>* under) {
static_cast<Object<RigidMatrixTransformation2D>*>(this)->Containers::template LinkedList<Object<RigidMatrixTransformation2D<T>>>::move(this, under);
return this;
}
protected:
/* Allow construction only from Object */
inline explicit RigidMatrixTransformation2D() = default;
explicit RigidMatrixTransformation2D() = default;
private:
/* No assertions fired, for internal use */
inline void setTransformationInternal(const Math::Matrix3<T>& transformation) {
void setTransformationInternal(const Math::Matrix3<T>& transformation) {
/* Setting transformation is forbidden for the scene */
/** @todo Assert for this? */
/** @todo Do this in some common code so we don't need to include Object? */
@ -191,7 +191,7 @@ class RigidMatrixTransformation2D: public AbstractTranslationRotation2D<T> {
}
/* No assertions fired, for internal use */
inline void transformInternal(const Math::Matrix3<T>& transformation, TransformationType type) {
void transformInternal(const Math::Matrix3<T>& transformation, TransformationType type) {
setTransformation(type == TransformationType::Global ?
transformation*_transformation : _transformation*transformation);
}

32
src/SceneGraph/RigidMatrixTransformation3D.h

@ -54,25 +54,25 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
typedef Math::Matrix4<T> DataType;
#ifndef DOXYGEN_GENERATING_OUTPUT
inline static Math::Matrix4<T> fromMatrix(const Math::Matrix4<T>& matrix) {
static Math::Matrix4<T> fromMatrix(const Math::Matrix4<T>& matrix) {
CORRADE_ASSERT(matrix.isRigidTransformation(),
"SceneGraph::RigidMatrixTransformation3D::fromMatrix(): the matrix doesn't represent rigid transformation", {});
return matrix;
}
inline constexpr static Math::Matrix4<T> toMatrix(const Math::Matrix4<T>& transformation) {
constexpr static Math::Matrix4<T> toMatrix(const Math::Matrix4<T>& transformation) {
return transformation;
}
inline static Math::Matrix4<T> compose(const Math::Matrix4<T>& parent, const Math::Matrix4<T>& child) {
static Math::Matrix4<T> compose(const Math::Matrix4<T>& parent, const Math::Matrix4<T>& child) {
return parent*child;
}
inline static Math::Matrix4<T> inverted(const Math::Matrix4<T>& transformation) {
static Math::Matrix4<T> inverted(const Math::Matrix4<T>& transformation) {
return transformation.invertedRigid();
}
inline Math::Matrix4<T> transformation() const {
Math::Matrix4<T> transformation() const {
return _transformation;
}
#endif
@ -105,7 +105,7 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
return this;
}
inline RigidMatrixTransformation3D<T>* resetTransformation() override {
RigidMatrixTransformation3D<T>* resetTransformation() override {
setTransformation({});
return this;
}
@ -119,7 +119,7 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* Expects that the matrix represents rigid transformation.
* @see Matrix4::isRigidTransformation()
*/
inline RigidMatrixTransformation3D<T>* transform(const Math::Matrix4<T>& transformation, TransformationType type = TransformationType::Global) {
RigidMatrixTransformation3D<T>* transform(const Math::Matrix4<T>& transformation, TransformationType type = TransformationType::Global) {
CORRADE_ASSERT(transformation.isRigidTransformation(),
"SceneGraph::RigidMatrixTransformation3D::transform(): the matrix doesn't represent rigid transformation", this);
transformInternal(transformation, type);
@ -130,7 +130,7 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* @copydoc AbstractTranslationRotationScaling3D::translate()
* Same as calling transform() with Matrix4::translation().
*/
inline RigidMatrixTransformation3D<T>* translate(const Math::Vector3<T>& vector, TransformationType type = TransformationType::Global) override {
RigidMatrixTransformation3D<T>* translate(const Math::Vector3<T>& vector, TransformationType type = TransformationType::Global) override {
transformInternal(Math::Matrix4<T>::translation(vector), type);
return this;
}
@ -146,7 +146,7 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* @see rotateX(), rotateY(), rotateZ(), Vector3::xAxis(),
* Vector3::yAxis(), Vector3::zAxis(), normalizeRotation()
*/
inline RigidMatrixTransformation3D<T>* rotate(Math::Rad<T> angle, const Math::Vector3<T>& normalizedAxis, TransformationType type = TransformationType::Global) override {
RigidMatrixTransformation3D<T>* rotate(Math::Rad<T> angle, const Math::Vector3<T>& normalizedAxis, TransformationType type = TransformationType::Global) override {
transformInternal(Math::Matrix4<T>::rotation(angle, normalizedAxis), type);
return this;
}
@ -160,7 +160,7 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* Same as calling transform() with Matrix4::rotationX().
* @see normalizeRotation()
*/
inline RigidMatrixTransformation3D<T>* rotateX(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
RigidMatrixTransformation3D<T>* rotateX(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
transformInternal(Math::Matrix4<T>::rotationX(angle), type);
return this;
}
@ -174,7 +174,7 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* Same as calling transform() with Matrix4::rotationY().
* @see normalizeRotation()
*/
inline RigidMatrixTransformation3D<T>* rotateY(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
RigidMatrixTransformation3D<T>* rotateY(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
transformInternal(Math::Matrix4<T>::rotationY(angle), type);
return this;
}
@ -188,7 +188,7 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
* Same as calling transform() with Matrix4::rotationZ().
* @see normalizeRotation()
*/
inline RigidMatrixTransformation3D<T>* rotateZ(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
RigidMatrixTransformation3D<T>* rotateZ(Math::Rad<T> angle, TransformationType type = TransformationType::Global) override {
transformInternal(Math::Matrix4<T>::rotationZ(angle), type);
return this;
}
@ -202,18 +202,18 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
*
* Same as calling transform() with Matrix4::reflection().
*/
inline RigidMatrixTransformation3D<T>* reflect(const Math::Vector3<T>& normal, TransformationType type = TransformationType::Global) {
RigidMatrixTransformation3D<T>* reflect(const Math::Vector3<T>& normal, TransformationType type = TransformationType::Global) {
transformInternal(Math::Matrix4<T>::reflection(normal), type);
return this;
}
protected:
/* Allow construction only from Object */
inline explicit RigidMatrixTransformation3D() = default;
explicit RigidMatrixTransformation3D() = default;
private:
/* No assertions fired, for internal use */
inline void setTransformationInternal(const Math::Matrix4<T>& transformation) {
void setTransformationInternal(const Math::Matrix4<T>& transformation) {
/* Setting transformation is forbidden for the scene */
/** @todo Assert for this? */
/** @todo Do this in some common code so we don't need to include Object? */
@ -224,7 +224,7 @@ class RigidMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
}
/* No assertions fired, for internal use */
inline void transformInternal(const Math::Matrix4<T>& transformation, TransformationType type) {
void transformInternal(const Math::Matrix4<T>& transformation, TransformationType type) {
setTransformation(type == TransformationType::Global ?
transformation*_transformation : _transformation*transformation);
}

2
src/SceneGraph/Scene.h

@ -42,7 +42,7 @@ template<class Transformation> class Scene: public Object<Transformation> {
public:
explicit Scene() = default;
inline bool isScene() const { return true; }
bool isScene() const { return true; }
};
}}

2
src/SceneGraph/Test/CameraTest.cpp

@ -160,7 +160,7 @@ void CameraTest::projectionSizeViewport() {
void CameraTest::draw() {
class Drawable: public SceneGraph::Drawable<3> {
public:
inline Drawable(AbstractObject<3>* object, DrawableGroup<3>* group, Matrix4& result): SceneGraph::Drawable<3>(object, group), result(result) {}
Drawable(AbstractObject<3>* object, DrawableGroup<3>* group, Matrix4& result): SceneGraph::Drawable<3>(object, group), result(result) {}
protected:
void draw(const Matrix4& transformationMatrix, AbstractCamera<3>*) {

2
src/SceneGraph/Test/ObjectTest.cpp

@ -52,7 +52,7 @@ typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D<>> Scene3D;
class CachingObject: public Object3D, AbstractFeature<3> {
public:
inline CachingObject(Object3D* parent = nullptr): Object3D(parent), AbstractFeature<3>(this) {
CachingObject(Object3D* parent = nullptr): Object3D(parent), AbstractFeature<3>(this) {
setCachedTransformations(CachedTransformation::Absolute);
}

Loading…
Cancel
Save