PageRenderTime 21ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/src/away3d/filters/Filter3DBase.as

http://github.com/away3d/away3d-core-fp11
ActionScript | 84 lines | 67 code | 16 blank | 1 comment | 3 complexity | 4a1fc77ab4250f755fa913fc4e73d6f6 MD5 | raw file
 1package away3d.filters
 2{
 3	import away3d.cameras.Camera3D;
 4	import away3d.core.managers.Stage3DProxy;
 5	import away3d.filters.tasks.Filter3DTaskBase;
 6	
 7	import flash.display3D.textures.Texture;
 8	
 9	public class Filter3DBase
10	{
11		private var _tasks:Vector.<Filter3DTaskBase>;
12		private var _requireDepthRender:Boolean;
13		private var _textureWidth:int;
14		private var _textureHeight:int;
15		
16		public function Filter3DBase()
17		{
18			_tasks = new Vector.<Filter3DTaskBase>();
19		}
20		
21		public function get requireDepthRender():Boolean
22		{
23			return _requireDepthRender;
24		}
25		
26		protected function addTask(filter:Filter3DTaskBase):void
27		{
28			_tasks.push(filter);
29			_requireDepthRender ||= filter.requireDepthRender;
30		}
31		
32		public function get tasks():Vector.<Filter3DTaskBase>
33		{
34			return _tasks;
35		}
36		
37		public function getMainInputTexture(stage3DProxy:Stage3DProxy):Texture
38		{
39			return _tasks[0].getMainInputTexture(stage3DProxy);
40		}
41		
42		public function get textureWidth():int
43		{
44			return _textureWidth;
45		}
46		
47		public function set textureWidth(value:int):void
48		{
49			_textureWidth = value;
50			
51			for (var i:int = 0; i < _tasks.length; ++i)
52				_tasks[i].textureWidth = value;
53		}
54		
55		public function get textureHeight():int
56		{
57			return _textureHeight;
58		}
59		
60		public function set textureHeight(value:int):void
61		{
62			_textureHeight = value;
63			for (var i:int = 0; i < _tasks.length; ++i)
64				_tasks[i].textureHeight = value;
65		}
66		
67		// link up the filters correctly with the next filter
68		public function setRenderTargets(mainTarget:Texture, stage3DProxy:Stage3DProxy):void
69		{
70			_tasks[_tasks.length - 1].target = mainTarget;
71		}
72		
73		public function dispose():void
74		{
75			for (var i:int = 0; i < _tasks.length; ++i)
76				_tasks[i].dispose();
77		}
78		
79		public function update(stage:Stage3DProxy, camera:Camera3D):void
80		{
81		
82		}
83	}
84}