/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

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