Browse Source

SceneGraph: removed deprecated list-argument functions taking pointers.

Use functions taking list of references instead.
pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
d5df77fec8
  1. 34
      src/Magnum/SceneGraph/AbstractObject.h
  2. 54
      src/Magnum/SceneGraph/Object.h
  3. 130
      src/Magnum/SceneGraph/Object.hpp
  4. 8
      src/Magnum/SceneGraph/Test/ObjectTest.cpp

34
src/Magnum/SceneGraph/AbstractObject.h

@ -204,23 +204,6 @@ template<UnsignedInt dimensions, class T> class AbstractObject
return doTransformationMatrices(objects, initialTransformationMatrix);
}
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief transformationMatrices()
* @deprecated Use @ref transformationMatrices() "transformationMatrices(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>&, const MatrixType&)" instead.
*/
CORRADE_DEPRECATED("use transformationMatrices(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>&, const MatrixType&) instead") std::vector<MatrixType> transformationMatrices(const std::vector<AbstractObject<dimensions, T>*>& objects, const MatrixType& initialTransformationMatrix = MatrixType()) const;
#ifdef CORRADE_GCC47_COMPATIBILITY
/* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I
thought 4.7 was bug-free. */
std::vector<MatrixType> transformationMatrices(std::initializer_list<std::reference_wrapper<AbstractObject<dimensions, T>>>& objects, const MatrixType& initialTransformationMatrix = MatrixType()) {
return transformationMatrices(std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>{objects}, initialTransformationMatrix);
}
CORRADE_DEPRECATED("use transformationMatrices(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>&, const MatrixType&) instead") std::vector<MatrixType> transformationMatrices(std::initializer_list<AbstractObject<dimensions, T>*> objects, const MatrixType& initialTransformationMatrix = MatrixType()) const;
#endif
#endif
/*@}*/
/**
@ -242,23 +225,6 @@ template<UnsignedInt dimensions, class T> class AbstractObject
objects.front().get().doSetClean(objects);
}
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief setClean(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>&)
* @deprecated Use @ref setClean(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>&) instead.
*/
static CORRADE_DEPRECATED("use setClean(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>&) instead") void setClean(const std::vector<AbstractObject<dimensions, T>*>& objects);
#ifdef CORRADE_GCC47_COMPATIBILITY
/* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I
thought 4.7 was bug-free. */
static void setClean(std::initializer_list<std::reference_wrapper<AbstractObject<dimensions, T>>> objects) {
return setClean(std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>{objects});
}
static CORRADE_DEPRECATED("use setClean(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>&) instead") void setClean(std::initializer_list<AbstractObject<dimensions, T>*> objects);
#endif
#endif
/**
* @brief Whether absolute transformation is dirty
*

54
src/Magnum/SceneGraph/Object.h

@ -295,24 +295,6 @@ template<class Transformation> class Object: public AbstractObject<Transformatio
*/
std::vector<MatrixType> transformationMatrices(const std::vector<std::reference_wrapper<Object<Transformation>>>& objects, const MatrixType& initialTransformationMatrix = MatrixType()) const;
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief transformationMatrices()
* @deprecated Use @ref transformationMatrices() "transformationMatrices(const std::vector<std::reference_wrapper<Object<Transformation>>>&, const MatrixType&)"
* instead.
*/
CORRADE_DEPRECATED("use transformationMatrices(const std::vector<std::reference_wrapper<Object<Transformation>>>&, const MatrixType&) instead") std::vector<MatrixType> transformationMatrices(const std::vector<Object<Transformation>*>& objects, const MatrixType& initialTransformationMatrix = MatrixType()) const;
#ifdef CORRADE_GCC47_COMPATIBILITY
/* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I
thought 4.7 was bug-free. */
std::vector<MatrixType> transformationMatrices(std::initializer_list<std::reference_wrapper<Object<Transformation>>> objects, const MatrixType& initialTransformationMatrix = MatrixType()) const {
return transformationMatrices(std::vector<std::reference_wrapper<Object<Transformation>>>{objects}, initialTransformationMatrix);
}
CORRADE_DEPRECATED("use transformationMatrices(const std::vector<std::reference_wrapper<Object<Transformation>>>&, const MatrixType&) instead") std::vector<MatrixType> transformationMatrices(std::initializer_list<Object<Transformation>*> objects, const MatrixType& initialTransformationMatrix = MatrixType()) const;
#endif
#endif
/**
* @brief Transformations of given group of objects relative to this object
*
@ -324,24 +306,6 @@ template<class Transformation> class Object: public AbstractObject<Transformatio
transformationMatrices() and avoid copy in the function itself) */
std::vector<typename Transformation::DataType> transformations(std::vector<std::reference_wrapper<Object<Transformation>>> objects, const typename Transformation::DataType& initialTransformation = typename Transformation::DataType()) const;
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief transformations()
* @deprecated Use @ref transformations() "transformations(std::vector<std::reference_wrapper<Object<Transformation>>>, const typename Transformation::DataType&)"
* instead.
*/
CORRADE_DEPRECATED("use transformations(std::vector<std::reference_wrapper<Object<Transformation>>>, const typename Transformation::DataType&) instead") std::vector<typename Transformation::DataType> transformations(const std::vector<Object<Transformation>*>& objects, const typename Transformation::DataType& initialTransformation = typename Transformation::DataType()) const;
#ifdef CORRADE_GCC47_COMPATIBILITY
/* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I
thought 4.7 was bug-free. */
std::vector<typename Transformation::DataType> transformations(std::initializer_list<std::reference_wrapper<Object<Transformation>>> objects, const typename Transformation::DataType& initialTransformation = typename Transformation::DataType()) const {
return transformations(std::vector<std::reference_wrapper<Object<Transformation>>>{objects}, initialTransformation);
}
CORRADE_DEPRECATED("use transformations(std::vector<std::reference_wrapper<Object<Transformation>>>, const typename Transformation::DataType&) instead") std::vector<typename Transformation::DataType> transformations(std::initializer_list<Object<Transformation>*> objects, const typename Transformation::DataType& initialTransformation = typename Transformation::DataType()) const;
#endif
#endif
/*@}*/
/**
@ -359,24 +323,6 @@ template<class Transformation> class Object: public AbstractObject<Transformatio
/* `objects` passed by copy intentionally (to avoid copy internally) */
static void setClean(std::vector<std::reference_wrapper<Object<Transformation>>> objects);
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief setClean(std::vector<std::reference_wrapper<Object<Transformation>>>)
* @deprecated Use @ref setClean(std::vector<std::reference_wrapper<Object<Transformation>>>)
* instead.
*/
CORRADE_DEPRECATED("use setClean(std::vector<std::reference_wrapper<Object<Transformation>>>) instead") static void setClean(const std::vector<Object<Transformation>*>& objects);
#ifdef CORRADE_GCC47_COMPATIBILITY
/* Workarounds to avoid ambiguous overload errors on GCC < 4.8. And I
thought 4.7 was bug-free. */
static void setClean(std::initializer_list<std::reference_wrapper<Object<Transformation>>> objects) {
setClean(std::vector<std::reference_wrapper<Object<Transformation>>>{objects});
}
static CORRADE_DEPRECATED("use setClean(std::vector<std::reference_wrapper<Object<Transformation>>>) instead") void setClean(std::initializer_list<Object<Transformation>*> objects);
#endif
#endif
/** @copydoc AbstractObject::isDirty() */
bool isDirty() const { return !!(flags & Flag::Dirty); }

