diff --git a/doc/compilation-speedup.dox b/doc/compilation-speedup.dox index 99abac95e..8d86d3bb3 100644 --- a/doc/compilation-speedup.dox +++ b/doc/compilation-speedup.dox @@ -31,8 +31,8 @@ available, each namespace has its own: @section compilation-speedup-templates Templates Many things in %Magnum are templated to allow handling of various types and -sizes of data, for example whole Scene graph can operate either with `float`s -or with `double`s. However, having templated classes and function usually +sizes of data, for example whole Scene graph can operate either with @ref Float +or @ref Double data type. However, having templated classes and function usually means that the compiler compiles the whole templated code again in each compilation unit (i.e. source file). In linking stage of the application or library the duplicates are just thrown out, which is a waste of compilation @@ -64,7 +64,7 @@ Sometimes you however need to use your own specialization and that's why template implementation files are included in the library. For example we want to use @ref SceneGraph::Object "Object" from SceneGraph with @ref SceneGraph::MatrixTransformation3D "MatrixTransformation3D" with -`GLdouble` as underlying type, because our scene will span the whole universe. +@ref Double as underlying type, because our scene will span the whole universe. We include the implementation file in dedicated source file and explicitly instantiate the template: @code @@ -73,7 +73,7 @@ instantiate the template: using namespace Magnum::SceneGraph; -template class Object>; +template class Object>; @endcode All other files using the same object specialization now need to include only SceneGraph/Object.h header. Thus the Object specialization will be compiled diff --git a/doc/scenegraph.dox b/doc/scenegraph.dox index 28fec624d..857f9c4d9 100644 --- a/doc/scenegraph.dox +++ b/doc/scenegraph.dox @@ -22,12 +22,12 @@ main components: Transformation handles object position, rotation etc. and its basic property is dimension count (2D or 3D) and underlying floating-point type (by default -`float`s are used everywhere, but you can use `double`s too). +@ref Float type is used everywhere, but you can use @ref Double too). -@note All classes in SceneGraph have `GLfloat` as default underlying - floating-point type, which means that you can omit that template parameter - and write just %AbstractObject<2> or %MatrixTransformation3D<> - instead of %AbstractObject<2, GLfloat> and %MatrixTransformation3D<GLfloat>. +@note All classes in SceneGraph have Float as default underlying floating-point + type, which means that you can omit that template parameter and write just + %AbstractObject<2> or %MatrixTransformation3D<> instead of + %AbstractObject<2, Float> and %MatrixTransformation3D<Float>. %Scene graph has implementation of transformations in both 2D and 3D, using either matrices or combination of position and rotation. Each implementation diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index 4f2c24076..fff05d28d 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -32,7 +32,7 @@ namespace Magnum { namespace SceneGraph { @see AbstractCamera::setAspectRatioPolicy() */ -enum class AspectRatioPolicy: std::uint8_t { +enum class AspectRatioPolicy: UnsignedByte { NotPreserved, /**< Don't preserve aspect ratio (default) */ Extend, /**< Extend on larger side of view */ Clip /**< Clip on smaller side of view */ @@ -40,7 +40,7 @@ enum class AspectRatioPolicy: std::uint8_t { #ifndef DOXYGEN_GENERATING_OUTPUT namespace Implementation { - template typename DimensionTraits::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2& projectionScale, const Vector2i& viewport); + template typename DimensionTraits::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2& projectionScale, const Vector2i& viewport); } #endif @@ -53,22 +53,22 @@ instantiatable, use Camera2D or Camera3D subclasses instead. @section AbstractCamera-explicit-specializations Explicit template specializations The following specialization are explicitly compiled into SceneGraph library. -For other specializations (e.g. using `double` type) you have to use +For other specializations (e.g. using Double type) you have to use AbstractCamera.hpp implementation file to avoid linker errors. See also relevant sections in @ref Camera2D-explicit-specializations "Camera2D" and @ref Camera3D-explicit-specializations "Camera3D" class documentation or @ref compilation-speedup-hpp for more information. - - @ref AbstractCamera "AbstractCamera<2, GLfloat>" - - @ref AbstractCamera "AbstractCamera<3, GLfloat>" + - @ref AbstractCamera "AbstractCamera<2, Float>" + - @ref AbstractCamera "AbstractCamera<3, Float>" @see @ref scenegraph, Drawable, DrawableGroup, AbstractCamera2D, AbstractCamera3D */ #ifndef DOXYGEN_GENERATING_OUTPUT -template +template #else -template +template #endif class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature { public: @@ -170,7 +170,7 @@ for more information. @see AbstractCamera3D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif @@ -185,7 +185,7 @@ for more information. @see AbstractCamera2D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif diff --git a/src/SceneGraph/AbstractCamera.hpp b/src/SceneGraph/AbstractCamera.hpp index a39f85ab9..89840d11d 100644 --- a/src/SceneGraph/AbstractCamera.hpp +++ b/src/SceneGraph/AbstractCamera.hpp @@ -30,7 +30,7 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT namespace Implementation { -template class Camera {}; +template class Camera {}; template class Camera<2, T> { public: @@ -45,7 +45,7 @@ template class Camera<3, T> { } }; -template typename DimensionTraits::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2& projectionScale, const Math::Vector2& viewport) { +template typename DimensionTraits::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2& projectionScale, const Vector2i& viewport) { /* Don't divide by zero / don't preserve anything */ if(projectionScale.x() == 0 || projectionScale.y() == 0 || viewport.x() == 0 || viewport.y() == 0 || aspectRatioPolicy == AspectRatioPolicy::NotPreserved) return {}; @@ -63,24 +63,24 @@ template typename DimensionTraits AbstractCamera::AbstractCamera(AbstractObject* object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { +template AbstractCamera::AbstractCamera(AbstractObject* object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { AbstractFeature::setCachedTransformations(AbstractFeature::CachedTransformation::InvertedAbsolute); } -template AbstractCamera::~AbstractCamera() {} +template AbstractCamera::~AbstractCamera() {} -template AbstractCamera* AbstractCamera::setAspectRatioPolicy(AspectRatioPolicy policy) { +template AbstractCamera* AbstractCamera::setAspectRatioPolicy(AspectRatioPolicy policy) { _aspectRatioPolicy = policy; fixAspectRatio(); return this; } -template void AbstractCamera::setViewport(const Math::Vector2& size) { +template void AbstractCamera::setViewport(const Vector2i& size) { _viewport = size; fixAspectRatio(); } -template void AbstractCamera::draw(DrawableGroup& group) { +template void AbstractCamera::draw(DrawableGroup& group) { AbstractObject* scene = AbstractFeature::object()->sceneObject(); CORRADE_ASSERT(scene, "Camera::draw(): cannot draw when camera is not part of any scene", ); diff --git a/src/SceneGraph/AbstractFeature.h b/src/SceneGraph/AbstractFeature.h index 3b8d344dc..c8b81f45e 100644 --- a/src/SceneGraph/AbstractFeature.h +++ b/src/SceneGraph/AbstractFeature.h @@ -28,12 +28,12 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT namespace Implementation { - enum class FeatureCachedTransformation: std::uint8_t { + enum class FeatureCachedTransformation: UnsignedByte { Absolute = 1 << 0, InvertedAbsolute = 1 << 1 }; - typedef Corrade::Containers::EnumSet FeatureCachedTransformations; + typedef Corrade::Containers::EnumSet FeatureCachedTransformations; CORRADE_ENUMSET_OPERATORS(FeatureCachedTransformations) } @@ -118,9 +118,9 @@ which is automatically extracted from the pointer in our constructor. @see AbstractFeature2D, AbstractFeature3D */ #ifndef DOXYGEN_GENERATING_OUTPUT -template class AbstractFeature: private Corrade::Containers::LinkedListItem, AbstractObject> +template class AbstractFeature: private Corrade::Containers::LinkedListItem, AbstractObject> #else -template class AbstractFeature +template class AbstractFeature #endif { friend class Corrade::Containers::LinkedList>; @@ -186,7 +186,7 @@ template class AbstractFeature #ifndef DOXYGEN_GENERATING_OUTPUT typedef Implementation::FeatureCachedTransformation CachedTransformation; #else - enum class CachedTransformation: std::uint8_t { + enum class CachedTransformation: UnsignedByte { /** * Absolute transformation is cached. * @@ -212,7 +212,7 @@ template class AbstractFeature #ifndef DOXYGEN_GENERATING_OUTPUT typedef Implementation::FeatureCachedTransformations CachedTransformations; #else - typedef Corrade::Containers::EnumSet CachedTransformations; + typedef Corrade::Containers::EnumSet CachedTransformations; #endif /** @@ -280,9 +280,9 @@ template class AbstractFeature CachedTransformations _cachedTransformations; }; -template inline AbstractFeature::~AbstractFeature() {} -template inline void AbstractFeature::clean(const typename DimensionTraits::MatrixType&) {} -template inline void AbstractFeature::cleanInverted(const typename DimensionTraits::MatrixType&) {} +template inline AbstractFeature::~AbstractFeature() {} +template inline void AbstractFeature::clean(const typename DimensionTraits::MatrixType&) {} +template inline void AbstractFeature::cleanInverted(const typename DimensionTraits::MatrixType&) {} #ifndef CORRADE_GCC46_COMPATIBILITY /** @@ -294,7 +294,7 @@ for more information. @see AbstractFeature3D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif @@ -309,7 +309,7 @@ for more information. @see AbstractFeature2D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif diff --git a/src/SceneGraph/AbstractGroupedFeature.h b/src/SceneGraph/AbstractGroupedFeature.h index e1dbfd58b..2672e5d73 100644 --- a/src/SceneGraph/AbstractGroupedFeature.h +++ b/src/SceneGraph/AbstractGroupedFeature.h @@ -48,9 +48,9 @@ typedef SceneGraph::FeatureGroup3D DrawableGroup; FeatureGroup, FeatureGroup2D, FeatureGroup3D */ #ifndef DOXYGEN_GENERATING_OUTPUT -template +template #else -template +template #endif class AbstractGroupedFeature: public AbstractFeature { friend class FeatureGroup; @@ -103,7 +103,7 @@ AbstractGroupedFeature for more information. @see AbstractGroupedFeature3D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif @@ -119,7 +119,7 @@ AbstractGroupedFeature for more information. @see AbstractGroupedFeature2D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif diff --git a/src/SceneGraph/AbstractObject.h b/src/SceneGraph/AbstractObject.h index 3278ed29c..90ad22a96 100644 --- a/src/SceneGraph/AbstractObject.h +++ b/src/SceneGraph/AbstractObject.h @@ -48,9 +48,9 @@ for(AbstractFeature* feature = o->firstFeature(); feature; feature = feature->ne @see AbstractObject2D, AbstractObject3D */ #ifndef DOXYGEN_GENERATING_OUTPUT -template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject: private Corrade::Containers::LinkedList> +template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject: private Corrade::Containers::LinkedList> #else -template class AbstractObject +template class AbstractObject #endif { friend class Corrade::Containers::LinkedList>; @@ -198,7 +198,7 @@ for more information. @see AbstractObject3D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif @@ -213,7 +213,7 @@ for more information. @see AbstractObject2D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif diff --git a/src/SceneGraph/AbstractTransformation.h b/src/SceneGraph/AbstractTransformation.h index 92c2ea62d..10b26f9ee 100644 --- a/src/SceneGraph/AbstractTransformation.h +++ b/src/SceneGraph/AbstractTransformation.h @@ -44,9 +44,9 @@ When subclassing, you have to: @see @ref scenegraph, AbstractTransformation2D, AbstractTransformation3D */ #ifndef DOXYGEN_GENERATING_OUTPUT -template +template #else -template +template #endif class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation { public: @@ -54,7 +54,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation { typedef T Type; /** @brief Dimension count */ - static const std::uint8_t Dimensions = dimensions; + static const UnsignedInt Dimensions = dimensions; explicit AbstractTransformation(); virtual ~AbstractTransformation() = 0; @@ -131,7 +131,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation { }; /** @brief Transformation type */ -enum class TransformationType: std::uint8_t { +enum class TransformationType: UnsignedByte { /** Global transformation, applied after all other transformations. */ Global = 0x00, @@ -150,7 +150,7 @@ AbstractTransformation for more information. @see AbstractTransformation3D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif @@ -166,7 +166,7 @@ AbstractTransformation for more information. @see AbstractTransformation2D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif diff --git a/src/SceneGraph/AbstractTranslationRotation2D.h b/src/SceneGraph/AbstractTranslationRotation2D.h index 33b178d47..c3d17321c 100644 --- a/src/SceneGraph/AbstractTranslationRotation2D.h +++ b/src/SceneGraph/AbstractTranslationRotation2D.h @@ -31,7 +31,7 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT template #else -template +template #endif class AbstractTranslationRotation2D: public AbstractTransformation<2, T> { public: diff --git a/src/SceneGraph/AbstractTranslationRotation3D.h b/src/SceneGraph/AbstractTranslationRotation3D.h index d0f49b47b..c9cca2ecc 100644 --- a/src/SceneGraph/AbstractTranslationRotation3D.h +++ b/src/SceneGraph/AbstractTranslationRotation3D.h @@ -32,7 +32,7 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT template #else -template +template #endif class AbstractTranslationRotation3D: public AbstractTransformation<3, T> { public: diff --git a/src/SceneGraph/AbstractTranslationRotationScaling2D.h b/src/SceneGraph/AbstractTranslationRotationScaling2D.h index 45476a17d..e0318157b 100644 --- a/src/SceneGraph/AbstractTranslationRotationScaling2D.h +++ b/src/SceneGraph/AbstractTranslationRotationScaling2D.h @@ -31,7 +31,7 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT template #else -template +template #endif class AbstractTranslationRotationScaling2D: public AbstractTranslationRotation2D { public: diff --git a/src/SceneGraph/AbstractTranslationRotationScaling3D.h b/src/SceneGraph/AbstractTranslationRotationScaling3D.h index a2a1fb3de..21be3a012 100644 --- a/src/SceneGraph/AbstractTranslationRotationScaling3D.h +++ b/src/SceneGraph/AbstractTranslationRotationScaling3D.h @@ -31,7 +31,7 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT template #else -template +template #endif class AbstractTranslationRotationScaling3D: public AbstractTranslationRotation3D { public: diff --git a/src/SceneGraph/Animable.h b/src/SceneGraph/Animable.h index a58dbfea3..ef0c9c323 100644 --- a/src/SceneGraph/Animable.h +++ b/src/SceneGraph/Animable.h @@ -30,7 +30,7 @@ namespace Magnum { namespace SceneGraph { @see Animable::setState() */ -enum class AnimationState: std::uint8_t { +enum class AnimationState: UnsignedByte { /** * The animation is stopped. The animation will be started from the * beginning when state is changed to @ref AnimationState "AnimationState::Running". @@ -74,7 +74,7 @@ class AnimableObject: public Object3D, SceneGraph::Animable3D<> { // ... } - void animationStep(GLfloat time, GLfloat delta) override { + void animationStep(Float time, Float delta) override { rotateX(15.0_degf*delta); // rotate at 15 degrees per second } } @@ -121,19 +121,19 @@ traversed when calling AnimableGroup::step(), saving precious frame time. @section Animable-explicit-specializations Explicit template specializations The following specialization are explicitly compiled into %SceneGraph library. -For other specializations (e.g. using `double` type) you have to use +For other specializations (e.g. using Double type) you have to use Animable.hpp implementation file to avoid linker errors. See also @ref compilation-speedup-hpp for more information. - - @ref Animable "Animable<2, GLfloat>", @ref AnimableGroup "AnimableGroup<2, GLfloat>" - - @ref Animable "Animable<3, GLfloat>", @ref AnimableGroup "AnimableGroup<3, GLfloat>" + - @ref Animable "Animable<2, Float>", @ref AnimableGroup "AnimableGroup<2, Float>" + - @ref Animable "Animable<3, Float>", @ref AnimableGroup "AnimableGroup<3, Float>" @see @ref scenegraph, Animable2D, Animable3D, AnimableGroup2D, AnimableGroup3D */ #ifndef DOXYGEN_GENERATING_OUTPUT -template +template #else -template +template #endif class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature, T> { friend class AnimableGroup; @@ -153,7 +153,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature* setRepeatCount(std::uint16_t count) { + inline Animable* setRepeatCount(UnsignedShort count) { _repeatCount = count; return this; } @@ -227,7 +227,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature* setDuration(GLfloat duration) { + inline Animable* setDuration(Float duration) { _duration = duration; return this; } @@ -251,7 +251,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature +template #else template #endif @@ -347,7 +347,7 @@ information. @see Animable2D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif diff --git a/src/SceneGraph/Animable.hpp b/src/SceneGraph/Animable.hpp index 619e556c2..4b2789cee 100644 --- a/src/SceneGraph/Animable.hpp +++ b/src/SceneGraph/Animable.hpp @@ -26,11 +26,11 @@ 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(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() {} -template Animable* Animable::setState(AnimationState state) { +template Animable* Animable::setState(AnimationState state) { if(currentState == state) return this; /* Not allowed (for sanity) */ @@ -43,15 +43,15 @@ template Animable* Animable AnimableGroup* Animable::group() { +template AnimableGroup* Animable::group() { return static_cast*>(AbstractGroupedFeature, T>::group()); } -template const AnimableGroup* Animable::group() const { +template const AnimableGroup* Animable::group() const { return static_cast*>(AbstractGroupedFeature, T>::group()); } -template void AnimableGroup::step(const GLfloat time, const GLfloat delta) { +template void AnimableGroup::step(const Float time, const Float delta) { if(!_runningCount && !wakeUp) return; wakeUp = false; diff --git a/src/SceneGraph/AnimableGroup.h b/src/SceneGraph/AnimableGroup.h index 5b6a1780b..3b7081867 100644 --- a/src/SceneGraph/AnimableGroup.h +++ b/src/SceneGraph/AnimableGroup.h @@ -32,9 +32,9 @@ See Animable for more information. @see @ref scenegraph, AnimableGroup2D, AnimableGroup3D */ #ifndef DOXYGEN_GENERATING_OUTPUT -template +template #else -template +template #endif class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup: public FeatureGroup, T> { friend class Animable; @@ -60,7 +60,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup: public FeatureGroup +template #else template #endif @@ -92,7 +92,7 @@ more information. @see AnimableGroup2D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif diff --git a/src/SceneGraph/Camera.cpp b/src/SceneGraph/Camera.cpp index 6d46a42c7..a62f75548 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 AbstractCamera<2, GLfloat>; -template class AbstractCamera<3, GLfloat>; -template class Camera2D; -template class Camera3D; +template class AbstractCamera<2, Float>; +template class AbstractCamera<3, Float>; +template class Camera2D; +template class Camera3D; #endif }} diff --git a/src/SceneGraph/Camera2D.h b/src/SceneGraph/Camera2D.h index 6674703e1..1e3ee9400 100644 --- a/src/SceneGraph/Camera2D.h +++ b/src/SceneGraph/Camera2D.h @@ -38,18 +38,18 @@ camera->setProjection({4.0f/3.0f, 1.0f}) @section Camera2D-explicit-specializations Explicit template specializations The following specialization are explicitly compiled into SceneGraph library. -For other specializations (e.g. using `double` type) you have to use +For other specializations (e.g. using Double type) you have to use Camera2D.hpp implementation file to avoid linker errors. See @ref compilation-speedup-hpp for more information. - - @ref Camera2D "Camera2D" + - @ref Camera2D "Camera2D" @see @ref scenegraph, Camera3D, Drawable, DrawableGroup */ #ifndef DOXYGEN_GENERATING_OUTPUT template #else -template +template #endif class MAGNUM_SCENEGRAPH_EXPORT Camera2D: public AbstractCamera<2, T> { public: diff --git a/src/SceneGraph/Camera3D.h b/src/SceneGraph/Camera3D.h index 70a7258fe..6c62a893f 100644 --- a/src/SceneGraph/Camera3D.h +++ b/src/SceneGraph/Camera3D.h @@ -43,18 +43,18 @@ camera->setPerspective({}, 0.001f, 100.0f) @section Camera3D-explicit-specializations Explicit template specializations The following specialization are explicitly compiled into SceneGraph library. -For other specializations (e.g. using `double` type) you have to use +For other specializations (e.g. using Double type) you have to use Camera3D.hpp implementation file to avoid linker errors. See @ref compilation-speedup-hpp for more information. - - @ref Camera3D "Camera3D" + - @ref Camera3D "Camera3D" @see @ref scenegraph, Camera2D, Drawable, DrawableGroup */ #ifndef DOXYGEN_GENERATING_OUTPUT template #else -template +template #endif class MAGNUM_SCENEGRAPH_EXPORT Camera3D: public AbstractCamera<3, T> { public: diff --git a/src/SceneGraph/Drawable.h b/src/SceneGraph/Drawable.h index daad699c9..27e49f13b 100644 --- a/src/SceneGraph/Drawable.h +++ b/src/SceneGraph/Drawable.h @@ -108,9 +108,9 @@ void MyApplication::drawEvent() { @see @ref scenegraph, Drawable2D, Drawable3D, DrawableGroup2D, DrawableGroup3D */ #ifndef DOXYGEN_GENERATING_OUTPUT -template +template #else -template +template #endif class Drawable: public AbstractGroupedFeature, T> { public: @@ -145,7 +145,7 @@ information. @see Drawable3D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif @@ -160,7 +160,7 @@ information. @see Drawable2D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif @@ -175,16 +175,16 @@ See Drawable for more information. */ #ifndef CORRADE_GCC46_COMPATIBILITY #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else -template +template #endif using DrawableGroup = FeatureGroup, T>; #else #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else -template +template #endif class DrawableGroup: public FeatureGroup, T> {}; #endif @@ -199,7 +199,7 @@ more information. @see DrawableGroup3D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif @@ -214,7 +214,7 @@ more information. @see DrawableGroup2D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif diff --git a/src/SceneGraph/EuclideanMatrixTransformation2D.h b/src/SceneGraph/EuclideanMatrixTransformation2D.h index 12fe4749c..2ea810c5c 100644 --- a/src/SceneGraph/EuclideanMatrixTransformation2D.h +++ b/src/SceneGraph/EuclideanMatrixTransformation2D.h @@ -38,7 +38,7 @@ transformations. #ifndef DOXYGEN_GENERATING_OUTPUT template #else -template +template #endif class EuclideanMatrixTransformation2D: public AbstractTranslationRotation2D { public: diff --git a/src/SceneGraph/EuclideanMatrixTransformation3D.h b/src/SceneGraph/EuclideanMatrixTransformation3D.h index 35cda398e..4a94b9fe4 100644 --- a/src/SceneGraph/EuclideanMatrixTransformation3D.h +++ b/src/SceneGraph/EuclideanMatrixTransformation3D.h @@ -38,7 +38,7 @@ transformations. #ifndef DOXYGEN_GENERATING_OUTPUT template #else -template +template #endif class EuclideanMatrixTransformation3D: public AbstractTranslationRotation3D { public: diff --git a/src/SceneGraph/FeatureGroup.h b/src/SceneGraph/FeatureGroup.h index 229f719c9..2f1856942 100644 --- a/src/SceneGraph/FeatureGroup.h +++ b/src/SceneGraph/FeatureGroup.h @@ -34,9 +34,9 @@ See AbstractGroupedFeature for more information. @see @ref scenegraph, FeatureGroup2D, FeatureGroup3D */ #ifndef DOXYGEN_GENERATING_OUTPUT -template +template #else -template +template #endif class FeatureGroup { friend class AbstractGroupedFeature; @@ -119,7 +119,7 @@ AbstractGroupedFeature for more information. @see FeatureGroup3D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif @@ -135,7 +135,7 @@ AbstractGroupedFeature for more information. @see FeatureGroup2D */ #ifdef DOXYGEN_GENERATING_OUTPUT -template +template #else template #endif diff --git a/src/SceneGraph/MatrixTransformation2D.h b/src/SceneGraph/MatrixTransformation2D.h index 87cb449fc..032246a74 100644 --- a/src/SceneGraph/MatrixTransformation2D.h +++ b/src/SceneGraph/MatrixTransformation2D.h @@ -34,7 +34,7 @@ Uses Math::Matrix3 as underlying type. #ifndef DOXYGEN_GENERATING_OUTPUT template #else -template +template #endif class MatrixTransformation2D: public AbstractTranslationRotationScaling2D { public: diff --git a/src/SceneGraph/MatrixTransformation3D.h b/src/SceneGraph/MatrixTransformation3D.h index 0c613cacb..1e98d447d 100644 --- a/src/SceneGraph/MatrixTransformation3D.h +++ b/src/SceneGraph/MatrixTransformation3D.h @@ -34,7 +34,7 @@ Uses Math::Matrix4 as underlying type. #ifndef DOXYGEN_GENERATING_OUTPUT template #else -template +template #endif class MatrixTransformation3D: public AbstractTranslationRotationScaling3D { public: diff --git a/src/SceneGraph/Object.h b/src/SceneGraph/Object.h index 0b6fb50be..e2d0f8694 100644 --- a/src/SceneGraph/Object.h +++ b/src/SceneGraph/Object.h @@ -30,13 +30,13 @@ namespace Magnum { namespace SceneGraph { #ifndef DOXYGEN_GENERATING_OUTPUT namespace Implementation { - enum class ObjectFlag: std::uint8_t { + enum class ObjectFlag: UnsignedByte { Dirty = 1 << 0, Visited = 1 << 1, Joint = 1 << 2 }; - typedef Corrade::Containers::EnumSet ObjectFlags; + typedef Corrade::Containers::EnumSet ObjectFlags; CORRADE_ENUMSET_OPERATORS(ObjectFlags) } @@ -68,14 +68,14 @@ for(Object* child = o->firstChild(); child; child = child->nextSibling()) { @section Object-explicit-specializations Explicit template specializations The following specialization are explicitly compiled into SceneGraph library. -For other specializations (e.g. using `double` type or special transformation +For other specializations (e.g. using Double type or special transformation class) you have to use Object.hpp implementation file to avoid linker errors. See @ref compilation-speedup-hpp for more information. - - @ref MatrixTransformation2D "Object>" - - @ref MatrixTransformation3D "Object>" - - @ref EuclideanMatrixTransformation2D "Object>" - - @ref EuclideanMatrixTransformation3D "Object>" + - @ref MatrixTransformation2D "Object>" + - @ref MatrixTransformation3D "Object>" + - @ref EuclideanMatrixTransformation2D "Object>" + - @ref EuclideanMatrixTransformation3D "Object>" @see Scene, AbstractFeature, AbstractTransformation, DebugTools::ObjectRenderer */ @@ -249,7 +249,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Object: public Abs typedef Implementation::ObjectFlag Flag; typedef Implementation::ObjectFlags Flags; - std::uint16_t counter; + UnsignedShort counter; Flags flags; }; diff --git a/src/SceneGraph/Object.hpp b/src/SceneGraph/Object.hpp index 708384def..88141f3f0 100644 --- a/src/SceneGraph/Object.hpp +++ b/src/SceneGraph/Object.hpp @@ -29,11 +29,11 @@ namespace Magnum { namespace SceneGraph { -template AbstractObject::AbstractObject() {} -template AbstractObject::~AbstractObject() {} +template AbstractObject::AbstractObject() {} +template AbstractObject::~AbstractObject() {} -template inline AbstractTransformation::AbstractTransformation() {} -template inline AbstractTransformation::~AbstractTransformation() {} +template inline AbstractTransformation::AbstractTransformation() {} +template inline AbstractTransformation::~AbstractTransformation() {} template Scene* Object::scene() { return static_cast*>(sceneObject()); diff --git a/src/SceneGraph/SceneGraph.h b/src/SceneGraph/SceneGraph.h index 014c74383..4b9a3aeb8 100644 --- a/src/SceneGraph/SceneGraph.h +++ b/src/SceneGraph/SceneGraph.h @@ -19,9 +19,7 @@ * @brief Forward declarations for Magnum::SceneGraph namespace */ -#include - -#include "Magnum.h" +#include "Types.h" #include "corradeCompatibility.h" @@ -29,87 +27,87 @@ namespace Magnum { namespace SceneGraph { /** @todoc remove when doxygen is sane again */ #ifndef DOXYGEN_GENERATING_OUTPUT -enum class AspectRatioPolicy: std::uint8_t; +enum class AspectRatioPolicy: UnsignedByte; -template class AbstractCamera; +template class AbstractCamera; #ifndef CORRADE_GCC46_COMPATIBILITY -template using AbstractCamera2D = AbstractCamera<2, T>; -template using AbstractCamera3D = AbstractCamera<3, T>; +template using AbstractCamera2D = AbstractCamera<2, T>; +template using AbstractCamera3D = AbstractCamera<3, T>; #endif -template class AbstractFeature; +template class AbstractFeature; #ifndef CORRADE_GCC46_COMPATIBILITY -template using AbstractFeature2D = AbstractFeature<2, T>; -template using AbstractFeature3D = AbstractFeature<3, T>; +template using AbstractFeature2D = AbstractFeature<2, T>; +template using AbstractFeature3D = AbstractFeature<3, T>; #endif -template class AbstractGroupedFeature; +template class AbstractGroupedFeature; #ifndef CORRADE_GCC46_COMPATIBILITY -template using AbstractGroupedFeature2D = AbstractGroupedFeature<2, Derived, T>; -template using AbstractGroupedFeature3D = AbstractGroupedFeature<3, Derived, T>; +template using AbstractGroupedFeature2D = AbstractGroupedFeature<2, Derived, T>; +template using AbstractGroupedFeature3D = AbstractGroupedFeature<3, Derived, T>; #endif -template class AbstractObject; +template class AbstractObject; #ifndef CORRADE_GCC46_COMPATIBILITY -template using AbstractObject2D = AbstractObject<2, T>; -template using AbstractObject3D = AbstractObject<3, T>; +template using AbstractObject2D = AbstractObject<2, T>; +template using AbstractObject3D = AbstractObject<3, T>; #endif -enum class TransformationType: std::uint8_t; +enum class TransformationType: UnsignedByte; -template class AbstractTransformation; +template class AbstractTransformation; #ifndef CORRADE_GCC46_COMPATIBILITY -template using AbstractTransformation2D = AbstractTransformation<2, T>; -template using AbstractTransformation3D = AbstractTransformation<3, T>; +template using AbstractTransformation2D = AbstractTransformation<2, T>; +template using AbstractTransformation3D = AbstractTransformation<3, T>; #endif -template class AbstractTranslationRotation2D; -template class AbstractTranslationRotation3D; -template class AbstractTranslationRotationScaling2D; -template class AbstractTranslationRotationScaling3D; +template class AbstractTranslationRotation2D; +template class AbstractTranslationRotation3D; +template class AbstractTranslationRotationScaling2D; +template class AbstractTranslationRotationScaling3D; -template class Animable; +template class Animable; #ifndef CORRADE_GCC46_COMPATIBILITY -template using Animable2D = Animable<2, T>; -template using Animable3D = Animable<3, T>; +template using Animable2D = Animable<2, T>; +template using Animable3D = Animable<3, T>; #endif -enum class AnimationState: std::uint8_t; +enum class AnimationState: UnsignedByte; -template class AnimableGroup; +template class AnimableGroup; #ifndef CORRADE_GCC46_COMPATIBILITY -template using AnimableGroup2D = AnimableGroup<2, T>; -template using AnimableGroup3D = AnimableGroup<3, T>; +template using AnimableGroup2D = AnimableGroup<2, T>; +template using AnimableGroup3D = AnimableGroup<3, T>; #endif -template class Camera2D; -template class Camera3D; +template class Camera2D; +template class Camera3D; -template class Drawable; +template class Drawable; #ifndef CORRADE_GCC46_COMPATIBILITY -template using Drawable2D = Drawable<2, T>; -template using Drawable3D = Drawable<3, T>; +template using Drawable2D = Drawable<2, T>; +template using Drawable3D = Drawable<3, T>; #endif -template class EuclideanMatrixTransformation2D; -template class EuclideanMatrixTransformation3D; +template class EuclideanMatrixTransformation2D; +template class EuclideanMatrixTransformation3D; -template class FeatureGroup; +template class FeatureGroup; #ifndef CORRADE_GCC46_COMPATIBILITY -template using FeatureGroup2D = FeatureGroup<2, Feature, T>; -template using FeatureGroup3D = FeatureGroup<3, Feature, T>; +template using FeatureGroup2D = FeatureGroup<2, Feature, T>; +template using FeatureGroup3D = FeatureGroup<3, Feature, T>; #endif #ifndef CORRADE_GCC46_COMPATIBILITY -template using DrawableGroup = FeatureGroup, T>; -template using DrawableGroup2D = DrawableGroup<2, T>; -template using DrawableGroup3D = DrawableGroup<3, T>; +template using DrawableGroup = FeatureGroup, T>; +template using DrawableGroup2D = DrawableGroup<2, T>; +template using DrawableGroup3D = DrawableGroup<3, T>; #else -template class DrawableGroup; +template class DrawableGroup; #endif -template class MatrixTransformation2D; -template class MatrixTransformation3D; +template class MatrixTransformation2D; +template class MatrixTransformation3D; template class Object; template class Scene; diff --git a/src/SceneGraph/Test/AnimableTest.cpp b/src/SceneGraph/Test/AnimableTest.cpp index 1be3a1fd4..b7984c849 100644 --- a/src/SceneGraph/Test/AnimableTest.cpp +++ b/src/SceneGraph/Test/AnimableTest.cpp @@ -58,7 +58,7 @@ void AnimableTest::state() { std::string trackedState; protected: - void animationStep(GLfloat, GLfloat) override {} + void animationStep(Float, Float) override {} void animationStarted() override { trackedState += "started"; } void animationPaused() override { trackedState += "paused"; } @@ -146,11 +146,11 @@ class OneShotAnimable: public SceneGraph::Animable<3> { setState(AnimationState::Running); } - GLfloat time; + Float time; std::string stateChanges; protected: - void animationStep(GLfloat time, GLfloat) override { + void animationStep(Float time, Float) override { this->time = time; } @@ -168,10 +168,10 @@ void AnimableTest::step() { public: InifiniteAnimable(AbstractObject<3>* object, AnimableGroup<3>* group = nullptr): SceneGraph::Animable<3>(object, group), time(-1.0f), delta(0.0f) {} - GLfloat time, delta; + Float time, delta; protected: - void animationStep(GLfloat time, GLfloat delta) override { + void animationStep(Float time, Float delta) override { this->time = time; this->delta = delta; } @@ -231,10 +231,10 @@ void AnimableTest::repeat() { setRepeated(true); } - GLfloat time; + Float time; protected: - void animationStep(GLfloat time, GLfloat) override { + void animationStep(Float time, Float) override { this->time = time; } }; diff --git a/src/SceneGraph/Test/CameraTest.cpp b/src/SceneGraph/Test/CameraTest.cpp index a5d504365..82e47eb8e 100644 --- a/src/SceneGraph/Test/CameraTest.cpp +++ b/src/SceneGraph/Test/CameraTest.cpp @@ -65,37 +65,37 @@ void CameraTest::fixAspectRatio() { Vector2 projectionScaleZeroX(0.0f, 0.5f); Vector2i sizeZeroY(400, 0); Vector2i sizeZeroX(0, 300); - CORRADE_COMPARE((Implementation::aspectRatioFix<3, GLfloat>(AspectRatioPolicy::Clip, projectionScaleZeroX, size)), Matrix4()); - CORRADE_COMPARE((Implementation::aspectRatioFix<3, GLfloat>(AspectRatioPolicy::Clip, projectionScaleZeroY, size)), Matrix4()); - CORRADE_COMPARE((Implementation::aspectRatioFix<3, GLfloat>(AspectRatioPolicy::Clip, projectionScale, sizeZeroY)), Matrix4()); - CORRADE_COMPARE((Implementation::aspectRatioFix<3, GLfloat>(AspectRatioPolicy::Extend, projectionScale, sizeZeroX)), Matrix4()); + CORRADE_COMPARE((Implementation::aspectRatioFix<3, Float>(AspectRatioPolicy::Clip, projectionScaleZeroX, size)), Matrix4()); + CORRADE_COMPARE((Implementation::aspectRatioFix<3, Float>(AspectRatioPolicy::Clip, projectionScaleZeroY, size)), Matrix4()); + CORRADE_COMPARE((Implementation::aspectRatioFix<3, Float>(AspectRatioPolicy::Clip, projectionScale, sizeZeroY)), Matrix4()); + CORRADE_COMPARE((Implementation::aspectRatioFix<3, Float>(AspectRatioPolicy::Extend, projectionScale, sizeZeroX)), Matrix4()); /* Not preserved */ - CORRADE_COMPARE((Implementation::aspectRatioFix<3, GLfloat>(AspectRatioPolicy::NotPreserved, projectionScale, size)), Matrix4()); + CORRADE_COMPARE((Implementation::aspectRatioFix<3, Float>(AspectRatioPolicy::NotPreserved, projectionScale, size)), Matrix4()); /* Clip */ Matrix4 expectedClip({1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 4.0f/3.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 1.0f}); - CORRADE_COMPARE((Implementation::aspectRatioFix<3, GLfloat>(AspectRatioPolicy::Clip, Vector2(0.5f), size)), expectedClip); + CORRADE_COMPARE((Implementation::aspectRatioFix<3, Float>(AspectRatioPolicy::Clip, Vector2(0.5f), size)), expectedClip); Matrix4 expectedClipRectangle({1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 2.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 1.0f}); - CORRADE_COMPARE((Implementation::aspectRatioFix<3, GLfloat>(AspectRatioPolicy::Clip, projectionScale, size)), expectedClipRectangle); + CORRADE_COMPARE((Implementation::aspectRatioFix<3, Float>(AspectRatioPolicy::Clip, projectionScale, size)), expectedClipRectangle); /* Extend */ Matrix4 expectedExtend({3.0f/4.0f, 0.0f, 0.0f, 0.0f}, { 0.0f, 1.0f, 0.0f, 0.0f}, { 0.0f, 0.0f, 1.0f, 0.0f}, { 0.0f, 0.0f, 0.0f, 1.0f}); - CORRADE_COMPARE((Implementation::aspectRatioFix<3, GLfloat>(AspectRatioPolicy::Extend, Vector2(0.5f), size)), expectedExtend); + CORRADE_COMPARE((Implementation::aspectRatioFix<3, Float>(AspectRatioPolicy::Extend, Vector2(0.5f), size)), expectedExtend); Matrix4 expectedExtendRectangle({0.5f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 1.0f}); - CORRADE_COMPARE((Implementation::aspectRatioFix<3, GLfloat>(AspectRatioPolicy::Extend, projectionScale, size)), expectedExtendRectangle); + CORRADE_COMPARE((Implementation::aspectRatioFix<3, Float>(AspectRatioPolicy::Extend, projectionScale, size)), expectedExtendRectangle); } void CameraTest::defaultProjection2D() { diff --git a/src/SceneGraph/Test/SceneTest.cpp b/src/SceneGraph/Test/SceneTest.cpp index a8c7b177e..1baebacb5 100644 --- a/src/SceneGraph/Test/SceneTest.cpp +++ b/src/SceneGraph/Test/SceneTest.cpp @@ -28,8 +28,8 @@ class SceneTest: public Corrade::TestSuite::Tester { void parent(); }; -typedef SceneGraph::Scene> Scene3D; -typedef SceneGraph::Object> Object3D; +typedef SceneGraph::Scene> Scene3D; +typedef SceneGraph::Object> Object3D; SceneTest::SceneTest() { addTests(&SceneTest::transformation, diff --git a/src/Trade/SceneData.h b/src/Trade/SceneData.h index acc962870..ada693798 100644 --- a/src/Trade/SceneData.h +++ b/src/Trade/SceneData.h @@ -22,6 +22,8 @@ #include #include +#include "Types.h" + namespace Magnum { namespace Trade { /**