示例#1
0
  /**
   * Visit each scene graph element ordered by BFS
   *
   * @param visitor
   */
  public void breadthFirstTraversal(SceneGraphVisitor visitor) {
    Queue<Spatial> queue = new LinkedList<Spatial>();
    queue.add(this);

    while (!queue.isEmpty()) {
      Spatial s = queue.poll();
      visitor.visit(s);
      s.breadthFirstTraversal(visitor, queue);
    }
  }
 public void accept(SceneGraphVisitor v) {
   v.visit(this);
 }