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

x33g5p2x  于2022-01-20 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(96)

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

Geometry.getModelBound介绍

暂无

代码示例

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

/**
 * This method returns the bounding box of the given geometries.
 * 
 * @param geometries
 *            the list of geometries
 * @return bounding box of the given geometries
 */
public static BoundingBox getBoundingBox(Geometry... geometries) {
  BoundingBox result = null;
  for (Geometry geometry : geometries) {
    geometry.updateModelBound();
    BoundingVolume bv = geometry.getModelBound();
    if (bv instanceof BoundingBox) {
      return (BoundingBox) bv;
    } else if (bv instanceof BoundingSphere) {
      BoundingSphere bs = (BoundingSphere) bv;
      float r = bs.getRadius();
      return new BoundingBox(bs.getCenter(), r, r, r);
    } else {
      throw new IllegalStateException("Unknown bounding volume type: " + bv.getClass().getName());
    }
  }
  return result;
}

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

/**
 * This method returns the bounding sphere of the given geometries.
 * 
 * @param geometries
 *            the list of geometries
 * @return bounding sphere of the given geometries
 */
/* package */static BoundingSphere getBoundingSphere(Geometry... geometries) {
  BoundingSphere result = null;
  for (Geometry geometry : geometries) {
    geometry.updateModelBound();
    BoundingVolume bv = geometry.getModelBound();
    if (bv instanceof BoundingBox) {
      BoundingBox bb = (BoundingBox) bv;
      float r = Math.max(bb.getXExtent(), bb.getYExtent());
      r = Math.max(r, bb.getZExtent());
      return new BoundingSphere(r, bb.getCenter());
    } else if (bv instanceof BoundingSphere) {
      return (BoundingSphere) bv;
    } else {
      throw new IllegalStateException("Unknown bounding volume type: " + bv.getClass().getName());
    }
  }
  return result;
}

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

carNode.setShadowMode(ShadowMode.Cast);
Geometry chasis = findGeom(carNode, "Car");
BoundingBox box = (BoundingBox) chasis.getModelBound();
box = (BoundingBox) wheel_fr.getModelBound();
wheelRadius = box.getYExtent();
float back_wheel_h = (wheelRadius * 1.7f) - 1f;
box = (BoundingBox) wheel_fl.getModelBound();
player.addWheel(wheel_fl.getParent(), box.getCenter().add(0, -front_wheel_h, 0),
    wheelDirection, wheelAxle, 0.2f, wheelRadius, true);
box = (BoundingBox) wheel_br.getModelBound();
player.addWheel(wheel_br.getParent(), box.getCenter().add(0, -back_wheel_h, 0),
    wheelDirection, wheelAxle, 0.2f, wheelRadius, false);
box = (BoundingBox) wheel_bl.getModelBound();
player.addWheel(wheel_bl.getParent(), box.getCenter().add(0, -back_wheel_h, 0),
    wheelDirection, wheelAxle, 0.2f, wheelRadius, false);

代码示例来源:origin: net.sf.phat/phat-server

@Override
protected void createCameras() {
  flyCam.setMoveSpeed(1f);
  flyCam.setDragToRotate(true);// to prevent mouse capture
  //flyCam.setEnabled(false);
  cam.setFrustumPerspective(45f, (float) cam.getWidth() / cam.getHeight(), 0.01f, 1000f);
  Vector3f center = screenQR.getModelBound().getCenter();
  center.multLocal(qrSize);
  screenLoc = screenQR.getWorldTranslation().add(center);
  
  initialPos();
}

代码示例来源:origin: net.sf.phat/phat-devices

@Override
protected void createCameras() {
  flyCam.setMoveSpeed(1f);
  flyCam.setDragToRotate(true);// to prevent mouse capture
  //flyCam.setEnabled(false);
  cam.setFrustumPerspective(45f, (float) cam.getWidth() / cam.getHeight(), 0.01f, 1000f);
  
  Vector3f center = screen.getModelBound().getCenter();
  center.multLocal(qrSize);
  screenLoc = screen.getWorldTranslation().add(center);
  
  initialPos();
}

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

if (geometry.getModelBound() == null)

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

public static void convertToFixed(Geometry geom, Format posFmt, Format nmFmt, Format tcFmt){
  geom.updateModelBound();
  BoundingBox bbox = (BoundingBox) geom.getModelBound();
  Mesh mesh = geom.getMesh();

相关文章