Browse Source

Better usage of *Basic* in class names, part 4: SceneGraph transformations.

Use AbstractTransformation<dimensions, T> like before and add two
kinds of aliases instead of only one:
AbstractBasicTransformation2D<T>/AbstractBasicTransformation3D<T> for
abstract type and AbstractTransformation2D/AbstractTransformation3D for
Float.

Partially reverts commit 346ea2feb6.
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
35fc4684d4
  1. 53
      src/SceneGraph/AbstractTransformation.h
  2. 5
      src/SceneGraph/AbstractTranslationRotation2D.h
  3. 5
      src/SceneGraph/AbstractTranslationRotation3D.h
  4. 2
      src/SceneGraph/AbstractTranslationRotationScaling3D.h
  5. 2
      src/SceneGraph/Object.hpp
  6. 13
      src/SceneGraph/SceneGraph.h
  7. 4
      src/SceneGraph/instantiation.cpp

53
src/SceneGraph/AbstractTransformation.h

@ -25,7 +25,7 @@
*/
/** @file
* @brief Class Magnum::SceneGraph::AbstractBasicTransformation, enum Magnum::SceneGraph::TransformationType, typedef Magnum::SceneGraph::AbstractTransformation2D, Magnum::SceneGraph::AbstractTransformation3D
* @brief Class Magnum::SceneGraph::AbstractTransformation, alias Magnum::SceneGraph::AbstractBasicTransformation2D, Magnum::SceneGraph::AbstractBasicTransformation3D, typedef Magnum::SceneGraph::AbstractTransformation2D, Magnum::SceneGraph::AbstractTransformation3D, enum Magnum::SceneGraph::TransformationType
*/
#include <vector>
@ -50,10 +50,11 @@ When subclassing, you have to:
- Implement all members listed in **Subclass implementation** group above
- Provide implicit (parameterless) constructor
@see @ref AbstractTransformation2D, @ref AbstractTransformation3D,
@ref scenegraph
@see @ref scenegraph, @ref AbstractBasicTransformation2D,
@ref AbstractBasicTransformation3D, @ref AbstractTransformation2D,
@ref AbstractTransformation3D
*/
template<UnsignedInt dimensions, class T> class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicTransformation {
template<UnsignedInt dimensions, class T> class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation {
public:
/** @brief Underlying floating-point type */
typedef T Type;
@ -61,7 +62,7 @@ template<UnsignedInt dimensions, class T> class MAGNUM_SCENEGRAPH_EXPORT Abstrac
/** @brief Dimension count */
static const UnsignedInt Dimensions = dimensions;
explicit AbstractBasicTransformation();
explicit AbstractTransformation();
#ifdef DOXYGEN_GENERATING_OUTPUT
/**
@ -137,13 +138,13 @@ template<UnsignedInt dimensions, class T> class MAGNUM_SCENEGRAPH_EXPORT Abstrac
* @brief Reset object transformation
* @return Pointer to self (for method chaining)
*/
AbstractBasicTransformation<dimensions, T>* resetTransformation() {
AbstractTransformation<dimensions, T>* resetTransformation() {
doResetTransformation();
return this;
}
protected:
~AbstractBasicTransformation() = default;
~AbstractTransformation() = default;
#ifdef DOXYGEN_GENERATING_OUTPUT
protected:
@ -163,19 +164,53 @@ enum class TransformationType: UnsignedByte {
Local = 0x01
};
#ifndef CORRADE_GCC46_COMPATIBILITY
/**
@brief Base transformation for two-dimensional scenes
Convenience alternative to <tt>%AbstractTransformation<2, T></tt>. See
AbstractTransformation for more information.
@note Not available on GCC < 4.7. Use <tt>%AbstractTransformation<2, T></tt>
instead.
@see @ref AbstractTransformation2D, @ref AbstractBasicTransformation3D
*/
template<class T> using AbstractBasicTransformation2D = AbstractTransformation<2, T>;
#endif
/**
@brief Base transformation for two-dimensional float scenes
@see @ref AbstractTransformation3D
*/
typedef AbstractBasicTransformation<2, Float> AbstractTransformation2D;
#ifndef CORRADE_GCC46_COMPATIBILITY
typedef AbstractBasicTransformation2D<Float> AbstractTransformation2D;
#else
typedef AbstractTransformation<2, Float> AbstractTransformation2D;
#endif
#ifndef CORRADE_GCC46_COMPATIBILITY
/**
@brief Base transformation for three-dimensional scenes
Convenience alternative to <tt>%AbstractTransformation<3, T></tt>. See
AbstractTransformation for more information.
@note Not available on GCC < 4.7. Use <tt>%AbstractTransformation<3, T></tt>
instead.
@see @ref AbstractTransformation3D, @ref AbstractBasicTransformation3D
*/
template<class T> using AbstractBasicTransformation3D = AbstractTransformation<3, T>;
#endif
/**
@brief Base transformation for three-dimensional float scenes
@see @ref AbstractTransformation2D
*/
typedef AbstractBasicTransformation<3, Float> AbstractTransformation3D;
#ifndef CORRADE_GCC46_COMPATIBILITY
typedef AbstractBasicTransformation3D<Float> AbstractTransformation3D;
#else
typedef AbstractTransformation<3, Float> AbstractTransformation3D;
#endif
}}

5
src/SceneGraph/AbstractTranslationRotation2D.h

@ -36,8 +36,9 @@ namespace Magnum { namespace SceneGraph {
@brief Base translation for two-dimensional scenes supporting translation and rotation
@see @ref AbstractTranslationRotation2D, @ref scenegraph, @ref AbstractBasicTranslationRotation3D
@todo Use AbstractBasicTransformation2D<T> when support for GCC 4.6 is dropped
*/
template<class T> class AbstractBasicTranslationRotation2D: public AbstractBasicTransformation<2, T> {
template<class T> class AbstractBasicTranslationRotation2D: public AbstractTransformation<2, T> {
public:
explicit AbstractBasicTranslationRotation2D() = default;
@ -68,7 +69,7 @@ template<class T> class AbstractBasicTranslationRotation2D: public AbstractBasic
/* Overloads to remove WTF-factor from method chaining order */
#ifndef DOXYGEN_GENERATING_OUTPUT
AbstractBasicTranslationRotation2D<T>* resetTransformation() {
AbstractBasicTransformation<2, T>::resetTransformation();
AbstractTransformation<2, T>::resetTransformation();
return this;
}
#endif

5
src/SceneGraph/AbstractTranslationRotation3D.h

@ -37,8 +37,9 @@ namespace Magnum { namespace SceneGraph {
@brief Base translation for three-dimensional scenes supporting translation and rotation
@see @ref AbstractTranslationRotation3D @ref scenegraph, @ref AbstractBasicTranslationRotation2D
@todo Use AbstractBasicTransformation3D<T> when support for GCC 4.6 is dropped
*/
template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasicTransformation<3, T> {
template<class T> class AbstractBasicTranslationRotation3D: public AbstractTransformation<3, T> {
public:
explicit AbstractBasicTranslationRotation3D() = default;
@ -115,7 +116,7 @@ template<class T> class AbstractBasicTranslationRotation3D: public AbstractBasic
/* Overloads to remove WTF-factor from method chaining order */
#ifndef DOXYGEN_GENERATING_OUTPUT
AbstractBasicTranslationRotation3D<T>* resetTransformation() {
AbstractBasicTransformation<3, T>::resetTransformation();
AbstractTransformation<3, T>::resetTransformation();
return this;
}
#endif

2
src/SceneGraph/AbstractTranslationRotationScaling3D.h

@ -33,7 +33,7 @@
namespace Magnum { namespace SceneGraph {
/**
@brief Base for three-dimensional transformations supporting translation, rotation and scaling
@brief Base transformation for three-dimensional scenes supporting translation, rotation and scaling
@see @ref AbstractTranslationRotationScaling3D, @ref scenegraph, @ref AbstractBasicTranslationRotationScaling2D
*/

2
src/SceneGraph/Object.hpp

@ -41,7 +41,7 @@ namespace Magnum { namespace SceneGraph {
template<UnsignedInt dimensions, class T> AbstractObject<dimensions, T>::AbstractObject() {}
template<UnsignedInt dimensions, class T> AbstractObject<dimensions, T>::~AbstractObject() {}
template<UnsignedInt dimensions, class T> AbstractBasicTransformation<dimensions, T>::AbstractBasicTransformation() {}
template<UnsignedInt dimensions, class T> AbstractTransformation<dimensions, T>::AbstractTransformation() {}
template<class Transformation> Object<Transformation>::~Object() = default;

13
src/SceneGraph/SceneGraph.h

@ -78,9 +78,16 @@ typedef AbstractObject<3, Float> AbstractObject3D;
enum class TransformationType: UnsignedByte;
template<UnsignedInt dimensions, class> class AbstractBasicTransformation;
typedef AbstractBasicTransformation<2, Float> AbstractTransformation2D;
typedef AbstractBasicTransformation<3, Float> AbstractTransformation3D;
template<UnsignedInt, class> class AbstractTransformation;
#ifndef CORRADE_GCC46_COMPATIBILITY
template<class T> using AbstractBasicTransformation2D = AbstractTransformation<2, T>;
template<class T> using AbstractBasicTransformation3D = AbstractTransformation<3, T>;
typedef AbstractBasicTransformation2D<Float> AbstractTransformation2D;
typedef AbstractBasicTransformation3D<Float> AbstractTransformation3D;
#else
typedef AbstractTransformation<2, Float> AbstractTransformation2D;
typedef AbstractTransformation<3, Float> AbstractTransformation3D;
#endif
template<class> class AbstractBasicTranslationRotation2D;
template<class> class AbstractBasicTranslationRotation3D;

4
src/SceneGraph/instantiation.cpp

@ -39,8 +39,8 @@ namespace Magnum { namespace SceneGraph {
#ifndef DOXYGEN_GENERATING_OUTPUT
template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject<2, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject<3, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicTransformation<2, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicTransformation<3, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation<2, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation<3, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature<2, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature<3, Float>;

Loading…
Cancel
Save