PageRenderTime 60ms CodeModel.GetById 20ms app.highlight 5ms RepoModel.GetById 15ms app.codeStats 0ms

/src/away3d/core/traverse/ShadowCasterCollector.as

http://github.com/away3d/away3d-core-fp11
ActionScript | 79 lines | 55 code | 9 blank | 15 comment | 2 complexity | ee5833fa54ca001a4487c03d1622e8bd MD5 | raw file
 1package away3d.core.traverse
 2{
 3	import away3d.arcane;
 4	import away3d.core.base.IRenderable;
 5	import away3d.core.data.RenderableListItem;
 6	import away3d.entities.Entity;
 7	import away3d.lights.DirectionalLight;
 8	import away3d.lights.LightBase;
 9	import away3d.lights.LightProbe;
10	import away3d.lights.PointLight;
11	import away3d.materials.MaterialBase;
12
13	import flash.geom.Vector3D;
14
15	use namespace arcane;
16	
17	/**
18	 * The EntityCollector class is a traverser for scene partitions that collects all scene graph entities that are
19	 * considered potientially visible.
20	 *
21	 * @see away3d.partition.Partition3D
22	 * @see away3d.partition.Entity
23	 */
24	public class ShadowCasterCollector extends EntityCollector
25	{
26		/**
27		 * Creates a new EntityCollector object.
28		 */
29		public function ShadowCasterCollector()
30		{
31			super();
32		}
33		
34		/**
35		 * Adds an IRenderable object to the potentially visible objects.
36		 * @param renderable The IRenderable object to add.
37		 */
38		override public function applyRenderable(renderable:IRenderable):void
39		{
40			// the test for material is temporary, you SHOULD be hammered with errors if you try to render anything without a material
41			var material:MaterialBase = renderable.material;
42			var entity:Entity = renderable.sourceEntity;
43			if (renderable.castsShadows && material) {
44				var item:RenderableListItem = _renderableListItemPool.getItem();
45				item.renderable = renderable;
46				item.next = _opaqueRenderableHead;
47				item.cascaded = false;
48				var entityScenePos:Vector3D = entity.scenePosition;
49				var dx:Number = _entryPoint.x - entityScenePos.x;
50				var dy:Number = _entryPoint.y - entityScenePos.y;
51				var dz:Number = _entryPoint.z - entityScenePos.z;
52				item.zIndex = dx*_cameraForward.x + dy*_cameraForward.y + dz*_cameraForward.z;
53				item.renderSceneTransform = renderable.getRenderSceneTransform(_camera);
54				item.renderOrderId = material._depthPassId;
55				_opaqueRenderableHead = item;
56			}
57		}
58		
59		override public function applyUnknownLight(light:LightBase):void
60		{
61		}
62		
63		override public function applyDirectionalLight(light:DirectionalLight):void
64		{
65		}
66		
67		override public function applyPointLight(light:PointLight):void
68		{
69		}
70		
71		override public function applyLightProbe(light:LightProbe):void
72		{
73		}
74		
75		override public function applySkyBox(renderable:IRenderable):void
76		{
77		}
78	}
79}