B2G/gecko/browser/devtools/tilt/TiltMath.jsm
/**
   * Copies the upper 3x3 elements of a mat4 into another mat4.
   *
   * @param {Array} aMat
   *                mat4 containing values to copy
   * @param {Array} aDest
   *                optional, mat4 receiving operation result
   *                if not specified result is written to the first operand
   *
   * @return {Array} the destination mat4 if specified, first operand otherwise
   */
Copies the upper 3x3 elements of a mat4 into another mat4.
@param {Array} aMat
mat4 containing values to copy
@param {Array} aDest
optional, mat4 receiving operation result
if not specified result is written to the first operand

@return {Array} the destination mat4 if specified, first operand otherwise
Copies the upper 3x3 elements of a mat4 into another mat4 . @param { Array } aMat mat4 containing values to copy @param { Array } aDest optional mat4 receiving operation result if not specified result is written to the first operand @return { Array } the destination mat4 if specified first operand otherwise
function M4_toRotationMat(aMat, aDest)
  {
    if (!aDest) {
      aDest = new Float32Array(16);
    }
    aDest[0] = aMat[0];
    aDest[1] = aMat[1];
    aDest[2] = aMat[2];
    aDest[3] = aMat[3];
    aDest[4] = aMat[4];
    aDest[5] = aMat[5];
    aDest[6] = aMat[6];
    aDest[7] = aMat[7];
    aDest[8] = aMat[8];
    aDest[9] = aMat[9];
    aDest[10] = aMat[10];
    aDest[11] = aMat[11];
    aDest[12] = 0;
    aDest[13] = 0;
    aDest[14] = 0;
    aDest[15] = 1;
    return aDest;
  }
function M4_toRotationMat ( aMat , aDest ) { if ( ! aDest ) { aDest = new Float32Array ( 16 ) ; } aDest [ 0 ] = aMat [ 0 ] ; aDest [ 1 ] = aMat [ 1 ] ; aDest [ 2 ] = aMat [ 2 ] ; aDest [ 3 ] = aMat [ 3 ] ; aDest [ 4 ] = aMat [ 4 ] ; aDest [ 5 ] = aMat [ 5 ] ; aDest [ 6 ] = aMat [ 6 ] ; aDest [ 7 ] = aMat [ 7 ] ; aDest [ 8 ] = aMat [ 8 ] ; aDest [ 9 ] = aMat [ 9 ] ; aDest [ 10 ] = aMat [ 10 ] ; aDest [ 11 ] = aMat [ 11 ] ; aDest [ 12 ] = 0 ; aDest [ 13 ] = 0 ; aDest [ 14 ] = 0 ; aDest [ 15 ] = 1 ; return aDest ; }
Copies the upper 3x3 elements of a mat4 into another mat4.
Copies the upper 3x3 elements of a mat4 into another mat4 .