PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/src/away3d/animators/data/AnimationStateBase.as

http://github.com/away3d/away3d-core-fp11
ActionScript | 80 lines | 45 code | 10 blank | 25 comment | 0 complexity | be3d1c50f576667507e2a2863e411276 MD5 | raw file
 1package away3d.animators.data
 2{
 3	import away3d.arcane;
 4	import away3d.core.base.IRenderable;
 5	import away3d.core.managers.Stage3DProxy;
 6	import away3d.entities.Mesh;
 7	import away3d.errors.AbstractMethodError;
 8	import away3d.materials.passes.MaterialPassBase;
 9
10	import flash.display3D.Context3D;
11
12	/**
13	 * AnimationStateBase provides an abstract base class for all animation states. This defines the actual state of the
14	 * animation data (such as the matrices to be used for skinning) for an entire Mesh. The AnimationController is the
15	 * class that inputs the values.
16	 */
17	public class AnimationStateBase
18	{
19		protected var _animation : AnimationBase;
20		protected var _stateInvalid : Boolean;
21
22		protected var _owners : Vector.<Mesh>;
23
24		/**
25		 * Creates a new AnimationStateBase object
26		 * @param animation The animation on which this AnimationStateBase object is based.
27		 */
28		public function AnimationStateBase(animation : AnimationBase)
29		{
30			_owners = new Vector.<Mesh>();
31			_animation = animation;
32		}
33
34		/**
35		 * Invalidates the state, so it needs to be updated next time it is requested.
36		 */
37		public function invalidateState() : void
38		{
39			_stateInvalid = true;
40		}
41
42		/**
43		 * The animation on which this AnimationStateBase object is based.
44		 */
45		public function get animation() : AnimationBase
46		{
47			return _animation;
48		}
49
50		/**
51		 * Sets the GPU render state required by the animation that is dependent of the rendered object.
52		 * @param context The context which is currently performing the rendering.
53		 * @param pass The material pass which is currently used to render the geometry.
54		 * @param renderable The object currently being rendered.
55		 */
56		public function setRenderState(stage3DProxy : Stage3DProxy, pass : MaterialPassBase, renderable : IRenderable) : void
57		{
58			throw new AbstractMethodError();
59		}
60
61		/**
62		 * Clones the current object.
63		 * @return An exact duplicate of the current object.
64		 */
65		public function clone() : AnimationStateBase
66		{
67			throw new AbstractMethodError();
68		}
69
70		arcane function addOwner(mesh : Mesh) : void
71		{
72			_owners.push(mesh);
73		}
74
75		arcane function removeOwner(mesh : Mesh) : void
76		{
77			_owners.splice(_owners.indexOf(mesh), 1);
78		}
79	}
80}