/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

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