PageRenderTime 82ms CodeModel.GetById 41ms app.highlight 4ms RepoModel.GetById 36ms app.codeStats 0ms

/src/away3d/filters/BlurFilter3D.as

http://github.com/away3d/away3d-core-fp11
ActionScript | 68 lines | 48 code | 10 blank | 10 comment | 0 complexity | 9d4f5c064ae6d7fd460021107b536be8 MD5 | raw file
 1package away3d.filters
 2{
 3	import away3d.core.managers.Stage3DProxy;
 4	import away3d.filters.tasks.Filter3DHBlurTask;
 5	import away3d.filters.tasks.Filter3DVBlurTask;
 6	
 7	import flash.display3D.textures.Texture;
 8	
 9	public class BlurFilter3D extends Filter3DBase
10	{
11		private var _hBlurTask:Filter3DHBlurTask;
12		private var _vBlurTask:Filter3DVBlurTask;
13		
14		/**
15		 * Creates a new BlurFilter3D object
16		 * @param blurX The amount of horizontal blur to apply
17		 * @param blurY The amount of vertical blur to apply
18		 * @param stepSize The distance between samples. Set to -1 to autodetect with acceptable quality.
19		 */
20		public function BlurFilter3D(blurX:uint = 3, blurY:uint = 3, stepSize:int = -1)
21		{
22			super();
23			addTask(_hBlurTask = new Filter3DHBlurTask(blurX, stepSize));
24			addTask(_vBlurTask = new Filter3DVBlurTask(blurY, stepSize));
25		}
26		
27		public function get blurX():uint
28		{
29			return _hBlurTask.amount;
30		}
31		
32		public function set blurX(value:uint):void
33		{
34			_hBlurTask.amount = value;
35		}
36		
37		public function get blurY():uint
38		{
39			return _vBlurTask.amount;
40		}
41		
42		public function set blurY(value:uint):void
43		{
44			_vBlurTask.amount = value;
45		}
46		
47		/**
48		 * The distance between two blur samples. Set to -1 to autodetect with acceptable quality (default value).
49		 * Higher values provide better performance at the cost of reduces quality.
50		 */
51		public function get stepSize():int
52		{
53			return _hBlurTask.stepSize;
54		}
55		
56		public function set stepSize(value:int):void
57		{
58			_hBlurTask.stepSize = value;
59			_vBlurTask.stepSize = value;
60		}
61		
62		override public function setRenderTargets(mainTarget:Texture, stage3DProxy:Stage3DProxy):void
63		{
64			_hBlurTask.target = _vBlurTask.getMainInputTexture(stage3DProxy);
65			super.setRenderTargets(mainTarget, stage3DProxy);
66		}
67	}
68}