diff --git a/src/SceneGraph/AbstractCamera.hpp b/src/SceneGraph/AbstractCamera.hpp index 56f5c767f..413cc4b86 100644 --- a/src/SceneGraph/AbstractCamera.hpp +++ b/src/SceneGraph/AbstractCamera.hpp @@ -71,7 +71,7 @@ template typename DimensionTraits AbstractCamera::AbstractCamera(AbstractObject* object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { - AbstractFeature::setCachedTransformations(AbstractFeature::CachedTransformation::InvertedAbsolute); + AbstractFeature::setCachedTransformations(CachedTransformation::InvertedAbsolute); } template AbstractCamera::~AbstractCamera() {} diff --git a/src/SceneGraph/AbstractFeature.h b/src/SceneGraph/AbstractFeature.h index 200e8c4a5..ea421e132 100644 --- a/src/SceneGraph/AbstractFeature.h +++ b/src/SceneGraph/AbstractFeature.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractFeature, alias Magnum::SceneGraph::AbstractFeature2D, Magnum::SceneGraph::AbstractFeature3D + * @brief Class Magnum::SceneGraph::AbstractFeature, alias Magnum::SceneGraph::AbstractFeature2D, Magnum::SceneGraph::AbstractFeature3D, enum Magnum::SceneGraph::CachedTransformation, enum set Magnum::SceneGraph::CachedTransformations */ #include @@ -36,16 +36,41 @@ namespace Magnum { namespace SceneGraph { -namespace Implementation { - enum class FeatureCachedTransformation: UnsignedByte { - Absolute = 1 << 0, - InvertedAbsolute = 1 << 1 - }; +/** +@brief Which transformation to cache in given feature + +@see @ref scenegraph-caching, CachedTransformations, + AbstractFeature::setCachedTransformations(), AbstractFeature::clean(), + AbstractFeature::cleanInverted() +@todo Provide also simpler representations from which could benefit + other transformation implementations, as they won't need to + e.g. create transformation matrix from quaternion? + */ +enum class CachedTransformation: UnsignedByte { + /** + * Absolute transformation is cached. + * + * If enabled, clean() is called when cleaning object. + */ + Absolute = 1 << 0, + + /** + * Inverted absolute transformation is cached. + * + * If enabled, cleanInverted() is called when cleaning object. + */ + InvertedAbsolute = 1 << 1 +}; - typedef Containers::EnumSet FeatureCachedTransformations; +/** +@brief Which transformations to cache in this feature - CORRADE_ENUMSET_OPERATORS(FeatureCachedTransformations) -} +@see @ref scenegraph-caching, AbstractFeature::setCachedTransformations(), + AbstractFeature::clean(), AbstractFeature::cleanInverted() +*/ +typedef Containers::EnumSet CachedTransformations; + +CORRADE_ENUMSET_OPERATORS(CachedTransformations) /** @brief Base for object features @@ -190,48 +215,6 @@ template class AbstractFeature * See @ref scenegraph-caching for more information. */ - /** - * @brief Which transformation to cache in this feature - * - * @see @ref scenegraph-caching, CachedTransformations, - * setCachedTransformations(), clean(), cleanInverted() - * @todo Provide also simpler representations from which could benefit - * other transformation implementations, as they won't need to - * e.g. create transformation matrix from quaternion? - * @todo Move outside templated class so it's easier to type - */ - #ifndef DOXYGEN_GENERATING_OUTPUT - typedef Implementation::FeatureCachedTransformation CachedTransformation; - #else - enum class CachedTransformation: UnsignedByte { - /** - * Absolute transformation is cached. - * - * If enabled, clean() is called when cleaning object. - */ - Absolute = 1 << 0, - - /** - * Inverted absolute transformation is cached. - * - * If enabled, cleanInverted() is called when cleaning object. - */ - InvertedAbsolute = 1 << 1 - }; - #endif - - /** - * @brief Which transformations to cache in this feature - * - * @see @ref scenegraph-caching, setCachedTransformations(), clean(), - * cleanInverted() - */ - #ifndef DOXYGEN_GENERATING_OUTPUT - typedef Implementation::FeatureCachedTransformations CachedTransformations; - #else - typedef Containers::EnumSet CachedTransformations; - #endif - /** * @brief Which transformations are cached * diff --git a/src/SceneGraph/Object.hpp b/src/SceneGraph/Object.hpp index 73344d877..94e20dd17 100644 --- a/src/SceneGraph/Object.hpp +++ b/src/SceneGraph/Object.hpp @@ -373,8 +373,7 @@ template void Object::setClean(std::vector template void Object::setClean(const typename Transformation::DataType& absoluteTransformation) { /* "Lazy storage" for transformation matrix and inverted transformation matrix */ - typedef typename AbstractFeature::CachedTransformation CachedTransformation; - typename AbstractFeature::CachedTransformations cached; + CachedTransformations cached; MatrixType matrix, invertedMatrix; /* Clean all features */ diff --git a/src/SceneGraph/SceneGraph.h b/src/SceneGraph/SceneGraph.h index 0d8263fb3..05904638a 100644 --- a/src/SceneGraph/SceneGraph.h +++ b/src/SceneGraph/SceneGraph.h @@ -44,6 +44,8 @@ template using AbstractCamera2D = AbstractCamera<2, T>; template using AbstractCamera3D = AbstractCamera<3, T>; #endif +/* Enum CachedTransformation and CachedTransformations used only directly */ + template class AbstractFeature; #ifndef CORRADE_GCC46_COMPATIBILITY template using AbstractFeature2D = AbstractFeature<2, T>; diff --git a/src/Shapes/AbstractShape.cpp b/src/Shapes/AbstractShape.cpp index 5a7ae3342..4ee79d443 100644 --- a/src/Shapes/AbstractShape.cpp +++ b/src/Shapes/AbstractShape.cpp @@ -32,7 +32,7 @@ namespace Magnum { namespace Shapes { template AbstractShape::AbstractShape(SceneGraph::AbstractObject* object, ShapeGroup* group): SceneGraph::AbstractGroupedFeature>(object, group) { - this->setCachedTransformations(SceneGraph::AbstractFeature::CachedTransformation::Absolute); + this->setCachedTransformations(SceneGraph::CachedTransformation::Absolute); } template ShapeGroup* AbstractShape::group() {