/src/away3d/cameras/lenses/FreeMatrixLens.as

http://github.com/away3d/away3d-core-fp11 · ActionScript · 53 lines · 39 code · 7 blank · 7 comment · 0 complexity · ee90d7a9fa3a946cfcd07167b64e512c MD5 · raw file

  1. package away3d.cameras.lenses
  2. {
  3. import away3d.arcane;
  4. use namespace arcane;
  5. /**
  6. * FreeMatrixLens provides a projection lens that exposes a full projection matrix, rather than provide one through
  7. * more user-friendly settings. Whenever the matrix is updated, it needs to be reset in order to trigger an update.
  8. */
  9. public class FreeMatrixLens extends LensBase
  10. {
  11. /**
  12. * Creates a new FreeMatrixLens object.
  13. */
  14. public function FreeMatrixLens()
  15. {
  16. super();
  17. _matrix.copyFrom(new PerspectiveLens().matrix);
  18. }
  19. override public function set near(value:Number):void
  20. {
  21. _near = value;
  22. }
  23. override public function set far(value:Number):void
  24. {
  25. _far = value;
  26. }
  27. arcane override function set aspectRatio(value:Number):void
  28. {
  29. _aspectRatio = value;
  30. }
  31. override public function clone():LensBase
  32. {
  33. var clone:FreeMatrixLens = new FreeMatrixLens();
  34. clone._matrix.copyFrom(_matrix);
  35. clone._near = _near;
  36. clone._far = _far;
  37. clone._aspectRatio = _aspectRatio;
  38. clone.invalidateMatrix();
  39. return clone;
  40. }
  41. override protected function updateMatrix():void
  42. {
  43. _matrixInvalid = false;
  44. }
  45. }
  46. }