Advertisement
Guest User

CopperLicht:: CameraSceneNode.setOrthogonal

a guest
Jan 4th, 2012
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     CL3D.CameraSceneNode.prototype.setOrthogonal = function(mode) {
  2.         this.orthogonal = mode;
  3.         this.recalculateProjectionMatrix();
  4.     }
  5.  
  6.     CL3D.CameraSceneNode.prototype.recalculateProjectionMatrix = function () {
  7.         if (this.orthogonal) this.Projection.buildProjectionMatrixOrthogonalFovLH(this.Fovy, this.Aspect, this.ZNear, this.ZFar);
  8.         else this.Projection.buildProjectionMatrixPerspectiveFovLH(this.Fovy, this.Aspect, this.ZNear, this.ZFar);
  9.     };
  10.  
  11.     CL3D.Matrix4.prototype.buildProjectionMatrixOrthogonalFovLH = function (e, d, f, c) {
  12.         var b = (20 / Math.tan(e / 2));
  13.         var a = (b / d) * 5 / 3;//25;
  14.         this.m00 = 2 / a;
  15.         this.m01 = 0;
  16.         this.m02 = 0;
  17.         this.m03 = 0;
  18.         this.m04 = 0;
  19.         this.m05 = 2 / b;
  20.         this.m06 = 0;
  21.         this.m07 = 0;
  22.         this.m08 = 0;
  23.         this.m09 = 0;
  24.         this.m10 = (1 / (c - f));
  25.         this.m11 = 0;
  26.         this.m12 = 0;
  27.         this.m13 = 0;
  28.         this.m14 = f / (f - c);
  29.         this.m15 = 1;
  30.         this.bIsIdentity = false;
  31.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement