diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index e7e71fb25..52dc8b497 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -72,7 +72,7 @@ relevant sections in @see AbstractCamera2D, AbstractCamera3D, @ref scenegraph, Drawable, DrawableGroup */ -template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicCamera: public AbstractFeature { +template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicCamera: public AbstractBasicFeature { public: /** * @brief Constructor @@ -98,7 +98,7 @@ template class MAGNUM_SCENEGRAPH_EXPORT Abstrac * applied as first. */ typename DimensionTraits::MatrixType cameraMatrix() { - AbstractFeature::object()->setClean(); + AbstractBasicFeature::object()->setClean(); return _cameraMatrix; } diff --git a/src/SceneGraph/AbstractCamera.hpp b/src/SceneGraph/AbstractCamera.hpp index 91d7ed59a..15f7d3fad 100644 --- a/src/SceneGraph/AbstractCamera.hpp +++ b/src/SceneGraph/AbstractCamera.hpp @@ -70,8 +70,8 @@ template typename DimensionTraits AbstractBasicCamera::AbstractBasicCamera(AbstractObject* object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { - AbstractFeature::setCachedTransformations(CachedTransformation::InvertedAbsolute); +template AbstractBasicCamera::AbstractBasicCamera(AbstractObject* object): AbstractBasicFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { + AbstractBasicFeature::setCachedTransformations(CachedTransformation::InvertedAbsolute); } template AbstractBasicCamera::~AbstractBasicCamera() {} @@ -88,11 +88,11 @@ template void AbstractBasicCamera void AbstractBasicCamera::draw(BasicDrawableGroup& group) { - AbstractObject* scene = AbstractFeature::object()->scene(); + AbstractObject* scene = AbstractBasicFeature::object()->scene(); CORRADE_ASSERT(scene, "Camera::draw(): cannot draw when camera is not part of any scene", ); /* Compute camera matrix */ - AbstractFeature::object()->setClean(); + AbstractBasicFeature::object()->setClean(); /* Compute transformations of all objects in the group relative to the camera */ std::vector*> objects(group.size()); diff --git a/src/SceneGraph/AbstractFeature.h b/src/SceneGraph/AbstractFeature.h index ea421e132..4884f2e64 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, enum Magnum::SceneGraph::CachedTransformation, enum set Magnum::SceneGraph::CachedTransformations + * @brief Class Magnum::SceneGraph::AbstractBasicFeature, typedef Magnum::SceneGraph::AbstractFeature2D, Magnum::SceneGraph::AbstractFeature3D, enum Magnum::SceneGraph::CachedTransformation, enum set Magnum::SceneGraph::CachedTransformations */ #include @@ -40,8 +40,8 @@ namespace Magnum { namespace SceneGraph { @brief Which transformation to cache in given feature @see @ref scenegraph-caching, CachedTransformations, - AbstractFeature::setCachedTransformations(), AbstractFeature::clean(), - AbstractFeature::cleanInverted() + AbstractBasicFeature::setCachedTransformations(), AbstractBasicFeature::clean(), + AbstractBasicFeature::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? @@ -65,8 +65,8 @@ enum class CachedTransformation: UnsignedByte { /** @brief Which transformations to cache in this feature -@see @ref scenegraph-caching, AbstractFeature::setCachedTransformations(), - AbstractFeature::clean(), AbstractFeature::cleanInverted() +@see @ref scenegraph-caching, AbstractBasicFeature::setCachedTransformations(), + AbstractBasicFeature::clean(), AbstractBasicFeature::cleanInverted() */ typedef Containers::EnumSet CachedTransformations; @@ -98,9 +98,9 @@ caching is disabled. You can enable it using setCachedTransformations() and then implement corresponding cleaning function(s) -- either clean(), cleanInverted() or both. Example: @code -class CachingFeature: public SceneGraph::AbstractFeature3D<> { +class CachingFeature: public SceneGraph::AbstractFeature3D { public: - CachingFeature(SceneGraph::AbstractObject3D<>* object): SceneGraph::AbstractFeature3D<>(object) { + CachingFeature(SceneGraph::AbstractObject3D<>* object): SceneGraph::AbstractFeature3D(object) { setCachedTransformations(CachedTransformation::Absolute); } @@ -131,7 +131,7 @@ transformation implementations. Using small trick we are able to get pointer to both AbstractObject and needed transformation from one constructor parameter: @code -class TransformingFeature: public SceneGraph::AbstractFeature3D<> { +class TransformingFeature: public SceneGraph::AbstractFeature3D { public: template TransformingFeature(SceneGraph::Object* object): SceneGraph::AbstractFeature3D<>(object), transformation(object) {} @@ -155,19 +155,18 @@ For other specializations (e.g. using Double type) you have to use AbstractFeature.hpp implementation file to avoid linker errors. See also @ref compilation-speedup-hpp for more information. - - @ref AbstractFeature "AbstractFeature<2, Float>" - - @ref AbstractFeature "AbstractFeature<3, Float>" + - @ref AbstractBasicFeature "AbstractBasicFeature<2, Float>" + - @ref AbstractBasicFeature "AbstractBasicFeature<3, Float>" -@see AbstractFeature2D, AbstractFeature3D +@see @ref AbstractFeature2D, @ref AbstractFeature3D */ +template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeature #ifndef DOXYGEN_GENERATING_OUTPUT -template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature: private Containers::LinkedListItem, AbstractObject> -#else -template class AbstractFeature +: private Containers::LinkedListItem, AbstractObject> #endif { - friend class Containers::LinkedList>; - friend class Containers::LinkedListItem, AbstractObject>; + friend class Containers::LinkedList>; + friend class Containers::LinkedListItem, AbstractObject>; template friend class Object; public: @@ -175,38 +174,38 @@ template class AbstractFeature * @brief Constructor * @param object %Object holding this feature */ - explicit AbstractFeature(AbstractObject* object); + explicit AbstractBasicFeature(AbstractObject* object); - virtual ~AbstractFeature() = 0; + virtual ~AbstractBasicFeature() = 0; /** @brief %Object holding this feature */ AbstractObject* object() { - return Containers::LinkedListItem, AbstractObject>::list(); + return Containers::LinkedListItem, AbstractObject>::list(); } /** @overload */ const AbstractObject* object() const { - return Containers::LinkedListItem, AbstractObject>::list(); + return Containers::LinkedListItem, AbstractObject>::list(); } /** @brief Previous feature or `nullptr`, if this is first feature */ - AbstractFeature* previousFeature() { - return Containers::LinkedListItem, AbstractObject>::previous(); + AbstractBasicFeature* previousFeature() { + return Containers::LinkedListItem, AbstractObject>::previous(); } /** @overload */ - const AbstractFeature* previousFeature() const { - return Containers::LinkedListItem, AbstractObject>::previous(); + const AbstractBasicFeature* previousFeature() const { + return Containers::LinkedListItem, AbstractObject>::previous(); } /** @brief Next feature or `nullptr`, if this is last feature */ - AbstractFeature* nextFeature() { - return Containers::LinkedListItem, AbstractObject>::next(); + AbstractBasicFeature* nextFeature() { + return Containers::LinkedListItem, AbstractObject>::next(); } /** @overload */ - const AbstractFeature* nextFeature() const { - return Containers::LinkedListItem, AbstractObject>::next(); + const AbstractBasicFeature* nextFeature() const { + return Containers::LinkedListItem, AbstractObject>::next(); } /** @@ -284,37 +283,19 @@ template class AbstractFeature CachedTransformations _cachedTransformations; }; -#ifndef CORRADE_GCC46_COMPATIBILITY /** -@brief Base for two-dimensional features +@brief Base feature for two-dimensional float scenes -Convenience alternative to %AbstractFeature<2, T>. See AbstractFeature -for more information. -@note Not available on GCC < 4.7. Use %AbstractFeature<2, T> instead. -@see AbstractFeature3D +@see @ref AbstractFeature3D */ -#ifdef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -using AbstractFeature2D = AbstractFeature<2, T>; +typedef AbstractBasicFeature<2, Float> AbstractFeature2D; /** -@brief Base for three-dimensional features +@brief Base feature for three-dimensional float scenes -Convenience alternative to %AbstractFeature<3, T>. See AbstractFeature -for more information. -@note Not available on GCC < 4.7. Use %AbstractFeature<3, T> instead. -@see AbstractFeature2D +@see @ref AbstractFeature2D */ -#ifdef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -using AbstractFeature3D = AbstractFeature<3, T>; -#endif +typedef AbstractBasicFeature<3, Float> AbstractFeature3D; }} diff --git a/src/SceneGraph/AbstractFeature.hpp b/src/SceneGraph/AbstractFeature.hpp index f0da6915e..837aee192 100644 --- a/src/SceneGraph/AbstractFeature.hpp +++ b/src/SceneGraph/AbstractFeature.hpp @@ -32,17 +32,17 @@ namespace Magnum { namespace SceneGraph { -template AbstractFeature::AbstractFeature(AbstractObject* object) { - object->Containers::template LinkedList>::insert(this); +template AbstractBasicFeature::AbstractBasicFeature(AbstractObject* object) { + object->Containers::template LinkedList>::insert(this); } -template AbstractFeature::~AbstractFeature() = default; +template AbstractBasicFeature::~AbstractBasicFeature() = default; -template void AbstractFeature::markDirty() {} +template void AbstractBasicFeature::markDirty() {} -template void AbstractFeature::clean(const typename DimensionTraits::MatrixType&) {} +template void AbstractBasicFeature::clean(const typename DimensionTraits::MatrixType&) {} -template void AbstractFeature::cleanInverted(const typename DimensionTraits::MatrixType&) {} +template void AbstractBasicFeature::cleanInverted(const typename DimensionTraits::MatrixType&) {} }} diff --git a/src/SceneGraph/AbstractGroupedFeature.h b/src/SceneGraph/AbstractGroupedFeature.h index 8b636c885..4b45f4ff5 100644 --- a/src/SceneGraph/AbstractGroupedFeature.h +++ b/src/SceneGraph/AbstractGroupedFeature.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::AbstractGroupedFeature, alias Magnum::SceneGraph::AbstractGroupedFeature2D, Magnum::SceneGraph::AbstractGroupedFeature3D + * @brief Class Magnum::SceneGraph::AbstractBasicGroupedFeature, alias Magnum::SceneGraph::AbstractGroupedFeature2D, Magnum::SceneGraph::AbstractGroupedFeature3D */ #include @@ -38,12 +38,12 @@ namespace Magnum { namespace SceneGraph { /** @brief Base for grouped features -Used together with FeatureGroup. +Used together with BasicFeatureGroup. @section AbstractGroupedFeature-subclassing Subclassing Usage is via subclassing the feature using [CRTP](http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) -and typedef'ing FeatureGroup to accept only given type, e.g.: +and typedef'ing BasicFeatureGroup to accept only given type, e.g.: @code class Drawable: public SceneGraph::AbstractGroupedFeature3D { // ... @@ -59,19 +59,15 @@ For other specializations (e.g. using Double type) you have to use AbstractGroupedFeature.hpp implementation file to avoid linker errors. See also @ref compilation-speedup-hpp for more information. - - @ref AbstractFeatureGroup "AbstractFeatureGroup<2, Float>" - - @ref AbstractFeatureGroup "AbstractFeatureGroup<3, Float>" + - @ref AbstractBasicFeatureGroup "AbstractBasicFeatureGroup<2, Float>" + - @ref AbstractBasicFeatureGroup "AbstractBasicFeatureGroup<3, Float>" -@see @ref scenegraph, AbstractGroupedFeature2D, AbstractGroupedFeature3D, - FeatureGroup, FeatureGroup2D, FeatureGroup3D +@see @ref AbstractGroupedFeature2D, @ref AbstractGroupedFeature3D, + @ref scenegraph, @ref BasicFeatureGroup, @ref FeatureGroup2D, + @ref FeatureGroup3D */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class AbstractGroupedFeature: public AbstractFeature { - friend class FeatureGroup; +template class AbstractBasicGroupedFeature: public AbstractBasicFeature { + friend class BasicFeatureGroup; public: /** @@ -82,7 +78,7 @@ class AbstractGroupedFeature: public AbstractFeature { * Adds the feature to the object and to group, if specified. * @see FeatureGroup::add() */ - explicit AbstractGroupedFeature(AbstractObject* object, FeatureGroup* group = nullptr): AbstractFeature(object), _group(nullptr) { + explicit AbstractBasicGroupedFeature(AbstractObject* object, BasicFeatureGroup* group = nullptr): AbstractBasicFeature(object), _group(nullptr) { if(group) group->add(static_cast(this)); } @@ -92,56 +88,44 @@ class AbstractGroupedFeature: public AbstractFeature { * Removes the feature from object and from group, if it belongs to * any. */ - ~AbstractGroupedFeature() { + ~AbstractBasicGroupedFeature() { if(_group) _group->remove(static_cast(this)); } /** @brief Group this feature belongs to */ - FeatureGroup* group() { + BasicFeatureGroup* group() { return _group; } /** @overload */ - const FeatureGroup* group() const { + const BasicFeatureGroup* group() const { return _group; } private: - FeatureGroup* _group; + BasicFeatureGroup* _group; }; #ifndef CORRADE_GCC46_COMPATIBILITY /** -@brief Base for two-dimensional grouped features +@brief Base grouped feature for two-dimensional float scenes -Convenience alternative to %AbstractGroupedFeature<2, Derived, T>. See -AbstractGroupedFeature for more information. -@note Not available on GCC < 4.7. Use %AbstractGroupedFeature<2, Derived, T> +Convenience alternative to %AbstractBasicGroupedFeature<2, Derived, Float>. +@note Not available on GCC < 4.7. Use %AbstractBasicGroupedFeature<2, Derived, Float> instead. -@see AbstractGroupedFeature3D +@see @ref AbstractGroupedFeature3D */ -#ifdef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -using AbstractGroupedFeature2D = AbstractGroupedFeature<2, Derived, T>; +template using AbstractGroupedFeature2D = AbstractBasicGroupedFeature<2, Derived, Float>; /** @brief Base for three-dimensional grouped features -Convenience alternative to %AbstractGroupedFeature<3, Derived, T>. See -AbstractGroupedFeature for more information. -@note Not available on GCC < 4.7. Use %AbstractGroupedFeature<3, Derived, T> +Convenience alternative to %AbstractBasicGroupedFeature<3, Derived, Float>. +@note Not available on GCC < 4.7. Use %AbstractBasicGroupedFeature<3, Derived, Float> instead. -@see AbstractGroupedFeature2D +@see @ref AbstractGroupedFeature2D */ -#ifdef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -using AbstractGroupedFeature3D = AbstractGroupedFeature<3, Derived, T>; +template using AbstractGroupedFeature3D = AbstractBasicGroupedFeature<3, Derived, Float>; #endif }} diff --git a/src/SceneGraph/AbstractObject.h b/src/SceneGraph/AbstractObject.h index d7e572cb3..142d36f13 100644 --- a/src/SceneGraph/AbstractObject.h +++ b/src/SceneGraph/AbstractObject.h @@ -59,46 +59,46 @@ for(AbstractFeature* feature = o->firstFeature(); feature; feature = feature->ne #ifdef DOXYGEN_GENERATING_OUTPUT template class AbstractObject #else -template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject: private Containers::LinkedList> +template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject: private Containers::LinkedList> #endif { - friend class Containers::LinkedList>; - friend class Containers::LinkedListItem, AbstractObject>; - friend class AbstractFeature; + friend class Containers::LinkedList>; + friend class Containers::LinkedListItem, AbstractObject>; + friend class AbstractBasicFeature; public: /** @brief Matrix type */ typedef typename DimensionTraits::MatrixType MatrixType; /** @brief Feature object type */ - typedef AbstractFeature FeatureType; + typedef AbstractBasicFeature FeatureType; explicit AbstractObject(); virtual ~AbstractObject(); /** @brief Whether this object has features */ bool hasFeatures() const { - return !Containers::LinkedList>::isEmpty(); + return !Containers::LinkedList>::isEmpty(); } /** @brief First object feature or `nullptr`, if this object has no features */ FeatureType* firstFeature() { - return Containers::LinkedList>::first(); + return Containers::LinkedList>::first(); } /** @overload */ const FeatureType* firstFeature() const { - return Containers::LinkedList>::first(); + return Containers::LinkedList>::first(); } /** @brief Last object feature or `nullptr`, if this object has no features */ FeatureType* lastFeature() { - return Containers::LinkedList>::last(); + return Containers::LinkedList>::last(); } /** @overload */ const FeatureType* lastFeature() const { - return Containers::LinkedList>::last(); + return Containers::LinkedList>::last(); } /** diff --git a/src/SceneGraph/Animable.h b/src/SceneGraph/Animable.h index 207f4edf8..163e3321f 100644 --- a/src/SceneGraph/Animable.h +++ b/src/SceneGraph/Animable.h @@ -144,7 +144,7 @@ template #else template #endif -class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature, T> { +class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractBasicGroupedFeature, T> { friend class AnimableGroup; public: diff --git a/src/SceneGraph/Animable.hpp b/src/SceneGraph/Animable.hpp index 598959bac..8e5cf3bdf 100644 --- a/src/SceneGraph/Animable.hpp +++ b/src/SceneGraph/Animable.hpp @@ -35,7 +35,7 @@ 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): AbstractBasicGroupedFeature, 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() {} @@ -53,11 +53,11 @@ template Animable* Animable AnimableGroup* Animable::group() { - return static_cast*>(AbstractGroupedFeature, T>::group()); + return static_cast*>(AbstractBasicGroupedFeature, T>::group()); } template const AnimableGroup* Animable::group() const { - return static_cast*>(AbstractGroupedFeature, T>::group()); + return static_cast*>(AbstractBasicGroupedFeature, T>::group()); } template void AnimableGroup::step(const Float time, const Float delta) { diff --git a/src/SceneGraph/AnimableGroup.h b/src/SceneGraph/AnimableGroup.h index 134218798..355a29478 100644 --- a/src/SceneGraph/AnimableGroup.h +++ b/src/SceneGraph/AnimableGroup.h @@ -45,7 +45,7 @@ template #else template #endif -class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup: public FeatureGroup, T> { +class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup: public BasicFeatureGroup, T> { friend class Animable; public: diff --git a/src/SceneGraph/Drawable.h b/src/SceneGraph/Drawable.h index c6dfe2ea0..f5e81e1a5 100644 --- a/src/SceneGraph/Drawable.h +++ b/src/SceneGraph/Drawable.h @@ -116,7 +116,7 @@ void MyApplication::drawEvent() { @see Drawable2D, Drawable3D, @ref scenegraph, DrawableGroup2D, DrawableGroup3D */ -template class BasicDrawable: public AbstractGroupedFeature, T> { +template class BasicDrawable: public AbstractBasicGroupedFeature, T> { public: /** * @brief Constructor @@ -126,7 +126,7 @@ template class BasicDrawable: public AbstractGr * Adds the feature to the object and also to the group, if specified. * Otherwise you can use BasicDrawableGroup::add(). */ - explicit BasicDrawable(AbstractObject* object, BasicDrawableGroup* drawables = nullptr): AbstractGroupedFeature, T>(object, drawables) {} + explicit BasicDrawable(AbstractObject* object, BasicDrawableGroup* drawables = nullptr): AbstractBasicGroupedFeature, T>(object, drawables) {} /** * @brief Draw the object using given camera @@ -160,9 +160,9 @@ See Drawable for more information. @see @ref scenegraph, DrawableGroup2D, DrawableGroup3D */ #ifndef CORRADE_GCC46_COMPATIBILITY -template using BasicDrawableGroup = FeatureGroup, T>; +template using BasicDrawableGroup = BasicFeatureGroup, T>; #else -template class BasicDrawableGroup: public FeatureGroup, T> {}; +template class BasicDrawableGroup: public BasicFeatureGroup, T> {}; #endif /** diff --git a/src/SceneGraph/FeatureGroup.h b/src/SceneGraph/FeatureGroup.h index e40046b1f..c07825b0a 100644 --- a/src/SceneGraph/FeatureGroup.h +++ b/src/SceneGraph/FeatureGroup.h @@ -25,7 +25,7 @@ */ /** @file - * @brief Class Magnum::SceneGraph::FeatureGroup, alias Magnum::SceneGraph::FeatureGroup2D, Magnum::SceneGraph::FeatureGroup3D + * @brief Class Magnum::SceneGraph::AbstractBasicFeatureGroup, Magnum::SceneGraph::BasicFeatureGroup, alias Magnum::SceneGraph::FeatureGroup2D, Magnum::SceneGraph::FeatureGroup3D */ #include @@ -39,48 +39,38 @@ namespace Magnum { namespace SceneGraph { /** @brief Base for group of features -See FeatureGroup. +See BasicFeatureGroup. */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class MAGNUM_SCENEGRAPH_EXPORT AbstractFeatureGroup { - template friend class FeatureGroup; +template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeatureGroup { + template friend class BasicFeatureGroup; - explicit AbstractFeatureGroup(); - virtual ~AbstractFeatureGroup(); + explicit AbstractBasicFeatureGroup(); + virtual ~AbstractBasicFeatureGroup(); - void add(AbstractFeature* feature); - void remove(AbstractFeature* feature); + void add(AbstractBasicFeature* feature); + void remove(AbstractBasicFeature* feature); - std::vector*> features; + std::vector*> features; }; /** @brief Group of features -See AbstractGroupedFeature for more information. -@see @ref scenegraph, FeatureGroup2D, FeatureGroup3D +See AbstractBasicGroupedFeature for more information. +@see @ref FeatureGroup2D, @ref FeatureGroup3D, @ref scenegraph */ -#ifndef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -class FeatureGroup: public AbstractFeatureGroup { - friend class AbstractGroupedFeature; +template class BasicFeatureGroup: public AbstractBasicFeatureGroup { + friend class AbstractBasicGroupedFeature; public: - explicit FeatureGroup() = default; + explicit BasicFeatureGroup() = default; /** * @brief Destructor * * Removes all features belonging to this group, but not deletes them. */ - ~FeatureGroup(); + ~BasicFeatureGroup(); /** @brief Whether the group is empty */ bool isEmpty() const { return this->features.empty(); } @@ -103,9 +93,9 @@ class FeatureGroup: public AbstractFeatureGroup { * @return Pointer to self (for method chaining) * * If the features is part of another group, it is removed from it. - * @see remove(), AbstractGroupedFeature::AbstractGroupedFeature() + * @see remove(), AbstractBasicGroupedFeature::AbstractBasicGroupedFeature() */ - FeatureGroup* add(Feature* feature); + BasicFeatureGroup* add(Feature* feature); /** * @brief Remove feature from the group @@ -114,63 +104,51 @@ class FeatureGroup: public AbstractFeatureGroup { * The feature must be part of the group. * @see add() */ - FeatureGroup* remove(Feature* feature); + BasicFeatureGroup* remove(Feature* feature); }; #ifndef CORRADE_GCC46_COMPATIBILITY /** -@brief Base for two-dimensional object features +@brief Base feature for two-dimensional float scenes -Convenience alternative to %FeatureGroup<2, Feature, T>. See -AbstractGroupedFeature for more information. -@note Not available on GCC < 4.7. Use %FeatureGroup<2, Feature, T> +Convenience alternative to %BasicFeatureGroup<2, Feature, Float>. +@note Not available on GCC < 4.7. Use %BasicFeatureGroup<2, Feature, Float> instead. -@see FeatureGroup3D +@see @ref FeatureGroup3D */ -#ifdef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -using FeatureGroup2D = FeatureGroup<2, Feature, T>; +template using FeatureGroup2D = BasicFeatureGroup<2, Feature, Float>; /** -@brief Base for three-dimensional object features +@brief Base feature for three-dimensional float scenes -Convenience alternative to %FeatureGroup<3, Feature, T>. See -AbstractGroupedFeature for more information. -@note Not available on GCC < 4.7. Use %FeatureGroup<3, Feature, T> +Convenience alternative to %BasicFeatureGroup<3, Feature, Float>. +@note Not available on GCC < 4.7. Use %FeatureGroup<3, Feature, Float> instead. -@see FeatureGroup2D +@see @ref FeatureGroup2D */ -#ifdef DOXYGEN_GENERATING_OUTPUT -template -#else -template -#endif -using FeatureGroup3D = FeatureGroup<3, Feature, T>; +template using FeatureGroup3D = BasicFeatureGroup<3, Feature, Float>; #endif -template FeatureGroup::~FeatureGroup() { +template BasicFeatureGroup::~BasicFeatureGroup() { for(auto i: this->features) static_cast(i)->_group = nullptr; } -template FeatureGroup* FeatureGroup::add(Feature* feature) { +template BasicFeatureGroup* BasicFeatureGroup::add(Feature* feature) { /* Remove from previous group */ if(feature->_group) feature->_group->remove(feature); /* Crossreference the feature and group together */ - AbstractFeatureGroup::add(feature); + AbstractBasicFeatureGroup::add(feature); feature->_group = this; return this; } -template FeatureGroup* FeatureGroup::remove(Feature* feature) { +template BasicFeatureGroup* BasicFeatureGroup::remove(Feature* feature) { CORRADE_ASSERT(feature->_group == this, - "SceneGraph::AbstractFeatureGroup::remove(): feature is not part of this group", this); + "SceneGraph::AbstractBasicFeatureGroup::remove(): feature is not part of this group", this); - AbstractFeatureGroup::remove(feature); + AbstractBasicFeatureGroup::remove(feature); feature->_group = nullptr; return this; } diff --git a/src/SceneGraph/FeatureGroup.hpp b/src/SceneGraph/FeatureGroup.hpp index 0f2cd1f1f..494af730f 100644 --- a/src/SceneGraph/FeatureGroup.hpp +++ b/src/SceneGraph/FeatureGroup.hpp @@ -34,14 +34,14 @@ namespace Magnum { namespace SceneGraph { -template AbstractFeatureGroup::AbstractFeatureGroup() = default; -template AbstractFeatureGroup::~AbstractFeatureGroup() = default; +template AbstractBasicFeatureGroup::AbstractBasicFeatureGroup() = default; +template AbstractBasicFeatureGroup::~AbstractBasicFeatureGroup() = default; -template void AbstractFeatureGroup::add(AbstractFeature* feature) { +template void AbstractBasicFeatureGroup::add(AbstractBasicFeature* feature) { features.push_back(feature); } -template void AbstractFeatureGroup::remove(AbstractFeature* feature) { +template void AbstractBasicFeatureGroup::remove(AbstractBasicFeature* feature) { features.erase(std::find(features.begin(), features.end(), feature)); } diff --git a/src/SceneGraph/Object.hpp b/src/SceneGraph/Object.hpp index 94e20dd17..c7e876da9 100644 --- a/src/SceneGraph/Object.hpp +++ b/src/SceneGraph/Object.hpp @@ -113,7 +113,7 @@ template void Object::setDirty() { Object* self = static_cast*>(this); /* Make all features dirty */ - for(AbstractFeature* i = self->firstFeature(); i; i = i->nextFeature()) + for(AbstractBasicFeature* i = self->firstFeature(); i; i = i->nextFeature()) i->markDirty(); /* Make all children dirty */ @@ -377,7 +377,7 @@ template void Object::setClean(const typen MatrixType matrix, invertedMatrix; /* Clean all features */ - for(AbstractFeature* i = this->firstFeature(); i; i = i->nextFeature()) { + for(AbstractBasicFeature* i = this->firstFeature(); i; i = i->nextFeature()) { /* Cached absolute transformation, compute it if it wasn't computed already */ if(i->cachedTransformations() & CachedTransformation::Absolute) { diff --git a/src/SceneGraph/SceneGraph.h b/src/SceneGraph/SceneGraph.h index 7cda3ffc4..ff1d965f4 100644 --- a/src/SceneGraph/SceneGraph.h +++ b/src/SceneGraph/SceneGraph.h @@ -44,22 +44,18 @@ typedef AbstractBasicCamera<3, Float> AbstractCamera3D; /* Enum CachedTransformation and CachedTransformations used only directly */ -template class AbstractFeature; -#ifndef CORRADE_GCC46_COMPATIBILITY -template using AbstractFeature2D = AbstractFeature<2, T>; -template using AbstractFeature3D = AbstractFeature<3, T>; -#endif +template class AbstractBasicFeature; +typedef AbstractBasicFeature<2, Float> AbstractFeature2D; +typedef AbstractBasicFeature<3, Float> AbstractFeature3D; -template class AbstractFeatureGroup; -#ifndef CORRADE_GCC46_COMPATIBILITY -template using AbstractFeatureGroup2D = AbstractFeatureGroup<2, T>; -template using AbstractFeatureGroup3D = AbstractFeatureGroup<3, T>; -#endif +template class AbstractBasicFeatureGroup; +typedef AbstractBasicFeatureGroup<2, Float> AbstractFeatureGroup2D; +typedef AbstractBasicFeatureGroup<3, Float> AbstractFeatureGroup3D; -template class AbstractGroupedFeature; +template class AbstractBasicGroupedFeature; #ifndef CORRADE_GCC46_COMPATIBILITY -template using AbstractGroupedFeature2D = AbstractGroupedFeature<2, Derived, T>; -template using AbstractGroupedFeature3D = AbstractGroupedFeature<3, Derived, T>; +template using AbstractGroupedFeature2D = AbstractBasicGroupedFeature<2, Derived, Float>; +template using AbstractGroupedFeature3D = AbstractBasicGroupedFeature<3, Derived, Float>; #endif template class AbstractObject; @@ -107,14 +103,14 @@ typedef BasicDrawable<3, Float> Drawable3D; template class DualComplexTransformation; template class DualQuaternionTransformation; -template class FeatureGroup; +template class BasicFeatureGroup; #ifndef CORRADE_GCC46_COMPATIBILITY -template using FeatureGroup2D = FeatureGroup<2, Feature, T>; -template using FeatureGroup3D = FeatureGroup<3, Feature, T>; +template using BasicFeatureGroup2D = BasicFeatureGroup<2, Feature, Float>; +template using BasicFeatureGroup3D = BasicFeatureGroup<3, Feature, Float>; #endif #ifndef CORRADE_GCC46_COMPATIBILITY -template using BasicDrawableGroup = FeatureGroup, T>; +template using BasicDrawableGroup = BasicFeatureGroup, T>; #else template class BasicDrawableGroup; #endif diff --git a/src/SceneGraph/Test/ObjectTest.cpp b/src/SceneGraph/Test/ObjectTest.cpp index 2ec5848ae..3bfec9ad2 100644 --- a/src/SceneGraph/Test/ObjectTest.cpp +++ b/src/SceneGraph/Test/ObjectTest.cpp @@ -50,9 +50,9 @@ class ObjectTest: public TestSuite::Tester { typedef SceneGraph::Object> Object3D; typedef SceneGraph::Scene> Scene3D; -class CachingObject: public Object3D, AbstractFeature<3> { +class CachingObject: public Object3D, AbstractFeature3D { public: - CachingObject(Object3D* parent = nullptr): Object3D(parent), AbstractFeature<3>(this) { + CachingObject(Object3D* parent = nullptr): Object3D(parent), AbstractFeature3D(this) { setCachedTransformations(CachedTransformation::Absolute); } @@ -269,9 +269,9 @@ void ObjectTest::transformationsDuplicate() { void ObjectTest::setClean() { Scene3D scene; - class CachingFeature: public AbstractFeature<3> { + class CachingFeature: public AbstractFeature3D { public: - CachingFeature(AbstractObject<3>* object): AbstractFeature<3>(object) { + CachingFeature(AbstractObject<3>* object): AbstractFeature3D(object) { setCachedTransformations(CachedTransformation::Absolute); } @@ -282,9 +282,9 @@ void ObjectTest::setClean() { } }; - class CachingInvertedFeature: public AbstractFeature<3> { + class CachingInvertedFeature: public AbstractFeature3D { public: - CachingInvertedFeature(AbstractObject<3>* object): AbstractFeature<3>(object) { + CachingInvertedFeature(AbstractObject<3>* object): AbstractFeature3D(object) { setCachedTransformations(CachedTransformation::InvertedAbsolute); } @@ -367,9 +367,9 @@ void ObjectTest::setClean() { void ObjectTest::setCleanListHierarchy() { Scene3D scene; - class CachingFeature: public AbstractFeature<3> { + class CachingFeature: public AbstractFeature3D { public: - CachingFeature(AbstractObject<3>* object): AbstractFeature<3>(object) { + CachingFeature(AbstractObject<3>* object): AbstractFeature3D(object) { setCachedTransformations(CachedTransformation::Absolute); } diff --git a/src/SceneGraph/instantiation.cpp b/src/SceneGraph/instantiation.cpp index c20388f03..461294575 100644 --- a/src/SceneGraph/instantiation.cpp +++ b/src/SceneGraph/instantiation.cpp @@ -42,10 +42,10 @@ template class AbstractObject<3, Float>; template class AbstractTransformation<2, Float>; template class AbstractTransformation<3, Float>; -template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature<2, Float>; -template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature<3, Float>; -template class AbstractFeatureGroup<2, Float>; -template class AbstractFeatureGroup<3, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeature<2, Float>; +template class MAGNUM_SCENEGRAPH_EXPORT AbstractBasicFeature<3, Float>; +template class AbstractBasicFeatureGroup<2, Float>; +template class AbstractBasicFeatureGroup<3, Float>; template class AbstractBasicCamera<2, Float>; template class AbstractBasicCamera<3, Float>; diff --git a/src/Shapes/AbstractShape.cpp b/src/Shapes/AbstractShape.cpp index 4ee79d443..693a0bbe0 100644 --- a/src/Shapes/AbstractShape.cpp +++ b/src/Shapes/AbstractShape.cpp @@ -31,16 +31,16 @@ namespace Magnum { namespace Shapes { -template AbstractShape::AbstractShape(SceneGraph::AbstractObject* object, ShapeGroup* group): SceneGraph::AbstractGroupedFeature>(object, group) { +template AbstractShape::AbstractShape(SceneGraph::AbstractObject* object, ShapeGroup* group): SceneGraph::AbstractBasicGroupedFeature, Float>(object, group) { this->setCachedTransformations(SceneGraph::CachedTransformation::Absolute); } template ShapeGroup* AbstractShape::group() { - return static_cast*>(SceneGraph::AbstractGroupedFeature>::group()); + return static_cast*>(SceneGraph::AbstractBasicGroupedFeature, Float>::group()); } template const ShapeGroup* AbstractShape::group() const { - return static_cast*>(SceneGraph::AbstractGroupedFeature>::group()); + return static_cast*>(SceneGraph::AbstractBasicGroupedFeature, Float>::group()); } template auto AbstractShape::type() const -> Type { diff --git a/src/Shapes/AbstractShape.h b/src/Shapes/AbstractShape.h index c742b969e..98f29cfe4 100644 --- a/src/Shapes/AbstractShape.h +++ b/src/Shapes/AbstractShape.h @@ -49,7 +49,7 @@ This class is not directly instantiable, see Shape instead. See @ref shapes for brief introduction. @see AbstractShape2D, AbstractShape3D */ -template class MAGNUM_SHAPES_EXPORT AbstractShape: public SceneGraph::AbstractGroupedFeature> { +template class MAGNUM_SHAPES_EXPORT AbstractShape: public SceneGraph::AbstractBasicGroupedFeature, Float> { friend const Implementation::AbstractShape* Implementation::getAbstractShape<>(const AbstractShape*); public: diff --git a/src/Shapes/ShapeGroup.h b/src/Shapes/ShapeGroup.h index b3564f372..6b4a3a8be 100644 --- a/src/Shapes/ShapeGroup.h +++ b/src/Shapes/ShapeGroup.h @@ -43,7 +43,7 @@ namespace Magnum { namespace Shapes { See Shape for more information. See @ref shapes for brief introduction. @see @ref scenegraph, ShapeGroup2D, ShapeGroup3D */ -template class MAGNUM_SHAPES_EXPORT ShapeGroup: public SceneGraph::FeatureGroup> { +template class MAGNUM_SHAPES_EXPORT ShapeGroup: public SceneGraph::BasicFeatureGroup, Float> { friend class AbstractShape; public: