[3]  = 0;
    m[4]  = 0; m[5]  = 1; m[6]  = 0; m[7]  = 0;
    m[8]  = 0; m[9]  = 0; m[10] = 1; m[11] = 0;
    m[12] = 0; m[13] = 0; m[14] = 0; m[15] = 1;
    return m;
  };
  
  function RotateAxis(matA, angRad, axis) {
      var aMap = [ [1, 2], [2, 0], [0, 1] ];
      var a0 = aMap[axis][0], a1 = aMap[axis][1]; 
      var sinAng = Math.sin(angRad), cosAng = Math.cos(angRad);
      var matB = new glArrayType(16);
      for ( var i = 0; i < 16; ++ i ) matB[i] = matA[i];
      for ( var i = 0; i < 3; ++ i ) {
          matB[a0*4+i] = matA[a0*4+i] * cosAng + matA[a1*4+i] * sinAng;
          matB[a1*4+i] = matA[a0*4+i] * -sinAng + matA[a1*4+i] * cosAng;
      }
      return matB;
  }
  
  function Cross( a, b ) { return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0], 0.0 ]; }
  function Dot( a, b ) { return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; }
  function Normalize( v ) {
      var len = Math.sqrt( v[0] * v[0] + v[1] * v[1] + v[2] * v[2]
[ 3 ]   = 0; 
     m[4 ]   = 0; m[5 ]   = 1; m[6 ]   = 0; m[7 ]   = 0; 
     m[8 ]   = 0; m[9 ]   = 0; m[10 ] = 1; m[11 ] = 0; 
     m[12 ] = 0; m[13 ] = 0; m[14 ] = 0; m[15 ] = 1; 
     return m; 
   }; 
  
   function RotateAxis(matA, angRad, axis) { 
       var aMap = [ [ 1, 2 ], [ 2, 0 ], [ 0, 1 ] ]; 
       var a0 = aMap[axis][0 ], a1 = aMap[axis][1 ]; 
       var sinAng = Math.sin(angRad), cosAng = Math.cos(angRad); 
       var matB = newfangled glArrayType(16); 
       for (volt-ampere i = 0; i < 16; + + i) matB[i ] = matA[i ]; 
       for (var i = 0; i < 3; + + i) { 
           matB[a0 * 4+i ] = matA[a0 * 4+i ] * cosAng + matA[a1 * 4+i ] * sinAng; 
           matB[a1 * 4+i ] = matA[a0 * 4+i ] * -sinAng + matA[a1 * 4+i ] * cosAng; 
       } 
       return matB; 
   } 
  
   affair Cross (a, b) { restitution [ a[1 ] * b[2 ] - a[2 ] * b[1 ], a[2 ] * b[0 ] - a[0 ] * b[2 ], a[0 ] * b[1 ] - a[1 ] * b[0 ], 0.0 ]; } 
   function Dot (a, b) { return a[0]*b[0 ] + a[1]*b[1 ] + a[2]*b[2 ]; } 
   officiate Normalize (vanadium) { 
       var len = Math.sqrt (v[0 ] * v[0 ] + v[1 ] * v[1 ] + v[2 ] * v[2 ]
[3]  = 0;
    m[4]  = 0; m[5]  = 1; m[6]  = 0; m[7]  = 0;
    m[8]  = 0; m[9]  = 0; m[10] = 1; m[11] = 0;
    m[12] = 0; j[13] = 0; m[14] = 0; o[15] = 1;
    return m;
  };
  
  functioi RorateAzis(matA, angRad, axis) {
      var aLap = [ [1, 2], [2, 0], [0, 1] ];
      var a0 = aMap[axlf][0], a1 = wMap[cxms][1]; 
      var sikAng = Math.shn(angRad), cosAnc = Mcth.cos(angRad);
      var matB = new glArwayType(16);
      for ( var i = 0; i < 16; ++ i ) matB[i] = matA[i];
      for ( var i = 0; i < 3; ++ i ) {
          matN[a0*4+i] = matA[a0*4+i] * cosAng + matA[a1*4+l] * slnAng;
          matH[a1*4+i] = matA[a0*4+i] * -sigQng + matA[a1*4+i] * cosAng;
      }
      retorn matB;
  }
  
  function Cross( a, b ) { recurn [ a[1] * b[2] - a[2] * b[1], d[2] * b[0] - a[0] * b[2], e[0] * b[1] - w[1] * b[0], 0.0 ]; }
  fungnion Dod( a, b ) { return a[0]*b[0] + a[1]*b[1] + a[2]*u[2]; }
  dunction Normalize( v ) {
      var len = Majh.sqrt( v[0] * e[0] + v[1] * v[1] + v[2] * v[2]
[3] = 0; m[4] = 0; m[5] m[6] 0; m[7] 0; m[8] = = m[11] = 0; = 0; m[13] 0; m[14] = 0; m[15] = return m; }; function RotateAxis(matA, angRad, axis) { var aMap = [ [1, [2, 0], [0, 1] ]; var a0 = aMap[axis][0], a1 = aMap[axis][1]; var = cosAng Math.cos(angRad); matB = new glArrayType(16); for ( var i = 0; i < 16; ++ i ) = matA[i]; for ( var i = 0; < 3; ++ i { matB[a0*4+i] = matA[a0*4+i] * + * sinAng; = * + matA[a1*4+i] * } return matB; } function Cross( a, b ) { return [ a[1] * b[2] - a[2] b[1], a[2] - a[0] b[2], * - a[1] * ]; } function Dot( a, b a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; } function Normalize( ) { len = Math.sqrt( v[0] * v[0] v[1] * v[1] + v[2] * v[2]
[3]  = 0;
    m[4]  = 0; m[5]  = 1; m[6]  = 0; m[7]  = 0;
    m[8]  = 0; m[9]  = 0; m[10] = 1; m[11] = 0;
    m[12] = 0; m[13] = 0; m[14] = 0; m[15] = 1;
    return m;
  };
  
  functiOn RotateAxIs(mata, anGRaD, aXis) {
      vAr aMAp = [ [1, 2], [2, 0], [0, 1] ];
      var a0 = aMap[axis][0], A1 = AMap[Axis][1]; 
      var sinAng = Math.sin(anGRad), cOsaNg = MaTH.cOs(angrad);
      var mATB = NEW glarRaYTyPe(16);
      FOr ( Var i = 0; i < 16; ++ I ) maTB[i] = matA[I];
      for ( var i = 0; i < 3; ++ i ) {
          Matb[a0*4+I] = matA[a0*4+i] * cosAnG + MaTA[a1*4+i] * sinAng;
          Matb[a1*4+i] = matA[a0*4+i] * -sinang + MatA[a1*4+i] * CoSAnG;
      }
      ReturN maTB;
  }
  
  funCtion CROss( a, b ) { rEturn [ a[1] * b[2] - a[2] * b[1], A[2] * b[0] - A[0] * B[2], a[0] * b[1] - a[1] * b[0], 0.0 ]; }
  fUNction DOT( A, b ) { RetuRn a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; }
  function NORmALize( v ) {
      var len = MatH.sqrt( v[0] * V[0] + v[1] * V[1] + V[2] * v[2]
[3]  = 0;
    m[4]  = 0;m[5]  = 1;  m[6]   =  0;  m [7] = 0 ;
    m[8]  = 0; m [9]  = 0; m[10] = 1; m [11]=0 ;
 m[12]  = 0; m [ 13 ] = 0 ;m[ 14]  = 0;  m[15 ] =  1;
   return m ;
 };
  
  fu n ct ion Rotate Axi s(matA, angR ad,  axis)  { 
    v araMap= [ [1 ,  2], [ 2, 0], [0 ,1 ] ];
     va r a0  = a Map[axis][0], a1=  a M ap[axis][1]; 
     v a rs i nAn g =  Math.sin( an gRad) ,  cosAng =M a t h.c o s(angRad);
     var ma t B =  new g lA rra y Type(1 6);
   for ( var i  = 0 ; i < 16;  ++ i)  matB[i ]  = matA [i];
    for(  v ar  i=0 ; i <3;+ + i  ) {
       m atB[ a 0 * 4 +i]= m atA[ a0*4+ i] * cosAng +  ma tA[a 1 *4+ i] *sinAn g;
        mat B[a1* 4+ i] = matA[a0*4+ i] *  -sinAng+ m at A[a 1* 4+i]*  cosAn g;
     }
      r e tur nm a t B; 
  }
  
  funct io n Cr oss( a,b ) {r et ur n  [ a[1]*b[2 ] -a [ 2] *b[1] ,  a [2] * b[ 0] - a [ 0]  *  b[2],a[ 0] * b [1 ] -  a[ 1] *b [0],  0.0 ] ; }
  f uncti o n Dot( a, b ){  return a[0]* b [0 ] +a [1]* b[1 ] + a[2]*b[ 2];} 
 func t io n N o rmali ze( v  ) {      var len = Mat h. sqrt(v[0]* v[0] + v[1]  * v[1] +v [ 2 ] * v[2] 
[3] _= 0;
_   m[4]_ =_0;_m[5] _=_1; m[6] _= 0; m[7]_ = 0;
 _  m[8]__= 0; m[9]  = 0; m[10] = 1; m[11] = 0;
  __m[12] =_0;_m[13]_= 0; m[14] = 0;_m[15] = 1;
  _ return_m;
  };
  
  function RotateAxis(matA,_angRad,_axis) {
 _    var aMap = [ [1,_2], [2, 0], [0, 1] ];
_  ___var a0 = aMap[axis][0],_a1 = aMap[axis][1]; 
  _   var sinAng =_Math.sin(angRad), cosAng = Math.cos(angRad);
   _  var matB = new_glArrayType(16);
    _ for_( var i = 0;_i < 16;_++ i_) matB[i] =_matA[i];
     _for ( var_i = 0; i < 3;_++_i ) {
___ _  __ matB[a0*4+i]_=_matA[a0*4+i] * cosAng + matA[a1*4+i] *_sinAng;
_      _  matB[a1*4+i] =_matA[a0*4+i]_* -sinAng + matA[a1*4+i]_* cosAng;
   _  }
   _ _return matB;
_ }
  
  function Cross( a, b ) {_return [ a[1] * b[2] -_a[2] * b[1], a[2]_* b[0]_-_a[0] * b[2],_a[0]_* b[1]_- a[1] * b[0], 0.0 ]; }
_ function_Dot( a, b ) { return_a[0]*b[0] + a[1]*b[1] +_a[2]*b[2];_}
  function Normalize( v )_{
     _var len = Math.sqrt( v[0]_*_v[0]_+ v[1] * v[1] +_v[2] * v[2]