Browse Source

SceneGraph: using new type aliases in whole SceneGraph namespace.

pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
4e5a6f76eb
  1. 8
      doc/compilation-speedup.dox
  2. 10
      doc/scenegraph.dox
  3. 18
      src/SceneGraph/AbstractCamera.h
  4. 14
      src/SceneGraph/AbstractCamera.hpp
  5. 22
      src/SceneGraph/AbstractFeature.h
  6. 8
      src/SceneGraph/AbstractGroupedFeature.h
  7. 8
      src/SceneGraph/AbstractObject.h
  8. 12
      src/SceneGraph/AbstractTransformation.h
  9. 2
      src/SceneGraph/AbstractTranslationRotation2D.h
  10. 2
      src/SceneGraph/AbstractTranslationRotation3D.h
  11. 2
      src/SceneGraph/AbstractTranslationRotationScaling2D.h
  12. 2
      src/SceneGraph/AbstractTranslationRotationScaling3D.h
  13. 36
      src/SceneGraph/Animable.h
  14. 12
      src/SceneGraph/Animable.hpp
  15. 10
      src/SceneGraph/AnimableGroup.h
  16. 8
      src/SceneGraph/Camera.cpp
  17. 6
      src/SceneGraph/Camera2D.h
  18. 6
      src/SceneGraph/Camera3D.h
  19. 20
      src/SceneGraph/Drawable.h
  20. 2
      src/SceneGraph/EuclideanMatrixTransformation2D.h
  21. 2
      src/SceneGraph/EuclideanMatrixTransformation3D.h
  22. 8
      src/SceneGraph/FeatureGroup.h
  23. 2
      src/SceneGraph/MatrixTransformation2D.h
  24. 2
      src/SceneGraph/MatrixTransformation3D.h
  25. 16
      src/SceneGraph/Object.h
  26. 8
      src/SceneGraph/Object.hpp
  27. 92
      src/SceneGraph/SceneGraph.h
  28. 14
      src/SceneGraph/Test/AnimableTest.cpp
  29. 18
      src/SceneGraph/Test/CameraTest.cpp
  30. 4
      src/SceneGraph/Test/SceneTest.cpp
  31. 2
      src/Trade/SceneData.h

8
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<MatrixTransformation3D<GLdouble>>;
template class Object<MatrixTransformation3D<Double>>;
@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

10
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 <tt>%AbstractObject<2></tt> or <tt>%MatrixTransformation3D<></tt>
instead of <tt>%AbstractObject<2, GLfloat></tt> and <tt>%MatrixTransformation3D&lt;GLfloat&gt;</tt>.
@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
<tt>%AbstractObject<2></tt> or <tt>%MatrixTransformation3D<></tt> instead of
<tt>%AbstractObject<2, Float></tt> and <tt>%MatrixTransformation3D&lt;Float&gt;</tt>.
%Scene graph has implementation of transformations in both 2D and 3D, using
either matrices or combination of position and rotation. Each implementation

