PageRenderTime 41ms CodeModel.GetById 20ms app.highlight 3ms RepoModel.GetById 17ms app.codeStats 0ms

/src/away3d/core/partition/MeshNode.as

http://github.com/away3d/away3d-core-fp11
ActionScript | 48 lines | 30 code | 5 blank | 13 comment | 2 complexity | a5823d1c908cf1f334780d4a9c847d0b MD5 | raw file
 1package away3d.core.partition
 2{
 3	import away3d.core.base.SubMesh;
 4	import away3d.core.traverse.PartitionTraverser;
 5	import away3d.entities.Mesh;
 6	
 7	/**
 8	 * MeshNode is a space partitioning leaf node that contains a Mesh object.
 9	 */
10	public class MeshNode extends EntityNode
11	{
12		private var _mesh:Mesh;
13		
14		/**
15		 * Creates a new MeshNode object.
16		 * @param mesh The mesh to be contained in the node.
17		 */
18		public function MeshNode(mesh:Mesh)
19		{
20			super(mesh);
21			_mesh = mesh; // also keep a stronger typed reference
22		}
23		
24		/**
25		 * The mesh object contained in the partition node.
26		 */
27		public function get mesh():Mesh
28		{
29			return _mesh;
30		}
31		
32		/**
33		 * @inheritDoc
34		 */
35		override public function acceptTraverser(traverser:PartitionTraverser):void
36		{
37			if (traverser.enterNode(this)) {
38				super.acceptTraverser(traverser);
39				var subs:Vector.<SubMesh> = _mesh.subMeshes;
40				var i:uint;
41				var len:uint = subs.length;
42				while (i < len)
43					traverser.applyRenderable(subs[i++]);
44			}
45		}
46	
47	}
48}