Export to GitHub

webgl-mjs - issue #3

M4x4.clone() is incorrect when MJS_FLOAT_ARRAY_TYPE == Array


Posted on Feb 7, 2010 by Happy Bear

.clone fails to copy the last 4 elements of the matrix:

M4x4.clone = function M4x4_clone(m) {
    //MathUtils_assert(m.length == 16, "m.length == 16");
    return new [m[0], m[1], m[2], m[3],
                m[4], m[5], m[6], m[7],
                m[8], m[9], m[10], m[11]];
};

should read:

M4x4.clone = function M4x4_clone(m) {
    //MathUtils_assert(m.length == 16, "m.length == 16");
    return new [m[0], m[1], m[2], m[3],
                m[4], m[5], m[6], m[7],
                m[8], m[9], m[10], m[11],
                m[12], m[13], m[14], m[15]];
};

Comment #1

Posted on Oct 7, 2010 by Quick Cat

You need to get rid of the 'new' keyword, in addition to adding m[12] through m[15].

Comment #2

Posted on Dec 15, 2010 by Swift Hippo

This issue was closed by revision 68a0bb55e4.

Status: Fixed

Labels:
Type-Defect Priority-Medium