18
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<std::uint8_t dimensions, class T> typename DimensionTraits<dimensions, T>::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2<T>& projectionScale, const Vector2i& viewport);
template<UnsignedInt dimensions, class T> typename DimensionTraits<dimensions, T>::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2<T>& 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<std::uint8_t dimensions, class T>
template<UnsignedInt dimensions, class T>
#else
template<std::uint8_t dimensions, class T = GLfloat>
template<UnsignedInt dimensions, class T = Float>
#endif
class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature<dimensions, T> {
public:
@ -170,7 +170,7 @@ for more information.
@see AbstractCamera3D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif
@ -185,7 +185,7 @@ for more information.
@see AbstractCamera2D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif

14
src/SceneGraph/AbstractCamera.hpp

@ -30,7 +30,7 @@ namespace Magnum { namespace SceneGraph {
#ifndef DOXYGEN_GENERATING_OUTPUT
namespace Implementation {
template<std::uint8_t dimensions, class T> class Camera {};
template<UnsignedInt dimensions, class T> class Camera {};
template<class T> class Camera<2, T> {
public:
@ -45,7 +45,7 @@ template<class T> class Camera<3, T> {
}
};
template<std::uint8_t dimensions, class T> typename DimensionTraits<dimensions, T>::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2<T>& projectionScale, const Math::Vector2<GLsizei>& viewport) {
template<UnsignedInt dimensions, class T> typename DimensionTraits<dimensions, T>::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2<T>& 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<std::uint8_t dimensions, class T> typename DimensionTraits<dimensions,
}
#endif
template<std::uint8_t dimensions, class T> AbstractCamera<dimensions, T>::AbstractCamera(AbstractObject<dimensions, T>* object): AbstractFeature<dimensions, T>(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) {
template<UnsignedInt dimensions, class T> AbstractCamera<dimensions, T>::AbstractCamera(AbstractObject<dimensions, T>* object): AbstractFeature<dimensions, T>(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) {
AbstractFeature<dimensions, T>::setCachedTransformations(AbstractFeature<dimensions, T>::CachedTransformation::InvertedAbsolute);
}
template<std::uint8_t dimensions, class T> AbstractCamera<dimensions, T>::~AbstractCamera() {}
template<UnsignedInt dimensions, class T> AbstractCamera<dimensions, T>::~AbstractCamera() {}
template<std::uint8_t dimensions, class T> AbstractCamera<dimensions, T>* AbstractCamera<dimensions, T>::setAspectRatioPolicy(AspectRatioPolicy policy) {
template<UnsignedInt dimensions, class T> AbstractCamera<dimensions, T>* AbstractCamera<dimensions, T>::setAspectRatioPolicy(AspectRatioPolicy policy) {
_aspectRatioPolicy = policy;
fixAspectRatio();
return this;
}
template<std::uint8_t dimensions, class T> void AbstractCamera<dimensions, T>::setViewport(const Math::Vector2<GLsizei>& size) {
template<UnsignedInt dimensions, class T> void AbstractCamera<dimensions, T>::setViewport(const Vector2i& size) {
_viewport = size;
fixAspectRatio();
}
template<std::uint8_t dimensions, class T> void AbstractCamera<dimensions, T>::draw(DrawableGroup<dimensions, T>& group) {
template<UnsignedInt dimensions, class T> void AbstractCamera<dimensions, T>::draw(DrawableGroup<dimensions, T>& group) {
AbstractObject<dimensions, T>* scene = AbstractFeature<dimensions, T>::object()->sceneObject();
CORRADE_ASSERT(scene, "Camera::draw(): cannot draw when camera is not part of any scene", );

22
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<FeatureCachedTransformation, std::uint8_t> FeatureCachedTransformations;
typedef Corrade::Containers::EnumSet<FeatureCachedTransformation, UnsignedByte> 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<std::uint8_t dimensions, class T> class AbstractFeature: private Corrade::Containers::LinkedListItem<AbstractFeature<dimensions, T>, AbstractObject<dimensions, T>>
template<UnsignedInt dimensions, class T> class AbstractFeature: private Corrade::Containers::LinkedListItem<AbstractFeature<dimensions, T>, AbstractObject<dimensions, T>>
#else
template<std::uint8_t dimensions, class T = GLfloat> class AbstractFeature
template<UnsignedInt dimensions, class T = Float> class AbstractFeature
#endif
{
friend class Corrade::Containers::LinkedList<AbstractFeature<dimensions, T>>;
@ -186,7 +186,7 @@ template<std::uint8_t dimensions, class T = GLfloat> 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<std::uint8_t dimensions, class T = GLfloat> class AbstractFeature
#ifndef DOXYGEN_GENERATING_OUTPUT
typedef Implementation::FeatureCachedTransformations CachedTransformations;
#else
typedef Corrade::Containers::EnumSet<CachedTransformation, std::uint8_t> CachedTransformations;
typedef Corrade::Containers::EnumSet<CachedTransformation, UnsignedByte> CachedTransformations;
#endif
/**
@ -280,9 +280,9 @@ template<std::uint8_t dimensions, class T = GLfloat> class AbstractFeature
CachedTransformations _cachedTransformations;
};
template<std::uint8_t dimensions, class T> inline AbstractFeature<dimensions, T>::~AbstractFeature() {}
template<std::uint8_t dimensions, class T> inline void AbstractFeature<dimensions, T>::clean(const typename DimensionTraits<dimensions, T>::MatrixType&) {}
template<std::uint8_t dimensions, class T> inline void AbstractFeature<dimensions, T>::cleanInverted(const typename DimensionTraits<dimensions, T>::MatrixType&) {}
template<UnsignedInt dimensions, class T> inline AbstractFeature<dimensions, T>::~AbstractFeature() {}
template<UnsignedInt dimensions, class T> inline void AbstractFeature<dimensions, T>::clean(const typename DimensionTraits<dimensions, T>::MatrixType&) {}
template<UnsignedInt dimensions, class T> inline void AbstractFeature<dimensions, T>::cleanInverted(const typename DimensionTraits<dimensions, T>::MatrixType&) {}
#ifndef CORRADE_GCC46_COMPATIBILITY
/**
@ -294,7 +294,7 @@ for more information.
@see AbstractFeature3D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif
@ -309,7 +309,7 @@ for more information.
@see AbstractFeature2D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif

8
src/SceneGraph/AbstractGroupedFeature.h

@ -48,9 +48,9 @@ typedef SceneGraph::FeatureGroup3D<Drawable> DrawableGroup;
FeatureGroup, FeatureGroup2D, FeatureGroup3D
*/
#ifndef DOXYGEN_GENERATING_OUTPUT
template<std::uint8_t dimensions, class Derived, class T>
template<UnsignedInt dimensions, class Derived, class T>
#else
template<std::uint8_t dimensions, class Derived, class T = GLfloat>
template<UnsignedInt dimensions, class Derived, class T = Float>
#endif
class AbstractGroupedFeature: public AbstractFeature<dimensions, T> {
friend class FeatureGroup<dimensions, Derived, T>;
@ -103,7 +103,7 @@ AbstractGroupedFeature for more information.
@see AbstractGroupedFeature3D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class Derived, class T = GLfloat>
template<class Derived, class T = Float>
#else
template<class Derived, class T>
#endif
@ -119,7 +119,7 @@ AbstractGroupedFeature for more information.
@see AbstractGroupedFeature2D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class Derived, class T = GLfloat>
template<class Derived, class T = Float>
#else
template<class Derived, class T>
#endif

8
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<std::uint8_t dimensions, class T> class MAGNUM_SCENEGRAPH_EXPORT AbstractObject: private Corrade::Containers::LinkedList<AbstractFeature<dimensions, T>>
template<UnsignedInt dimensions, class T> class MAGNUM_SCENEGRAPH_EXPORT AbstractObject: private Corrade::Containers::LinkedList<AbstractFeature<dimensions, T>>
#else
template<std::uint8_t dimensions, class T = GLfloat> class AbstractObject
template<UnsignedInt dimensions, class T = Float> class AbstractObject
#endif
{
friend class Corrade::Containers::LinkedList<AbstractFeature<dimensions, T>>;
@ -198,7 +198,7 @@ for more information.
@see AbstractObject3D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif
@ -213,7 +213,7 @@ for more information.
@see AbstractObject2D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif

12
src/SceneGraph/AbstractTransformation.h

@ -44,9 +44,9 @@ When subclassing, you have to:
@see @ref scenegraph, AbstractTransformation2D, AbstractTransformation3D
*/
#ifndef DOXYGEN_GENERATING_OUTPUT
template<std::uint8_t dimensions, class T>
template<UnsignedInt dimensions, class T>
#else
template<std::uint8_t dimensions, class T = GLfloat>
template<UnsignedInt dimensions, class T = Float>
#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<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif
@ -166,7 +166,7 @@ AbstractTransformation for more information.
@see AbstractTransformation2D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif

2
src/SceneGraph/AbstractTranslationRotation2D.h

@ -31,7 +31,7 @@ namespace Magnum { namespace SceneGraph {
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class T>
#else
template<class T = GLfloat>
template<class T = Float>
#endif
class AbstractTranslationRotation2D: public AbstractTransformation<2, T> {
public:

2
src/SceneGraph/AbstractTranslationRotation3D.h

@ -32,7 +32,7 @@ namespace Magnum { namespace SceneGraph {
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class T>
#else
template<class T = GLfloat>
template<class T = Float>
#endif
class AbstractTranslationRotation3D: public AbstractTransformation<3, T> {
public:

2
src/SceneGraph/AbstractTranslationRotationScaling2D.h

@ -31,7 +31,7 @@ namespace Magnum { namespace SceneGraph {
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class T>
#else
template<class T = GLfloat>
template<class T = Float>
#endif
class AbstractTranslationRotationScaling2D: public AbstractTranslationRotation2D<T> {
public:

2
src/SceneGraph/AbstractTranslationRotationScaling3D.h

@ -31,7 +31,7 @@ namespace Magnum { namespace SceneGraph {
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class T>
#else
template<class T = GLfloat>
template<class T = Float>
#endif
class AbstractTranslationRotationScaling3D: public AbstractTranslationRotation3D<T> {
public:

36
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<std::uint8_t dimensions, class T>
template<UnsignedInt dimensions, class T>
#else
template<std::uint8_t dimensions, class T = GLfloat>
template<UnsignedInt dimensions, class T = Float>
#endif
class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimensions, Animable<dimensions, T>, T> {
friend class AnimableGroup<dimensions, T>;
@ -153,7 +153,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
~Animable();
/** @brief Animation duration */
inline GLfloat duration() const { return _duration; }
inline Float duration() const { return _duration; }
/** @brief Animation state */
inline AnimationState state() const { return currentState; }
@ -195,7 +195,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
*
* @see isRepeated()
*/
inline std::uint16_t repeatCount() const { return _repeatCount; }
inline UnsignedShort repeatCount() const { return _repeatCount; }
/**
* @brief Set repeat count
@ -205,7 +205,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
* infinitely repeated animation. Default is `0`.
* @see setRepeated()
*/
inline Animable<dimensions, T>* setRepeatCount(std::uint16_t count) {
inline Animable<dimensions, T>* setRepeatCount(UnsignedShort count) {
_repeatCount = count;
return this;
}
@ -227,7 +227,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(GLfloat duration) {
inline Animable<dimensions, T>* setDuration(Float duration) {
_duration = duration;
return this;
}
@ -251,7 +251,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
*
* @see state(), duration(), isRepeated(), repeatCount()
*/
virtual void animationStep(GLfloat time, GLfloat delta) = 0;
virtual void animationStep(Float time, Float delta) = 0;
/**
* @brief Action on animation start
@ -313,13 +313,13 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
inline virtual void animationStopped() {}
private:
GLfloat _duration;
GLfloat startTime, pauseTime;
Float _duration;
Float startTime, pauseTime;
AnimationState previousState;
AnimationState currentState;
bool _repeated;
std::uint16_t _repeatCount;
std::uint16_t repeats;
UnsignedShort _repeatCount;
UnsignedShort repeats;
};
#ifndef CORRADE_GCC46_COMPATIBILITY
@ -332,7 +332,7 @@ information.
@see Animable3D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif
@ -347,7 +347,7 @@ information.
@see Animable2D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif

12
src/SceneGraph/Animable.hpp

@ -26,11 +26,11 @@
namespace Magnum { namespace SceneGraph {
template<std::uint8_t dimensions, class T> Animable<dimensions, T>::Animable(AbstractObject<dimensions, T>* object, AnimableGroup<dimensions, T>* group): AbstractGroupedFeature<dimensions, Animable<dimensions, T>, T>(object, group), _duration(0.0f), startTime(std::numeric_limits<GLfloat>::infinity()), pauseTime(-std::numeric_limits<GLfloat>::infinity()), previousState(AnimationState::Stopped), currentState(AnimationState::Stopped), _repeated(false), _repeatCount(0), repeats(0) {}
template<UnsignedInt dimensions, class T> Animable<dimensions, T>::Animable(AbstractObject<dimensions, T>* object, AnimableGroup<dimensions, T>* group): AbstractGroupedFeature<dimensions, Animable<dimensions, T>, T>(object, group), _duration(0.0f), startTime(std::numeric_limits<Float>::infinity()), pauseTime(-std::numeric_limits<Float>::infinity()), previousState(AnimationState::Stopped), currentState(AnimationState::Stopped), _repeated(false), _repeatCount(0), repeats(0) {}
template<std::uint8_t dimensions, class T> Animable<dimensions, T>::~Animable() {}
template<UnsignedInt dimensions, class T> Animable<dimensions, T>::~Animable() {}
template<std::uint8_t dimensions, class T> Animable<dimensions, T>* Animable<dimensions, T>::setState(AnimationState state) {
template<UnsignedInt dimensions, class T> Animable<dimensions, T>* Animable<dimensions, T>::setState(AnimationState state) {
if(currentState == state) return this;
/* Not allowed (for sanity) */
@ -43,15 +43,15 @@ template<std::uint8_t dimensions, class T> Animable<dimensions, T>* Animable<dim
return this;
}
template<std::uint8_t dimensions, class T> AnimableGroup<dimensions, T>* Animable<dimensions, T>::group() {
template<UnsignedInt dimensions, class T> AnimableGroup<dimensions, T>* Animable<dimensions, T>::group() {
return static_cast<AnimableGroup<dimensions, T>*>(AbstractGroupedFeature<dimensions, Animable<dimensions, T>, T>::group());
}
template<std::uint8_t dimensions, class T> const AnimableGroup<dimensions, T>* Animable<dimensions, T>::group() const {
template<UnsignedInt dimensions, class T> const AnimableGroup<dimensions, T>* Animable<dimensions, T>::group() const {
return static_cast<const AnimableGroup<dimensions, T>*>(AbstractGroupedFeature<dimensions, Animable<dimensions, T>, T>::group());
}
template<std::uint8_t dimensions, class T> void AnimableGroup<dimensions, T>::step(const GLfloat time, const GLfloat delta) {
template<UnsignedInt dimensions, class T> void AnimableGroup<dimensions, T>::step(const Float time, const Float delta) {
if(!_runningCount && !wakeUp) return;
wakeUp = false;

10
src/SceneGraph/AnimableGroup.h

@ -32,9 +32,9 @@ See Animable for more information.
@see @ref scenegraph, AnimableGroup2D, AnimableGroup3D
*/
#ifndef DOXYGEN_GENERATING_OUTPUT
template<std::uint8_t dimensions, class T>
template<UnsignedInt dimensions, class T>
#else
template<std::uint8_t dimensions, class T = GLfloat>
template<UnsignedInt dimensions, class T = Float>
#endif
class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup: public FeatureGroup<dimensions, Animable<dimensions, T>, T> {
friend class Animable<dimensions, T>;
@ -60,7 +60,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup: public FeatureGroup<dimensions, An
* If there are no running animations the function does nothing.
* @see runningCount()
*/
void step(const GLfloat time, const GLfloat delta);
void step(const Float time, const Float delta);
private:
std::size_t _runningCount;
@ -77,7 +77,7 @@ more information.
@see AnimableGroup3D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif
@ -92,7 +92,7 @@ more information.
@see AnimableGroup2D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif

8
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<GLfloat>;
template class Camera3D<GLfloat>;
template class AbstractCamera<2, Float>;
template class AbstractCamera<3, Float>;
template class Camera2D<Float>;
template class Camera3D<Float>;
#endif
}}

6
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<GLfloat>"
- @ref Camera2D "Camera2D<Float>"
@see @ref scenegraph, Camera3D, Drawable, DrawableGroup
*/
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class T>
#else
template<class T = GLfloat>
template<class T = Float>
#endif
class MAGNUM_SCENEGRAPH_EXPORT Camera2D: public AbstractCamera<2, T> {
public:

6
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<GLfloat>"
- @ref Camera3D "Camera3D<Float>"
@see @ref scenegraph, Camera2D, Drawable, DrawableGroup
*/
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class T>
#else
template<class T = GLfloat>
template<class T = Float>
#endif
class MAGNUM_SCENEGRAPH_EXPORT Camera3D: public AbstractCamera<3, T> {
public:

20
src/SceneGraph/Drawable.h

@ -108,9 +108,9 @@ void MyApplication::drawEvent() {
@see @ref scenegraph, Drawable2D, Drawable3D, DrawableGroup2D, DrawableGroup3D
*/
#ifndef DOXYGEN_GENERATING_OUTPUT
template<std::uint8_t dimensions, class T>
template<UnsignedInt dimensions, class T>
#else
template<std::uint8_t dimensions, class T = GLfloat>
template<UnsignedInt dimensions, class T = Float>
#endif
class Drawable: public AbstractGroupedFeature<dimensions, Drawable<dimensions, T>, T> {
public:
@ -145,7 +145,7 @@ information.
@see Drawable3D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif
@ -160,7 +160,7 @@ information.
@see Drawable2D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif
@ -175,16 +175,16 @@ See Drawable for more information.
*/
#ifndef CORRADE_GCC46_COMPATIBILITY
#ifdef DOXYGEN_GENERATING_OUTPUT
template<std::uint8_t dimensions, class T = GLfloat>
template<UnsignedInt dimensions, class T = Float>
#else
template<std::uint8_t dimensions, class T>
template<UnsignedInt dimensions, class T>
#endif
using DrawableGroup = FeatureGroup<dimensions, Drawable<dimensions, T>, T>;
#else
#ifdef DOXYGEN_GENERATING_OUTPUT
template<std::uint8_t dimensions, class T = GLfloat>
template<UnsignedInt dimensions, class T = Float>
#else
template<std::uint8_t dimensions, class T>
template<UnsignedInt dimensions, class T>
#endif
class DrawableGroup: public FeatureGroup<dimensions, Drawable<dimensions, T>, T> {};
#endif
@ -199,7 +199,7 @@ more information.
@see DrawableGroup3D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif
@ -214,7 +214,7 @@ more information.
@see DrawableGroup2D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class T = GLfloat>
template<class T = Float>
#else
template<class T>
#endif

2
src/SceneGraph/EuclideanMatrixTransformation2D.h

@ -38,7 +38,7 @@ transformations.
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class T>
#else
template<class T = GLfloat>
template<class T = Float>
#endif
class EuclideanMatrixTransformation2D: public AbstractTranslationRotation2D<T> {
public:

2
src/SceneGraph/EuclideanMatrixTransformation3D.h

@ -38,7 +38,7 @@ transformations.
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class T>
#else
template<class T = GLfloat>
template<class T = Float>
#endif
class EuclideanMatrixTransformation3D: public AbstractTranslationRotation3D<T> {
public:

8
src/SceneGraph/FeatureGroup.h

@ -34,9 +34,9 @@ See AbstractGroupedFeature for more information.
@see @ref scenegraph, FeatureGroup2D, FeatureGroup3D
*/
#ifndef DOXYGEN_GENERATING_OUTPUT
template<std::uint8_t dimensions, class Feature, class T>
template<UnsignedInt dimensions, class Feature, class T>
#else
template<std::uint8_t dimensions, class Feature, class T = GLfloat>
template<UnsignedInt dimensions, class Feature, class T = Float>
#endif
class FeatureGroup {
friend class AbstractGroupedFeature<dimensions, Feature, T>;
@ -119,7 +119,7 @@ AbstractGroupedFeature for more information.
@see FeatureGroup3D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class Feature, class T = GLfloat>
template<class Feature, class T = Float>
#else
template<class Feature, class T>
#endif
@ -135,7 +135,7 @@ AbstractGroupedFeature for more information.
@see FeatureGroup2D
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
template<class Feature, class T = GLfloat>
template<class Feature, class T = Float>
#else
template<class Feature, class T>
#endif

2
src/SceneGraph/MatrixTransformation2D.h

@ -34,7 +34,7 @@ Uses Math::Matrix3 as underlying type.
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class T>
#else
template<class T = GLfloat>
template<class T = Float>
#endif
class MatrixTransformation2D: public AbstractTranslationRotationScaling2D<T> {
public:

2
src/SceneGraph/MatrixTransformation3D.h

@ -34,7 +34,7 @@ Uses Math::Matrix4 as underlying type.
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class T>
#else
template<class T = GLfloat>
template<class T = Float>
#endif
class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
public:

16
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<ObjectFlag, std::uint8_t> ObjectFlags;
typedef Corrade::Containers::EnumSet<ObjectFlag, UnsignedByte> 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<MatrixTransformation2D<GLfloat>>"
- @ref MatrixTransformation3D "Object<MatrixTransformation3D<GLfloat>>"
- @ref EuclideanMatrixTransformation2D "Object<EuclideanMatrixTransformation2D<GLfloat>>"
- @ref EuclideanMatrixTransformation3D "Object<EuclideanMatrixTransformation3D<GLfloat>>"
- @ref MatrixTransformation2D "Object<MatrixTransformation2D<Float>>"
- @ref MatrixTransformation3D "Object<MatrixTransformation3D<Float>>"
- @ref EuclideanMatrixTransformation2D "Object<EuclideanMatrixTransformation2D<Float>>"
- @ref EuclideanMatrixTransformation3D "Object<EuclideanMatrixTransformation3D<Float>>"
@see Scene, AbstractFeature, AbstractTransformation, DebugTools::ObjectRenderer
*/
@ -249,7 +249,7 @@ template<class Transformation> class MAGNUM_SCENEGRAPH_EXPORT Object: public Abs
typedef Implementation::ObjectFlag Flag;
typedef Implementation::ObjectFlags Flags;
std::uint16_t counter;
UnsignedShort counter;
Flags flags;
};

8
src/SceneGraph/Object.hpp

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

92
src/SceneGraph/SceneGraph.h

@ -19,9 +19,7 @@
* @brief Forward declarations for Magnum::SceneGraph namespace
*/
#include <cstdint>
#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<std::uint8_t dimensions, class T = GLfloat> class AbstractCamera;
template<UnsignedInt dimensions, class T = Float> class AbstractCamera;
#ifndef CORRADE_GCC46_COMPATIBILITY
template<class T = GLfloat> using AbstractCamera2D = AbstractCamera<2, T>;
template<class T = GLfloat> using AbstractCamera3D = AbstractCamera<3, T>;
template<class T = Float> using AbstractCamera2D = AbstractCamera<2, T>;
template<class T = Float> using AbstractCamera3D = AbstractCamera<3, T>;
#endif
template<std::uint8_t dimensions, class T = GLfloat> class AbstractFeature;
template<UnsignedInt dimensions, class T = Float> class AbstractFeature;
#ifndef CORRADE_GCC46_COMPATIBILITY
template<class T = GLfloat> using AbstractFeature2D = AbstractFeature<2, T>;
template<class T = GLfloat> using AbstractFeature3D = AbstractFeature<3, T>;
template<class T = Float> using AbstractFeature2D = AbstractFeature<2, T>;
template<class T = Float> using AbstractFeature3D = AbstractFeature<3, T>;
#endif
template<std::uint8_t dimensions, class Derived, class T = GLfloat> class AbstractGroupedFeature;
template<UnsignedInt dimensions, class Derived, class T = Float> class AbstractGroupedFeature;
#ifndef CORRADE_GCC46_COMPATIBILITY
template<class Derived, class T = GLfloat> using AbstractGroupedFeature2D = AbstractGroupedFeature<2, Derived, T>;
template<class Derived, class T = GLfloat> using AbstractGroupedFeature3D = AbstractGroupedFeature<3, Derived, T>;
template<class Derived, class T = Float> using AbstractGroupedFeature2D = AbstractGroupedFeature<2, Derived, T>;
template<class Derived, class T = Float> using AbstractGroupedFeature3D = AbstractGroupedFeature<3, Derived, T>;
#endif
template<std::uint8_t dimensions, class T = GLfloat> class AbstractObject;
template<UnsignedInt dimensions, class T = Float> class AbstractObject;
#ifndef CORRADE_GCC46_COMPATIBILITY
template<class T = GLfloat> using AbstractObject2D = AbstractObject<2, T>;
template<class T = GLfloat> using AbstractObject3D = AbstractObject<3, T>;
template<class T = Float> using AbstractObject2D = AbstractObject<2, T>;
template<class T = Float> using AbstractObject3D = AbstractObject<3, T>;
#endif
enum class TransformationType: std::uint8_t;
enum class TransformationType: UnsignedByte;
template<std::uint8_t dimensions, class T = GLfloat> class AbstractTransformation;
template<UnsignedInt dimensions, class T = Float> class AbstractTransformation;
#ifndef CORRADE_GCC46_COMPATIBILITY
template<class T = GLfloat> using AbstractTransformation2D = AbstractTransformation<2, T>;
template<class T = GLfloat> using AbstractTransformation3D = AbstractTransformation<3, T>;
template<class T = Float> using AbstractTransformation2D = AbstractTransformation<2, T>;
template<class T = Float> using AbstractTransformation3D = AbstractTransformation<3, T>;
#endif
template<class T = GLfloat> class AbstractTranslationRotation2D;
template<class T = GLfloat> class AbstractTranslationRotation3D;
template<class T = GLfloat> class AbstractTranslationRotationScaling2D;
template<class T = GLfloat> class AbstractTranslationRotationScaling3D;
template<class T = Float> class AbstractTranslationRotation2D;
template<class T = Float> class AbstractTranslationRotation3D;
template<class T = Float> class AbstractTranslationRotationScaling2D;
template<class T = Float> class AbstractTranslationRotationScaling3D;
template<std::uint8_t dimensions, class T = GLfloat> class Animable;
template<UnsignedInt dimensions, class T = Float> class Animable;
#ifndef CORRADE_GCC46_COMPATIBILITY
template<class T = GLfloat> using Animable2D = Animable<2, T>;
template<class T = GLfloat> using Animable3D = Animable<3, T>;
template<class T = Float> using Animable2D = Animable<2, T>;
template<class T = Float> using Animable3D = Animable<3, T>;
#endif
enum class AnimationState: std::uint8_t;
enum class AnimationState: UnsignedByte;
template<std::uint8_t dimensions, class T = GLfloat> class AnimableGroup;
template<UnsignedInt dimensions, class T = Float> class AnimableGroup;
#ifndef CORRADE_GCC46_COMPATIBILITY
template<class T = GLfloat> using AnimableGroup2D = AnimableGroup<2, T>;
template<class T = GLfloat> using AnimableGroup3D = AnimableGroup<3, T>;
template<class T = Float> using AnimableGroup2D = AnimableGroup<2, T>;
template<class T = Float> using AnimableGroup3D = AnimableGroup<3, T>;
#endif
template<class T = GLfloat> class Camera2D;
template<class T = GLfloat> class Camera3D;
template<class T = Float> class Camera2D;
template<class T = Float> class Camera3D;
template<std::uint8_t dimensions, class T = GLfloat> class Drawable;
template<UnsignedInt dimensions, class T = Float> class Drawable;
#ifndef CORRADE_GCC46_COMPATIBILITY
template<class T = GLfloat> using Drawable2D = Drawable<2, T>;
template<class T = GLfloat> using Drawable3D = Drawable<3, T>;
template<class T = Float> using Drawable2D = Drawable<2, T>;
template<class T = Float> using Drawable3D = Drawable<3, T>;
#endif
template<class T = GLfloat> class EuclideanMatrixTransformation2D;
template<class T = GLfloat> class EuclideanMatrixTransformation3D;
template<class T = Float> class EuclideanMatrixTransformation2D;
template<class T = Float> class EuclideanMatrixTransformation3D;
template<std::uint8_t dimensions, class Feature, class T = GLfloat> class FeatureGroup;
template<UnsignedInt dimensions, class Feature, class T = Float> class FeatureGroup;
#ifndef CORRADE_GCC46_COMPATIBILITY
template<class Feature, class T = GLfloat> using FeatureGroup2D = FeatureGroup<2, Feature, T>;
template<class Feature, class T = GLfloat> using FeatureGroup3D = FeatureGroup<3, Feature, T>;
template<class Feature, class T = Float> using FeatureGroup2D = FeatureGroup<2, Feature, T>;
template<class Feature, class T = Float> using FeatureGroup3D = FeatureGroup<3, Feature, T>;
#endif
#ifndef CORRADE_GCC46_COMPATIBILITY
template<std::uint8_t dimensions, class T = GLfloat> using DrawableGroup = FeatureGroup<dimensions, Drawable<dimensions, T>, T>;
template<class T = GLfloat> using DrawableGroup2D = DrawableGroup<2, T>;
template<class T = GLfloat> using DrawableGroup3D = DrawableGroup<3, T>;
template<UnsignedInt dimensions, class T = Float> using DrawableGroup = FeatureGroup<dimensions, Drawable<dimensions, T>, T>;
template<class T = Float> using DrawableGroup2D = DrawableGroup<2, T>;
template<class T = Float> using DrawableGroup3D = DrawableGroup<3, T>;
#else
template<std::uint8_t dimensions, class T = GLfloat> class DrawableGroup;
template<UnsignedInt dimensions, class T = Float> class DrawableGroup;
#endif
template<class T = GLfloat> class MatrixTransformation2D;
template<class T = GLfloat> class MatrixTransformation3D;
template<class T = Float> class MatrixTransformation2D;
template<class T = Float> class MatrixTransformation3D;
template<class Transformation> class Object;
template<class Transformation> class Scene;

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

18
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() {

4
src/SceneGraph/Test/SceneTest.cpp

@ -28,8 +28,8 @@ class SceneTest: public Corrade::TestSuite::Tester {
void parent();
};
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D<GLfloat>> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D<GLfloat>> Object3D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D<Float>> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D<Float>> Object3D;
SceneTest::SceneTest() {
addTests(&SceneTest::transformation,

2
src/Trade/SceneData.h

@ -22,6 +22,8 @@
#include <string>
#include <vector>
#include "Types.h"
namespace Magnum { namespace Trade {
/**

Loading…
Cancel
Save