Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 15th, 2012  |  syntax: None  |  size: 0.88 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. vec3.unproject() mouse collision problems
  2. var fNearZ  = -100.0;
  3. var farZ    = 100.0;
  4. var fZoom   = 10.0;
  5. var iR      = this.iWidth/fZoom;
  6. var iL      = (this.iWidth/fZoom)*(-1);
  7. var iT      = this.iHeight/fZoom;
  8. var iB      = (this.iHeight/fZoom)*(-1);
  9.  
  10. var pMatrix     = new mat4.ortho(iL, iR, iB, iT, fNearZ, farZ);
  11. var mvMatrix    = new mat4.create();
  12.  
  13. mat4.identity(mvMatrix);
  14. zI.debug(mat4.str(mvMatrix),{'grp':'mv_before','style':'color:#060;'});
  15.  
  16. mat4.translate(mvMatrix, [0.0, 0.0, -50.0]);
  17. mat4.scale(mvMatrix, [3, 3, 3]);
  18.  
  19. zI.debug(vec3.unproject([
  20.         parseFloat(this.pLastMouse.x-this.iLeft),
  21.         parseFloat(this.pLastMouse.y-this.iTop),
  22.         0
  23.     ],
  24.     mvMatrix,
  25.     pMatrix,
  26.     [
  27.         0,
  28.         0,
  29.         this.iWidth,
  30.         this.iHeight
  31.     ]),{'grp':'dest____','style':'color:#00F;'});
  32.  
  33. this.setMatrices(pMatrix, mvMatrix);
  34. //After this line, buffers will be set