Add CMatrix4::transformVec4 to transform vectors with 4 elements

Thx @devsh for noting this was missing.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5819 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2019-05-31 13:05:59 +00:00
parent 8db58f1505
commit 294da48122
2 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,6 @@
--------------------------
Changes in 1.9 (not yet released)
- Add CMatrix4::transformVec4 to transform vectors with 4 elements (thx @ devsh)
- Add ITexture::getOriginalColorFormat to access color format of images used to create a texture
- Add IMemoryReadFile interface which allows direct access to memory block used as file.
- Add IReadFile::getType() interface to all users to find out what kind of class implements that interface.

View File

@ -251,6 +251,9 @@ namespace core
NOTE: out[3] will be written to (4th vector component)*/
void transformVec3(T *out, const T * in) const;
//! An alternate transform vector method, reading from and writing to an array of 4 floats
void transformVec4(T *out, const T * in) const;
//! Translate a vector by the translation part of this matrix.
/** This operation is performed as if the vector was 4d with the 4th component =1 */
void translateVect( vector3df& vect ) const;
@ -1225,6 +1228,15 @@ namespace core
out[2] = in[0]*M[2] + in[1]*M[6] + in[2]*M[10] + M[14];
}
template <class T>
inline void CMatrix4<T>::transformVec4(T *out, const T * in) const
{
out[0] = in[0]*M[0] + in[1]*M[4] + in[2]*M[8] + in[3]*M[12];
out[1] = in[0]*M[1] + in[1]*M[5] + in[2]*M[9] + in[3]*M[13];
out[2] = in[0]*M[2] + in[1]*M[6] + in[2]*M[10] + in[3]*M[14];
out[3] = in[0]*M[3] + in[1]*M[7] + in[2]*M[11] + in[3]*M[16];
}
//! Transforms a plane by this matrix
template <class T>