Browse Source

SceneGraph: renamed multiplyTransformation() to transform().

It is shorter and looks better.
pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
6efb5607fa
  1. 16
      src/SceneGraph/MatrixTransformation2D.h
  2. 26
      src/SceneGraph/MatrixTransformation3D.h

16
src/SceneGraph/MatrixTransformation2D.h

@ -74,12 +74,12 @@ template<class T = GLfloat> class MatrixTransformation2D: public AbstractTransla
} }
/** /**
* @brief Multiply transformation * @brief Transform object
* @param transformation Transformation * @param transformation Transformation
* @param type Transformation type * @param type Transformation type
* @return Pointer to self (for method chaining) * @return Pointer to self (for method chaining)
*/ */
inline MatrixTransformation2D<T>* multiplyTransformation(const Math::Matrix3<T>& transformation, TransformationType type = TransformationType::Global) { inline MatrixTransformation2D<T>* transform(const Math::Matrix3<T>& transformation, TransformationType type = TransformationType::Global) {
setTransformation(type == TransformationType::Global ? setTransformation(type == TransformationType::Global ?
transformation*_transformation : _transformation*transformation); transformation*_transformation : _transformation*transformation);
return this; return this;
@ -87,28 +87,28 @@ template<class T = GLfloat> class MatrixTransformation2D: public AbstractTransla
/** /**
* @copydoc AbstractTranslationRotationScaling2D::translate() * @copydoc AbstractTranslationRotationScaling2D::translate()
* Same as calling multiplyTransformation() with Matrix3::translation(). * Same as calling transform() with Matrix3::translation().
*/ */
inline MatrixTransformation2D<T>* translate(const Math::Vector2<T>& vector, TransformationType type = TransformationType::Global) override { inline MatrixTransformation2D<T>* translate(const Math::Vector2<T>& vector, TransformationType type = TransformationType::Global) override {
multiplyTransformation(Math::Matrix3<T>::translation(vector), type); transform(Math::Matrix3<T>::translation(vector), type);
return this; return this;
} }
/** /**
* @copydoc AbstractTranslationRotationScaling2D::rotate() * @copydoc AbstractTranslationRotationScaling2D::rotate()
* Same as calling multiplyTransformation() with Matrix3::rotation(). * Same as calling transform() with Matrix3::rotation().
*/ */
inline MatrixTransformation2D<T>* rotate(T angle, TransformationType type = TransformationType::Global) override { inline MatrixTransformation2D<T>* rotate(T angle, TransformationType type = TransformationType::Global) override {
multiplyTransformation(Math::Matrix3<T>::rotation(angle), type); transform(Math::Matrix3<T>::rotation(angle), type);
return this; return this;
} }
/** /**
* @copydoc AbstractTranslationRotationScaling2D::scale() * @copydoc AbstractTranslationRotationScaling2D::scale()
* Same as calling multiplyTransformation() with Matrix3::scaling(). * Same as calling transform() with Matrix3::scaling().
*/ */
inline MatrixTransformation2D<T>* scale(const Math::Vector2<T>& vector, TransformationType type = TransformationType::Global) override { inline MatrixTransformation2D<T>* scale(const Math::Vector2<T>& vector, TransformationType type = TransformationType::Global) override {
multiplyTransformation(Math::Matrix3<T>::scaling(vector), type); transform(Math::Matrix3<T>::scaling(vector), type);
return this; return this;
} }

26
src/SceneGraph/MatrixTransformation3D.h

@ -79,7 +79,7 @@ template<class T = GLfloat> class MatrixTransformation3D: public AbstractTransla
* @param type Transformation type * @param type Transformation type
* @return Pointer to self (for method chaining) * @return Pointer to self (for method chaining)
*/ */
inline MatrixTransformation3D<T>* multiplyTransformation(const Math::Matrix4<T>& transformation, TransformationType type = TransformationType::Global) { inline MatrixTransformation3D<T>* transform(const Math::Matrix4<T>& transformation, TransformationType type = TransformationType::Global) {
setTransformation(type == TransformationType::Global ? setTransformation(type == TransformationType::Global ?
transformation*_transformation : _transformation*transformation); transformation*_transformation : _transformation*transformation);
return this; return this;
@ -87,19 +87,19 @@ template<class T = GLfloat> class MatrixTransformation3D: public AbstractTransla
/** /**
* @copydoc AbstractTranslationRotationScaling3D::translate() * @copydoc AbstractTranslationRotationScaling3D::translate()
* Same as calling multiplyTransformation() with Matrix4::translation(). * Same as calling transform() with Matrix4::translation().
*/ */
inline MatrixTransformation3D<T>* translate(const Math::Vector3<T>& vector, TransformationType type = TransformationType::Global) override { inline MatrixTransformation3D<T>* translate(const Math::Vector3<T>& vector, TransformationType type = TransformationType::Global) override {
multiplyTransformation(Math::Matrix4<T>::translation(vector), type); transform(Math::Matrix4<T>::translation(vector), type);
return this; return this;
} }
/** /**
* @copydoc AbstractTranslationRotationScaling3D::rotate() * @copydoc AbstractTranslationRotationScaling3D::rotate()
* Same as calling multiplyTransformation() with Matrix4::rotation(). * Same as calling transform() with Matrix4::rotation().
*/ */
inline MatrixTransformation3D<T>* rotate(T angle, const Math::Vector3<T>& normalizedAxis, TransformationType type = TransformationType::Global) override { inline MatrixTransformation3D<T>* rotate(T angle, const Math::Vector3<T>& normalizedAxis, TransformationType type = TransformationType::Global) override {
multiplyTransformation(Math::Matrix4<T>::rotation(angle, normalizedAxis), type); transform(Math::Matrix4<T>::rotation(angle, normalizedAxis), type);
return this; return this;
} }
@ -109,11 +109,11 @@ template<class T = GLfloat> class MatrixTransformation3D: public AbstractTransla
* @param type Transformation type * @param type Transformation type
* @return Pointer to self (for method chaining) * @return Pointer to self (for method chaining)
* *
* Same as calling multiplyTransformation() with Matrix4::rotationX(). * Same as calling transform() with Matrix4::rotationX().
* @see deg(), rad() * @see deg(), rad()
*/ */
inline MatrixTransformation3D<T>* rotateX(T angle, TransformationType type = TransformationType::Global) override { inline MatrixTransformation3D<T>* rotateX(T angle, TransformationType type = TransformationType::Global) override {
multiplyTransformation(Math::Matrix4<T>::rotationX(angle), type); transform(Math::Matrix4<T>::rotationX(angle), type);
return this; return this;
} }
@ -123,11 +123,11 @@ template<class T = GLfloat> class MatrixTransformation3D: public AbstractTransla
* @param type Transformation type * @param type Transformation type
* @return Pointer to self (for method chaining) * @return Pointer to self (for method chaining)
* *
* Same as calling multiplyTransformation() with Matrix4::rotationY(). * Same as calling transform() with Matrix4::rotationY().
* @see deg(), rad() * @see deg(), rad()
*/ */
inline MatrixTransformation3D<T>* rotateY(T angle, TransformationType type = TransformationType::Global) override { inline MatrixTransformation3D<T>* rotateY(T angle, TransformationType type = TransformationType::Global) override {
multiplyTransformation(Math::Matrix4<T>::rotationY(angle), type); transform(Math::Matrix4<T>::rotationY(angle), type);
return this; return this;
} }
@ -137,20 +137,20 @@ template<class T = GLfloat> class MatrixTransformation3D: public AbstractTransla
* @param type Transformation type * @param type Transformation type
* @return Pointer to self (for method chaining) * @return Pointer to self (for method chaining)
* *
* Same as calling multiplyTransformation() with Matrix4::rotationZ(). * Same as calling transform() with Matrix4::rotationZ().
* @see deg(), rad() * @see deg(), rad()
*/ */
inline MatrixTransformation3D<T>* rotateZ(T angle, TransformationType type = TransformationType::Global) override { inline MatrixTransformation3D<T>* rotateZ(T angle, TransformationType type = TransformationType::Global) override {
multiplyTransformation(Math::Matrix4<T>::rotationZ(angle), type); transform(Math::Matrix4<T>::rotationZ(angle), type);
return this; return this;
} }
/** /**
* @copydoc AbstractTranslationRotationScaling3D::scale() * @copydoc AbstractTranslationRotationScaling3D::scale()
* Same as calling multiplyTransformation() with Matrix4::scaling(). * Same as calling transform() with Matrix4::scaling().
*/ */
inline MatrixTransformation3D<T>* scale(const Math::Vector3<T>& vector, TransformationType type = TransformationType::Global) override { inline MatrixTransformation3D<T>* scale(const Math::Vector3<T>& vector, TransformationType type = TransformationType::Global) override {
multiplyTransformation(Math::Matrix4<T>::scaling(vector), type); transform(Math::Matrix4<T>::scaling(vector), type);
return this; return this;
} }

Loading…
Cancel
Save