130
src/Magnum/SceneGraph/Object.hpp

@ -38,61 +38,9 @@
namespace Magnum { namespace SceneGraph {
#ifdef MAGNUM_BUILD_DEPRECATED
template<UnsignedInt dimensions, class T> void AbstractObject<dimensions, T>::setClean(const std::vector<AbstractObject<dimensions, T>*>& objects) {
std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>> references;
references.reserve(objects.size());
for(auto o: objects) {
CORRADE_INTERNAL_ASSERT(o != nullptr);
references.push_back(*o);
}
setClean(references);
}
#ifdef CORRADE_GCC47_COMPATIBILITY
template<UnsignedInt dimensions, class T> void AbstractObject<dimensions, T>::setClean(std::initializer_list<AbstractObject<dimensions, T>*> objects) {
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
return setClean(std::vector<AbstractObject<dimensions, T>*>{objects});
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}
#endif
#endif
template<UnsignedInt dimensions, class T> AbstractObject<dimensions, T>::AbstractObject() {}
template<UnsignedInt dimensions, class T> AbstractObject<dimensions, T>::~AbstractObject() {}
#ifdef MAGNUM_BUILD_DEPRECATED
template<UnsignedInt dimensions, class T> auto AbstractObject<dimensions, T>::transformationMatrices(const std::vector<AbstractObject<dimensions, T>*>& objects, const MatrixType& initialTransformationMatrix) const -> std::vector<MatrixType> {
std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>> references;
references.reserve(objects.size());
for(auto o: objects) {
CORRADE_INTERNAL_ASSERT(o != nullptr);
references.push_back(*o);
}
return transformationMatrices(references, initialTransformationMatrix);
}
#ifdef CORRADE_GCC47_COMPATIBILITY
template<UnsignedInt dimensions, class T> auto AbstractObject<dimensions, T>::transformationMatrices(std::initializer_list<AbstractObject<dimensions, T>*> objects, const MatrixType& initialTransformationMatrix) const -> std::vector<MatrixType> {
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
return transformationMatrices(std::vector<AbstractObject<dimensions, T>*>{objects}, initialTransformationMatrix);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}
#endif
#endif
template<UnsignedInt dimensions, class T> AbstractTransformation<dimensions, T>::AbstractTransformation() {}
template<class Transformation> Object<Transformation>::Object(Object<Transformation>* parent): counter(0xFFFFu), flags(Flag::Dirty) {
@ -232,32 +180,6 @@ template<class Transformation> auto Object<Transformation>::transformationMatric
return transformationMatrices;
}
#ifdef MAGNUM_BUILD_DEPRECATED
template<class Transformation> auto Object<Transformation>::transformationMatrices(const std::vector<Object<Transformation>*>& objects, const MatrixType& initialTransformationMatrix) const -> std::vector<MatrixType> {
std::vector<std::reference_wrapper<Object<Transformation>>> references;
references.reserve(objects.size());
for(auto o: objects) {
CORRADE_INTERNAL_ASSERT(o != nullptr);
references.push_back(*o);
}
return transformationMatrices(references, initialTransformationMatrix);
}
#ifdef CORRADE_GCC47_COMPATIBILITY
template<class Transformation> auto Object<Transformation>::transformationMatrices(std::initializer_list<Object<Transformation>*> objects, const MatrixType& initialTransformationMatrix) const -> std::vector<MatrixType> {
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
return transformationMatrices(std::vector<Object<Transformation>*>{objects}, initialTransformationMatrix);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}
#endif
#endif
/*
Computing absolute transformations for given list of objects
@ -365,32 +287,6 @@ template<class Transformation> std::vector<typename Transformation::DataType> Ob
return jointTransformations;
}
#ifdef MAGNUM_BUILD_DEPRECATED
template<class Transformation> std::vector<typename Transformation::DataType> Object<Transformation>::transformations(const std::vector<Object<Transformation>*>& objects, const typename Transformation::DataType& initialTransformation) const {
std::vector<std::reference_wrapper<Object<Transformation>>> references;
references.reserve(objects.size());
for(auto o: objects) {
CORRADE_INTERNAL_ASSERT(o != nullptr);
references.push_back(*o);
}
return transformations(std::move(references), initialTransformation);
}
#ifdef CORRADE_GCC47_COMPATIBILITY
template<class Transformation> std::vector<typename Transformation::DataType> Object<Transformation>::transformations(std::initializer_list<Object<Transformation>*> objects, const typename Transformation::DataType& initialTransformation) const {
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
return transformations(std::vector<Object<Transformation>*>{objects}, initialTransformation);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}
#endif
#endif
template<class Transformation> typename Transformation::DataType Object<Transformation>::computeJointTransformation(const std::vector<std::reference_wrapper<Object<Transformation>>>& jointObjects, std::vector<typename Transformation::DataType>& jointTransformations, const std::size_t joint, const typename Transformation::DataType& initialTransformation) const {
std::reference_wrapper<Object<Transformation>> o = jointObjects[joint];
@ -476,32 +372,6 @@ template<class Transformation> void Object<Transformation>::setClean(std::vector
}
}
#ifdef MAGNUM_BUILD_DEPRECATED
template<class Transformation> void Object<Transformation>::setClean(const std::vector<Object<Transformation>*>& objects) {
std::vector<std::reference_wrapper<Object<Transformation>>> references;
references.reserve(objects.size());
for(auto o: objects) {
CORRADE_INTERNAL_ASSERT(o != nullptr);
references.push_back(*o);
}
setClean(std::move(references));
}
#ifdef CORRADE_GCC47_COMPATIBILITY
template<class Transformation> void Object<Transformation>::setClean(std::initializer_list<Object<Transformation>*> objects) {
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
setClean(std::vector<Object<Transformation>*>{objects});
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}
#endif
#endif
template<class Transformation> void Object<Transformation>::setCleanInternal(const typename Transformation::DataType& absoluteTransformation) {
/* "Lazy storage" for transformation matrix and inverted transformation matrix */
CachedTransformations cached;

8
src/Magnum/SceneGraph/Test/ObjectTest.cpp

@ -211,11 +211,7 @@ void ObjectTest::transformations() {
Matrix4 initial = Matrix4::rotationX(Deg(90.0f)).inverted();
/* Empty list */
#ifndef MAGNUM_BUILD_DEPRECATED
CORRADE_COMPARE(s.transformations({}, initial), std::vector<Matrix4>());
#else
CORRADE_COMPARE(s.transformations(std::vector<std::reference_wrapper<Object3D>>{}, initial), std::vector<Matrix4>());
#endif
/* Scene alone */
CORRADE_COMPARE(s.transformations({s}, initial), std::vector<Matrix4>{initial});
@ -459,11 +455,7 @@ void ObjectTest::setCleanListHierarchy() {
void ObjectTest::setCleanListBulk() {
/* Verify it doesn't crash when passed empty list */
#ifndef MAGNUM_BUILD_DEPRECATED
Object3D::setClean({});
#else
Object3D::setClean(std::vector<std::reference_wrapper<Object3D>>{});
#endif
Scene3D scene;
Object3D a(&scene);

Loading…
Cancel
Save