com.jme3.scene.Spatial.updateWorldBound()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中com.jme3.scene.Spatial.updateWorldBound()方法的一些代码示例,展示了Spatial.updateWorldBound()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spatial.updateWorldBound()方法的具体详情如下:
包路径:com.jme3.scene.Spatial
类名称:Spatial
方法名:updateWorldBound

Spatial.updateWorldBound介绍

[英]Should be overridden by Node and Geometry.
[中]应被节点和几何图形覆盖。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

updateWorldBound();

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Computes this Spatial's world bounding volume in the most efficient
 * manner possible.
 */
void checkDoBoundUpdate() {
  if ((refreshFlags & RF_BOUND) == 0) {
    return;
  }
  checkDoTransformUpdate();
  // Go to children recursively and update their bound
  if (this instanceof Node) {
    Node node = (Node) this;
    int len = node.getQuantity();
    for (int i = 0; i < len; i++) {
      Spatial child = node.getChild(i);
      child.checkDoBoundUpdate();
    }
  }
  // All children's bounds have been updated. Update my own now.
  updateWorldBound();
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * <code>updateWorldBound</code> updates the bounding volume that contains
 * this geometry. The location of the geometry is based on the location of
 * all this node's parents.
 *
 * @see Spatial#updateWorldBound()
 */
@Override
protected void updateWorldBound() {
  super.updateWorldBound();
  if (mesh == null) {
    throw new NullPointerException("Geometry: " + getName() + " has null mesh");
  }
  if (mesh.getBound() != null) {
    if (ignoreTransform) {
      // we do not transform the model bound by the world transform,
      // just use the model bound as-is
      worldBound = mesh.getBound().clone(worldBound);
    } else {
      worldBound = mesh.getBound().transform(worldTransform, worldBound);
    }
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
protected void updateWorldBound(){
  super.updateWorldBound();
  // for a node, the world bound is a combination of all its children
  // bounds
  BoundingVolume resultBound = null;
  for (Spatial child : children.getArray()) {
    // child bound is assumed to be updated
    assert (child.refreshFlags & RF_BOUND) == 0;
    if (resultBound != null) {
      // merge current world bound with child world bound
      resultBound.mergeLocal(child.getWorldBound());
    } else {
      // set world bound to first non-null child world bound
      if (child.getWorldBound() != null) {
        resultBound = child.getWorldBound().clone(this.worldBound);
      }
    }
  }
  if (resultBound == null) {
    resultBound = new BoundingBox(getWorldTranslation(), 0f, 0f, 0f);
  }
  this.worldBound = resultBound;
}

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * <code>updateGeometricState</code> updates the lightlist,
 * computes the world transforms, and computes the world bounds
 * for this Spatial.
 * Calling this when the Spatial is attached to a node
 * will cause undefined results. User code should only call this
 * method on Spatials having no parent.
 * 
 * @see Spatial#getWorldLightList()
 * @see Spatial#getWorldTransform()
 * @see Spatial#getWorldBound()
 */
public void updateGeometricState() {
  // assume that this Spatial is a leaf, a proper implementation
  // for this method should be provided by Node.
  // NOTE: Update world transforms first because
  // bound transform depends on them.
  if ((refreshFlags & RF_LIGHTLIST) != 0) {
    updateWorldLightList();
  }
  if ((refreshFlags & RF_TRANSFORM) != 0) {
    updateWorldTransforms();
  }
  if ((refreshFlags & RF_BOUND) != 0) {
    updateWorldBound();
  }
  assert refreshFlags == 0;
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

updateWorldBound();

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * Computes this Spatial's world bounding volume in the most efficient
 * manner possible.
 */
void checkDoBoundUpdate() {
  if ((refreshFlags & RF_BOUND) == 0) {
    return;
  }
  checkDoTransformUpdate();
  // Go to children recursively and update their bound
  if (this instanceof Node) {
    Node node = (Node) this;
    int len = node.getQuantity();
    for (int i = 0; i < len; i++) {
      Spatial child = node.getChild(i);
      child.checkDoBoundUpdate();
    }
  }
  // All children's bounds have been updated. Update my own now.
  updateWorldBound();
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * Computes this Spatial's world bounding volume in the most efficient
 * manner possible.
 */
void checkDoBoundUpdate() {
  if ((refreshFlags & RF_BOUND) == 0) {
    return;
  }
  checkDoTransformUpdate();
  // Go to children recursively and update their bound
  if (this instanceof Node) {
    Node node = (Node) this;
    int len = node.getQuantity();
    for (int i = 0; i < len; i++) {
      Spatial child = node.getChild(i);
      child.checkDoBoundUpdate();
    }
  }
  // All children's bounds have been updated. Update my own now.
  updateWorldBound();
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * <code>updateWorldBound</code> updates the bounding volume that contains
 * this geometry. The location of the geometry is based on the location of
 * all this node's parents.
 *
 * @see Spatial#updateWorldBound()
 */
@Override
protected void updateWorldBound() {
  super.updateWorldBound();
  if (mesh == null) {
    throw new NullPointerException("Geometry: " + getName() + " has null mesh");
  }
  if (mesh.getBound() != null) {
    if (ignoreTransform) {
      // we do not transform the model bound by the world transform,
      // just use the model bound as-is
      worldBound = mesh.getBound().clone(worldBound);
    } else {
      worldBound = mesh.getBound().transform(worldTransform, worldBound);
    }
  }
}

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * <code>updateWorldBound</code> updates the bounding volume that contains
 * this geometry. The location of the geometry is based on the location of
 * all this node's parents.
 *
 * @see Spatial#updateWorldBound()
 */
@Override
protected void updateWorldBound() {
  super.updateWorldBound();
  if (mesh == null) {
    throw new NullPointerException("Geometry: " + getName() + " has null mesh");
  }
  if (mesh.getBound() != null) {
    if (ignoreTransform) {
      // we do not transform the model bound by the world transform,
      // just use the model bound as-is
      worldBound = mesh.getBound().clone(worldBound);
    } else {
      worldBound = mesh.getBound().transform(worldTransform, worldBound);
    }
  }
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

@Override
protected void updateWorldBound(){
  super.updateWorldBound();
  // for a node, the world bound is a combination of all its children
  // bounds
  BoundingVolume resultBound = null;
  for (Spatial child : children.getArray()) {
    // child bound is assumed to be updated
    assert (child.refreshFlags & RF_BOUND) == 0;
    if (resultBound != null) {
      // merge current world bound with child world bound
      resultBound.mergeLocal(child.getWorldBound());
    } else {
      // set world bound to first non-null child world bound
      if (child.getWorldBound() != null) {
        resultBound = child.getWorldBound().clone(this.worldBound);
      }
    }
  }
  this.worldBound = resultBound;
}

代码示例来源:origin: info.projectkyoto/mms-engine

@Override
protected void updateWorldBound(){
  super.updateWorldBound();
  
  // for a node, the world bound is a combination of all it's children
  // bounds
  BoundingVolume resultBound = null;
  for (Spatial child : children.getArray()) {
    // child bound is assumed to be updated
    assert (child.refreshFlags & RF_BOUND) == 0;
    if (resultBound != null) {
      // merge current world bound with child world bound
      resultBound.mergeLocal(child.getWorldBound());
    } else {
      // set world bound to first non-null child world bound
      if (child.getWorldBound() != null) {
        resultBound = child.getWorldBound().clone(this.worldBound);
      }
    }
  }
  this.worldBound = resultBound;
}

相关文章

Spatial类方法