[BUG] in Matrix4f.translate

Started by mattssp, March 12, 2011, 20:08:07

Previous topic - Next topic

mattssp

Hi,

if I'm not totally wrong, translate should load dest with the values from src first.

/**
566    * Translate the source matrix and stash the result in the destination matrix
567    * @param vec The vector to translate by
568    * @param src The source matrix
569    * @param dest The destination matrix or null if a new matrix is to be created
570    * @return The translated matrix
571    */
572    public static Matrix4f translate(Vector3f vec, Matrix4f src, Matrix4f dest) {
573    if (dest == null)
574    dest = new Matrix4f();
575    
576    dest.m30 += src.m00 * vec.x + src.m10 * vec.y + src.m20 * vec.z;
577    dest.m31 += src.m01 * vec.x + src.m11 * vec.y + src.m21 * vec.z;
578    dest.m32 += src.m02 * vec.x + src.m12 * vec.y + src.m22 * vec.z;
579    dest.m33 += src.m03 * vec.x + src.m13 * vec.y + src.m23 * vec.z;
580    
581    return dest;
582    }

Regards,
Matthias