PageRenderTime 29ms CodeModel.GetById 23ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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