Merge r4556-4557 from trunk:

Add a CMatrix4::getRotationDegrees where you can pass the scale vector if you know it (faster and useful otherwise sometimes).
Fix material deserialization. Empty textures were producing a texture named '0' (zero), which lead to annoying warnings all over the place. This empty string is hopefully safe everywhere.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4639 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2014-01-07 22:53:20 +00:00
parent 05f3c9eaa4
commit 6f49422ab5
2 changed files with 26 additions and 6 deletions

View File

@ -173,8 +173,15 @@ namespace core
//! Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
CMatrix4<T>& setRotationDegrees( const vector3d<T>& rotation );
//! Get the rotation, as set by setRotation() when you already know the scale.
/** If you already know the scale then this function is faster than the other getRotationDegrees overload.
NOTE: You will have the same end-rotation as used in setRotation, but it might not use the same axis values.
*/
core::vector3d<T> getRotationDegrees(const vector3d<T>& scale) const;
//! Returns the rotation, as set by setRotation().
/** This code was orginally written by by Chev. */
/** NOTE: You will have the same end-rotation as used in setRotation, but it might not use the same axis values.
*/
core::vector3d<T> getRotationDegrees() const;
//! Make an inverted rotation matrix from Euler angles.
@ -855,12 +862,14 @@ namespace core
//! Returns a rotation that is equivalent to that set by setRotationDegrees().
/** This code was sent in by Chev. Note that it does not necessarily return
the *same* Euler angles as those set by setRotationDegrees(), but the rotation will
be equivalent, i.e. will have the same result when used to rotate a vector or node. */
be equivalent, i.e. will have the same result when used to rotate a vector or node.
This code was orginally written by by Chev.
*/
template <class T>
inline core::vector3d<T> CMatrix4<T>::getRotationDegrees() const
inline core::vector3d<T> CMatrix4<T>::getRotationDegrees(const vector3d<T>& scale_) const
{
const CMatrix4<T> &mat = *this;
core::vector3d<T> scale = getScale();
core::vector3d<T> scale(scale_);
// we need to check for negative scale on to axes, which would bring up wrong results
if (scale.Y<0 && scale.Z<0)
{
@ -911,6 +920,17 @@ namespace core
return vector3d<T>((T)X,(T)Y,(T)Z);
}
//! Returns a rotation that is equivalent to that set by setRotationDegrees().
/** This code was sent in by Chev. Note that it does not necessarily return
the *same* Euler angles as those set by setRotationDegrees(), but the rotation will
be equivalent, i.e. will have the same result when used to rotate a vector or node.
This code was orginally written by by Chev. */
template <class T>
inline core::vector3d<T> CMatrix4<T>::getRotationDegrees() const
{
return getRotationDegrees(getScale());
}
//! Sets matrix to rotation matrix of inverse angles given as parameters
template <class T>

View File

@ -1905,7 +1905,7 @@ public:
if ( Value )
return core::stringw(Value->getName().getPath().c_str());
return core::stringw(0);
return core::stringw();
}
virtual core::stringc getString() _IRR_OVERRIDE_
@ -1917,7 +1917,7 @@ public:
if ( Value )
return core::stringc(Value->getName().getPath().c_str());
return core::stringc(0);
return core::stringc();
}
virtual void setString(const char* text) _IRR_OVERRIDE_