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

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

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

Spatial.setTransformRefresh介绍

[英]Indicate that the transform of this spatial has changed and that a refresh is required.
[中]指示此空间的变换已更改,需要刷新。

代码示例

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

@Override
protected void setTransformRefresh(){
  super.setTransformRefresh();
  for (Spatial child : children.getArray()){
    if ((child.refreshFlags & RF_TRANSFORM) != 0)
      continue;
    child.setTransformRefresh();
  }
}

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

/**
 * <code>setLocalTranslation</code> sets the local translation of this
 * spatial.
 *
 * @param localTranslation
 *            the local translation of this spatial.
 */
public void setLocalTranslation(Vector3f localTranslation) {
  this.localTransform.setTranslation(localTranslation);
  setTransformRefresh();
}

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

/**
 * <code>setLocalTransform</code> sets the local transform of this
 * spatial.
 */
public void setLocalTransform(Transform t) {
  this.localTransform.set(t);
  setTransformRefresh();
}

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

/**
 * <code>setLocalScale</code> sets the local scale of this node.
 */
public void setLocalScale(float x, float y, float z) {
  localTransform.setScale(x, y, z);
  setTransformRefresh();
}

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

/**
 * <code>setLocalRotation</code> sets the local rotation of this node.
 *
 * @param quaternion
 *            the new local rotation.
 */
public void setLocalRotation(Quaternion quaternion) {
  localTransform.setRotation(quaternion);
  setTransformRefresh();
}

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

/**
 * <code>setLocalScale</code> sets the local scale of this node.
 *
 * @param localScale
 *            the new local scale, applied to x, y and z
 */
public void setLocalScale(float localScale) {
  localTransform.setScale(localScale);
  setTransformRefresh();
}

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

/**
 * <code>setLocalScale</code> sets the local scale of this node.
 *
 * @param localScale
 *            the new local scale.
 */
public void setLocalScale(Vector3f localScale) {
  localTransform.setScale(localScale);
  setTransformRefresh();
}

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

/**
 * <code>setLocalTranslation</code> sets the local translation of this
 * spatial.
 */
public void setLocalTranslation(float x, float y, float z) {
  this.localTransform.setTranslation(x, y, z);
  setTransformRefresh();
}

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

/**
 * Translates the spatial by the given translation vector.
 *
 * @return The spatial on which this method is called, e.g <code>this</code>.
 */
public Spatial move(Vector3f offset) {
  this.localTransform.getTranslation().addLocal(offset);
  setTransformRefresh();
  return this;
}

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

/**
 * <code>setLocalRotation</code> sets the local rotation of this node
 * by using a {@link Matrix3f}.
 *
 * @param rotation
 *            the new local rotation.
 */
public void setLocalRotation(Matrix3f rotation) {
  localTransform.getRotation().fromRotationMatrix(rotation);
  setTransformRefresh();
}

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

/**
 * Translates the spatial by the given translation vector.
 *
 * @return The spatial on which this method is called, e.g <code>this</code>.
 */
public Spatial move(float x, float y, float z) {
  this.localTransform.getTranslation().addLocal(x, y, z);
  setTransformRefresh();
  return this;
}

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

/**
 * Scales the spatial by the given scale vector.
 *
 * @return The spatial on which this method is called, e.g <code>this</code>.
 */
public Spatial scale(float x, float y, float z) {
  this.localTransform.getScale().multLocal(x, y, z);
  setTransformRefresh();
  return this;
}

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

/**
 * Rotates the spatial by the given rotation.
 *
 * @return The spatial on which this method is called, e.g <code>this</code>.
 */
public Spatial rotate(Quaternion rot) {
  this.localTransform.getRotation().multLocal(rot);
  setTransformRefresh();
  return this;
}

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

/**
 * (Internal use only) Forces a refresh of the given types of data.
 *
 * @param transforms Refresh world transform based on parents'
 * @param bounds Refresh bounding volume data based on child nodes
 * @param lights Refresh light list based on parents'
 */
public void forceRefresh(boolean transforms, boolean bounds, boolean lights) {
  if (transforms) {
    setTransformRefresh();
  }
  if (bounds) {
    setBoundRefresh();
  }
  if (lights) {
    setLightListRefresh();
  }
}

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

/**
 * @return Similar to Spatial.clone() except will create a deep clone of all
 * geometries' meshes. Normally this method shouldn't be used. Instead, use
 * Spatial.clone()
 *
 * @see Spatial#clone()
 */
public Spatial deepClone() {
  // Setup the cloner for the type of cloning we want to do.
  Cloner cloner = new Cloner();
  // First, we definitely do not want to clone our own parent
  cloner.setClonedValue(parent, null);
  Spatial clone = cloner.clone(this);
  // Because we've nulled the parent out we need to make sure
  // the transforms and stuff get refreshed.
  clone.setTransformRefresh();
  clone.setLightListRefresh();
  clone.setMatParamOverrideRefresh();
  return clone;
}

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

/**
 *
 * <code>detachChildAt</code> removes a child at a given index. That child
 * is returned for saving purposes.
 *
 * @param index
 *            the index of the child to be removed.
 * @return the child at the supplied index.
 */
public Spatial detachChildAt(int index) {
  Spatial child =  children.remove(index);
  if ( child != null ) {
    child.setParent( null );
    logger.log(Level.FINE, "{0}: Child removed.", this.toString());
    // since a child with a bound was detached;
    // our own bound will probably change.
    setBoundRefresh();
    // our world transform no longer influences the child.
    // XXX: Not necessary? Since child will have transform updated
    // when attached anyway.
    child.setTransformRefresh();
    // lights are also inherited from parent
    child.setLightListRefresh();
    child.setMatParamOverrideRefresh();
    
    invalidateUpdateList();
  }
  return child;
}

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

child.setTransformRefresh();
child.setLightListRefresh();
child.setMatParamOverrideRefresh();

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

clone.setTransformRefresh();
clone.setLightListRefresh();
clone.setMatParamOverrideRefresh();

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

/**
 * <code>rotateUpTo</code> is a utility function that alters the
 * local rotation to point the Y axis in the direction given by newUp.
 *
 * @param newUp
 *            the up vector to use - assumed to be a unit vector.
 */
public void rotateUpTo(Vector3f newUp) {
  TempVars vars = TempVars.get();
  Vector3f compVecA = vars.vect1;
  Quaternion q = vars.quat1;
  // First figure out the current up vector.
  Vector3f upY = compVecA.set(Vector3f.UNIT_Y);
  Quaternion rot = localTransform.getRotation();
  rot.multLocal(upY);
  // get angle between vectors
  float angle = upY.angleBetween(newUp);
  // figure out rotation axis by taking cross product
  Vector3f rotAxis = upY.crossLocal(newUp).normalizeLocal();
  // Build a rotation quat and apply current local rotation.
  q.fromAngleNormalAxis(angle, rotAxis);
  q.mult(rot, rot);
  vars.release();
  setTransformRefresh();
}

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

setTransformRefresh();

相关文章

微信公众号

最新文章

更多

Spatial类方法