PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/away3d/core/traverse/PartitionTraverser.as

http://github.com/away3d/away3d-core-fp11
ActionScript | 110 lines | 61 code | 16 blank | 33 comment | 0 complexity | 03257022b39a6bf738c63c32aeacbfc7 MD5 | raw file
  1package away3d.core.traverse
  2{
  3	import away3d.arcane;
  4	import away3d.containers.Scene3D;
  5	import away3d.core.base.IRenderable;
  6	import away3d.core.partition.NodeBase;
  7	import away3d.entities.Entity;
  8	import away3d.errors.AbstractMethodError;
  9	import away3d.lights.DirectionalLight;
 10	import away3d.lights.LightBase;
 11	import away3d.lights.LightProbe;
 12	import away3d.lights.PointLight;
 13	
 14	import flash.geom.Vector3D;
 15	
 16	use namespace arcane;
 17	
 18	/**
 19	 * IPartitionTraverser is a hierarchical visitor pattern that traverses through a Partition3D data structure.
 20	 *
 21	 * @see away3d.partition.Partition3D
 22	 */
 23	public class PartitionTraverser
 24	{
 25		/**
 26		 * The scene being traversed.
 27		 */
 28		public var scene:Scene3D;
 29		
 30		arcane var _entryPoint:Vector3D;
 31		
 32		/**
 33		 * A property that can be used to avoid processing a partition more than once.
 34		 */
 35		arcane static var _collectionMark:uint;
 36		
 37		public function PartitionTraverser()
 38		{
 39		
 40		}
 41		
 42		/**
 43		 * Called when the traversers enters a node. At minimum, it notifies the currently visited Partition3DNode whether or not further recursion is necessary.
 44		 * @param node The currently entered node.
 45		 * @return true if further recursion down children is necessary, false if not.
 46		 */
 47		public function enterNode(node:NodeBase):Boolean
 48		{
 49			node = node;
 50			return true;
 51		}
 52		
 53		/**
 54		 * Passes a skybox to be processed by the traverser.
 55		 */
 56		public function applySkyBox(renderable:IRenderable):void
 57		{
 58			throw new AbstractMethodError();
 59		}
 60		
 61		/**
 62		 * Passes an IRenderable object to be processed by the traverser.
 63		 */
 64		public function applyRenderable(renderable:IRenderable):void
 65		{
 66			throw new AbstractMethodError();
 67		}
 68		
 69		/**
 70		 * Passes a light to be processed by the traverser.
 71		 */
 72		public function applyUnknownLight(light:LightBase):void
 73		{
 74			throw new AbstractMethodError();
 75		}
 76		
 77		public function applyDirectionalLight(light:DirectionalLight):void
 78		{
 79			throw new AbstractMethodError();
 80		}
 81		
 82		public function applyPointLight(light:PointLight):void
 83		{
 84			throw new AbstractMethodError();
 85		}
 86		
 87		public function applyLightProbe(light:LightProbe):void
 88		{
 89			throw new AbstractMethodError();
 90		}
 91		
 92		/**
 93		 * Registers an entity for use.
 94		 */
 95		public function applyEntity(entity:Entity):void
 96		{
 97			throw new AbstractMethodError();
 98		}
 99		
100		/**
101		 * The entry point for scene graph traversal, ie the point that will be used for traversing the graph
102		 * position-dependently. For example: BSP visibility determination or collision detection.
103		 * For the EntityCollector, this is the camera's scene position for example.
104		 */
105		public function get entryPoint():Vector3D
106		{
107			return _entryPoint;
108		}
109	}
110}