diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index 458bf4029..e15793dde 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -76,9 +76,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature* object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { - AbstractFeature::setCachedTransformations(AbstractFeature::CachedTransformation::InvertedAbsolute); - } + explicit AbstractCamera(AbstractObject* object); virtual ~AbstractCamera() = 0; @@ -162,8 +160,6 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature inline AbstractCamera::~AbstractCamera() {} - #ifndef CORRADE_GCC46_COMPATIBILITY /** @brief Base for two-dimensional cameras diff --git a/src/SceneGraph/AbstractCamera.hpp b/src/SceneGraph/AbstractCamera.hpp index bbd6166e1..934dad4a3 100644 --- a/src/SceneGraph/AbstractCamera.hpp +++ b/src/SceneGraph/AbstractCamera.hpp @@ -63,6 +63,12 @@ template typename DimensionTraits AbstractCamera::AbstractCamera(AbstractObject* object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { + AbstractFeature::setCachedTransformations(AbstractFeature::CachedTransformation::InvertedAbsolute); +} + +template AbstractCamera::~AbstractCamera() {} + template AbstractCamera* AbstractCamera::setAspectRatioPolicy(AspectRatioPolicy policy) { _aspectRatioPolicy = policy; fixAspectRatio(); diff --git a/src/SceneGraph/AbstractObject.h b/src/SceneGraph/AbstractObject.h index 56ab023c2..7f3d711da 100644 --- a/src/SceneGraph/AbstractObject.h +++ b/src/SceneGraph/AbstractObject.h @@ -25,6 +25,8 @@ #include "DimensionTraits.h" #include "SceneGraph.h" +#include "SceneGraph/magnumSceneGraphVisibility.h" + namespace Magnum { namespace SceneGraph { /** @@ -46,7 +48,7 @@ for(AbstractFeature* feature = o->firstFeature(); feature; feature = feature->ne @see AbstractObject2D, AbstractObject3D */ #ifndef DOXYGEN_GENERATING_OUTPUT -template class AbstractObject: private Corrade::Containers::LinkedList> +template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject: private Corrade::Containers::LinkedList> #else template class AbstractObject #endif @@ -59,8 +61,8 @@ template class AbstractObject /** @brief Feature object type */ typedef AbstractFeature FeatureType; - explicit AbstractObject() = default; - inline virtual ~AbstractObject() {} + explicit AbstractObject(); + virtual ~AbstractObject(); /** @brief Whether this object has features */ inline bool hasFeatures() const { diff --git a/src/SceneGraph/AbstractTransformation.h b/src/SceneGraph/AbstractTransformation.h index 9808195ab..d3eab7d49 100644 --- a/src/SceneGraph/AbstractTransformation.h +++ b/src/SceneGraph/AbstractTransformation.h @@ -24,6 +24,8 @@ #include "DimensionTraits.h" #include "SceneGraph.h" +#include "SceneGraph/magnumSceneGraphVisibility.h" + namespace Magnum { namespace SceneGraph { /** @@ -46,7 +48,7 @@ template #else template #endif -class AbstractTransformation { +class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation { public: /** @brief Underlying floating-point type */ typedef T Type; @@ -54,7 +56,7 @@ class AbstractTransformation { /** @brief Dimension count */ static const std::uint8_t Dimensions = dimensions; - explicit AbstractTransformation() = default; + explicit AbstractTransformation(); virtual ~AbstractTransformation() = 0; #ifdef DOXYGEN_GENERATING_OUTPUT @@ -137,8 +139,6 @@ enum class TransformationType: std::uint8_t { Local = 0x01 }; -template inline AbstractTransformation::~AbstractTransformation() {} - #ifndef CORRADE_GCC46_COMPATIBILITY /** @brief Base for two-dimensional transformations diff --git a/src/SceneGraph/Animable.h b/src/SceneGraph/Animable.h index 000130d33..959dbf32a 100644 --- a/src/SceneGraph/Animable.h +++ b/src/SceneGraph/Animable.h @@ -150,6 +150,8 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature* object, AnimableGroup* group = nullptr); + ~Animable(); + /** @brief Animation duration */ inline GLfloat duration() const { return _duration; } diff --git a/src/SceneGraph/Animable.hpp b/src/SceneGraph/Animable.hpp index a5ef42eb2..c1a3f11f5 100644 --- a/src/SceneGraph/Animable.hpp +++ b/src/SceneGraph/Animable.hpp @@ -28,6 +28,8 @@ namespace Magnum { namespace SceneGraph { template Animable::Animable(AbstractObject* object, AnimableGroup* group): AbstractGroupedFeature, T>(object, group), _duration(0.0f), startTime(std::numeric_limits::infinity()), pauseTime(-std::numeric_limits::infinity()), previousState(AnimationState::Stopped), currentState(AnimationState::Stopped), _repeated(false), _repeatCount(0), repeats(0) {} +template Animable::~Animable() {} + template Animable* Animable::setState(AnimationState state) { if(currentState == state) return this; diff --git a/src/SceneGraph/CMakeLists.txt b/src/SceneGraph/CMakeLists.txt index d8f3b047a..42d69ab81 100644 --- a/src/SceneGraph/CMakeLists.txt +++ b/src/SceneGraph/CMakeLists.txt @@ -2,7 +2,8 @@ set(MagnumSceneGraph_SRCS Animable.cpp Camera.cpp EuclideanMatrixTransformation2D.cpp - EuclideanMatrixTransformation3D.cpp) + EuclideanMatrixTransformation3D.cpp + Object.cpp) set(MagnumSceneGraph_HEADERS AbstractCamera.h AbstractCamera.hpp diff --git a/src/SceneGraph/Camera.cpp b/src/SceneGraph/Camera.cpp index 1bdc04553..6d46a42c7 100644 --- a/src/SceneGraph/Camera.cpp +++ b/src/SceneGraph/Camera.cpp @@ -19,10 +19,10 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT -template class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera<2, GLfloat>; -template class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera<3, GLfloat>; -template class MAGNUM_SCENEGRAPH_EXPORT Camera2D; -template class MAGNUM_SCENEGRAPH_EXPORT Camera3D; +template class AbstractCamera<2, GLfloat>; +template class AbstractCamera<3, GLfloat>; +template class Camera2D; +template class Camera3D; #endif }} diff --git a/src/SceneGraph/Camera2D.h b/src/SceneGraph/Camera2D.h index 37775924f..6674703e1 100644 --- a/src/SceneGraph/Camera2D.h +++ b/src/SceneGraph/Camera2D.h @@ -60,7 +60,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Camera2D: public AbstractCamera<2, T> { * Sets orthographic projection to the default OpenGL cube (range @f$ [-1; 1] @f$ in all directions). * @see setProjection() */ - inline explicit Camera2D(AbstractObject<2, T>* object): AbstractCamera<2, T>(object) {} + explicit Camera2D(AbstractObject<2, T>* object); /** * @brief Set projection diff --git a/src/SceneGraph/Camera2D.hpp b/src/SceneGraph/Camera2D.hpp index 9bea284fc..0241ec8b4 100644 --- a/src/SceneGraph/Camera2D.hpp +++ b/src/SceneGraph/Camera2D.hpp @@ -26,6 +26,8 @@ using namespace std; namespace Magnum { namespace SceneGraph { +template Camera2D::Camera2D(AbstractObject<2, T>* object): AbstractCamera<2, T>(object) {} + template Camera2D* Camera2D::setProjection(const Math::Vector2& size) { AbstractCamera<2, T>::rawProjectionMatrix = Math::Matrix3::projection(size); diff --git a/src/SceneGraph/Camera3D.h b/src/SceneGraph/Camera3D.h index 4551d6bcb..4bd1cb309 100644 --- a/src/SceneGraph/Camera3D.h +++ b/src/SceneGraph/Camera3D.h @@ -62,7 +62,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Camera3D: public AbstractCamera<3, T> { * @brief Constructor * @param object %Object holding this feature */ - inline explicit Camera3D(AbstractObject<3, T>* object): AbstractCamera<3, T>(object), _near(0.0f), _far(0.0f) {} + explicit Camera3D(AbstractObject<3, T>* object); /** * @brief Set orthographic projection diff --git a/src/SceneGraph/Camera3D.hpp b/src/SceneGraph/Camera3D.hpp index 2ca805a09..42e2f5d9d 100644 --- a/src/SceneGraph/Camera3D.hpp +++ b/src/SceneGraph/Camera3D.hpp @@ -24,6 +24,8 @@ namespace Magnum { namespace SceneGraph { +template Camera3D::Camera3D(AbstractObject<3, T>* object): AbstractCamera<3, T>(object) {} + template Camera3D* Camera3D::setOrthographic(const Math::Vector2& size, T near, T far) { /** @todo Get near/far from the matrix */ _near = near; diff --git a/src/SceneGraph/Object.cpp b/src/SceneGraph/Object.cpp new file mode 100644 index 000000000..8bfe038a2 --- /dev/null +++ b/src/SceneGraph/Object.cpp @@ -0,0 +1,25 @@ +/* + 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 "Object.hpp" + +namespace Magnum { namespace SceneGraph { + +template class AbstractObject<2>; +template class AbstractObject<3>; +template class AbstractTransformation<2>; +template class AbstractTransformation<3>; + +}} diff --git a/src/SceneGraph/Object.h b/src/SceneGraph/Object.h index 64f77332b..e3975ef8b 100644 --- a/src/SceneGraph/Object.h +++ b/src/SceneGraph/Object.h @@ -79,7 +79,7 @@ See @ref compilation-speedup-hpp for more information. @see Scene, AbstractFeature, AbstractTransformation, DebugTools::ObjectRenderer */ -template class Object: public AbstractObject, public Transformation +template class MAGNUM_SCENEGRAPH_EXPORT Object: public AbstractObject, public Transformation #ifndef DOXYGEN_GENERATING_OUTPUT , private Corrade::Containers::LinkedList>, private Corrade::Containers::LinkedListItem, Object> #endif @@ -241,11 +241,11 @@ template class Object: public AbstractObject::MatrixType> transformationMatrices(const std::vector*>& objects, const typename DimensionTraits::MatrixType& initialTransformationMatrix = typename DimensionTraits::MatrixType()) const override; - typename Transformation::DataType computeJointTransformation(const std::vector*>& jointObjects, std::vector& jointTransformations, const std::size_t joint, const typename Transformation::DataType& initialTransformation) const; + typename Transformation::DataType MAGNUM_SCENEGRAPH_LOCAL computeJointTransformation(const std::vector*>& jointObjects, std::vector& jointTransformations, const std::size_t joint, const typename Transformation::DataType& initialTransformation) const; void setClean(const std::vector*>& objects) const override; - void setClean(const typename Transformation::DataType& absoluteTransformation); + void MAGNUM_SCENEGRAPH_LOCAL setClean(const typename Transformation::DataType& absoluteTransformation); typedef Implementation::ObjectFlag Flag; typedef Implementation::ObjectFlags Flags; diff --git a/src/SceneGraph/Object.hpp b/src/SceneGraph/Object.hpp index e0911bbd3..72c45dfec 100644 --- a/src/SceneGraph/Object.hpp +++ b/src/SceneGraph/Object.hpp @@ -19,6 +19,7 @@ * @brief @ref compilation-speedup-hpp "Template implementation" for Object.h */ +#include "AbstractTransformation.h" #include "Object.h" #include @@ -28,6 +29,12 @@ namespace Magnum { namespace SceneGraph { +template AbstractObject::AbstractObject() {} +template AbstractObject::~AbstractObject() {} + +template inline AbstractTransformation::AbstractTransformation() {} +template inline AbstractTransformation::~AbstractTransformation() {} + template Scene* Object::scene() { return static_cast*>(sceneObject()); }