当前位置: 首页>>代码示例>>Java>>正文


Java TreeCallback.treeCallback方法代码示例

本文整理汇总了Java中org.jbox2d.callbacks.TreeCallback.treeCallback方法的典型用法代码示例。如果您正苦于以下问题:Java TreeCallback.treeCallback方法的具体用法?Java TreeCallback.treeCallback怎么用?Java TreeCallback.treeCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jbox2d.callbacks.TreeCallback的用法示例。


在下文中一共展示了TreeCallback.treeCallback方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: query

import org.jbox2d.callbacks.TreeCallback; //导入方法依赖的package包/类
@Override
public final void query(TreeCallback callback, AABB aabb) {
  nodeStack.reset();
  nodeStack.push(m_root);

  while (nodeStack.getCount() > 0) {
    DynamicTreeNode node = nodeStack.pop();
    if (node == null) {
      continue;
    }

    if (AABB.testOverlap(node.aabb, aabb)) {
      if (node.child1 == null) {
        boolean proceed = callback.treeCallback(node.id);
        if (!proceed) {
          return;
        }
      } else {
        nodeStack.push(node.child1);
        nodeStack.push(node.child2);
      }
    }
  }
}
 
开发者ID:pianoman373,项目名称:Point-Engine,代码行数:25,代码来源:DynamicTree.java

示例2: query

import org.jbox2d.callbacks.TreeCallback; //导入方法依赖的package包/类
/**
 * Query an AABB for overlapping proxies. The callback class is called for each proxy that
 * overlaps the supplied AABB.
 * 
 * @param callback
 * @param araabbgAABB
 */
public final void query(TreeCallback callback, AABB aabb) {
  intStack.reset();
  intStack.push(m_root);

  while (intStack.getCount() > 0) {
    int nodeId = intStack.pop();
    if (nodeId == DynamicTreeNode.NULL_NODE) {
      continue;
    }

    final DynamicTreeNode node = m_nodes[nodeId];

    if (AABB.testOverlap(node.aabb, aabb)) {
      if (node.isLeaf()) {
        boolean proceed = callback.treeCallback(node);
        if (!proceed) {
          return;
        }
      } else {
        intStack.push(node.child1);
        intStack.push(node.child2);
      }
    }
  }
}
 
开发者ID:col726,项目名称:game-engine-CMZ,代码行数:33,代码来源:DynamicTree.java

示例3: query

import org.jbox2d.callbacks.TreeCallback; //导入方法依赖的package包/类
@Override
public final void query(TreeCallback callback, AABB aabb) {
  nodeStackIndex = 0;
  nodeStack[nodeStackIndex++] = m_root;

  while (nodeStackIndex > 0) {
    int node = nodeStack[--nodeStackIndex];
    if (node == NULL_NODE) {
      continue;
    }

    if (AABB.testOverlap(m_aabb[node], aabb)) {
      int child1 = m_child1[node];
      if (child1 == NULL_NODE) {
        boolean proceed = callback.treeCallback(node);
        if (!proceed) {
          return;
        }
      } else {
        if (nodeStack.length - nodeStackIndex - 2 <= 0) {
          nodeStack =
              BufferUtils.reallocateBuffer(nodeStack, nodeStack.length, nodeStack.length * 2);
        }
        nodeStack[nodeStackIndex++] = child1;
        nodeStack[nodeStackIndex++] = m_child2[node];
      }
    }
  }
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:30,代码来源:DynamicTreeFlatNodes.java

示例4: query

import org.jbox2d.callbacks.TreeCallback; //导入方法依赖的package包/类
@Override
public final void query(TreeCallback callback, AABB aabb) {
  assert(aabb.isValid());
  nodeStackIndex = 0;
  nodeStack[nodeStackIndex++] = m_root;

  while (nodeStackIndex > 0) {
    DynamicTreeNode node = nodeStack[--nodeStackIndex];
    if (node == null) {
      continue;
    }

    if (AABB.testOverlap(node.aabb, aabb)) {
      if (node.child1 == null) {
        boolean proceed = callback.treeCallback(node.id);
        if (!proceed) {
          return;
        }
      } else {
        if (nodeStack.length - nodeStackIndex - 2 <= 0) {
          DynamicTreeNode[] newBuffer = new DynamicTreeNode[nodeStack.length * 2];
          System.arraycopy(nodeStack, 0, newBuffer, 0, nodeStack.length);
          nodeStack = newBuffer;
        }
        nodeStack[nodeStackIndex++] = node.child1;
        nodeStack[nodeStackIndex++] = node.child2;
      }
    }
  }
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:31,代码来源:DynamicTree.java


注:本文中的org.jbox2d.callbacks.TreeCallback.treeCallback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。