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

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

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

Spatial.checkCulling介绍

[英]checkCulling checks the spatial with the camera to see if it should be culled.

This method is called by the renderer. Usually it should not be called directly.
[中]checkCulling用相机检查空间,看是否应该剔除。
此方法由渲染器调用。通常不应该直接调用它。

代码示例

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

@Override
public boolean checkCulling(Camera cam) {
  if (isGrouped()) {
    setLastFrustumIntersection(Camera.FrustumIntersect.Outside);
    return false;
  }
  return super.checkCulling(cam);
}

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

private static void validateSubScene(Spatial scene) {
  scene.checkCulling(DUMMY_CAM);
  Set<MatParamOverride> actualOverrides = new HashSet<MatParamOverride>();
  for (MatParamOverride override : scene.getWorldMatParamOverrides()) {
    actualOverrides.add(override);
  }
  Set<MatParamOverride> expectedOverrides = new HashSet<MatParamOverride>();
  Spatial current = scene;
  while (current != null) {
    for (MatParamOverride override : current.getLocalMatParamOverrides()) {
      expectedOverrides.add(override);
    }
    current = current.getParent();
  }
  assertEquals("For " + scene, expectedOverrides, actualOverrides);
}

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

private void renderSubScene(Spatial scene, ViewPort vp) {
  // check culling first.
  if (!scene.checkCulling(vp.getCamera())) {
    return;
  }
  scene.runControlRender(this, vp);
  if (scene instanceof Node) {
    // Recurse for all children
    Node n = (Node) scene;
    List<Spatial> children = n.getChildren();
    // Saving cam state for culling
    int camState = vp.getCamera().getPlaneState();
    for (int i = 0; i < children.size(); i++) {
      // Restoring cam state before proceeding children recursively
      vp.getCamera().setPlaneState(camState);
      renderSubScene(children.get(i), vp);
    }
  } else if (scene instanceof Geometry) {
    // add to the render queue
    Geometry gm = (Geometry) scene;
    if (gm.getMaterial() == null) {
      throw new IllegalStateException("No material is set for Geometry: " + gm.getName());
    }
    vp.getQueue().addToQueue(gm, scene.getQueueBucket());
  }
}

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

int planeState = camera.getPlaneState();
camera.setPlaneState(0);
inFrustum = camera.contains(scene.getWorldBound()) != Camera.FrustumIntersect.Outside && scene.checkCulling(vpCamera);
camera.setPlaneState(planeState);

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

@Override
public boolean checkCulling(Camera cam) {
  if (isGrouped()) {
    setLastFrustumIntersection(Camera.FrustumIntersect.Outside);
    return false;
  }
  return super.checkCulling(cam);
}

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

private void renderSubScene(Spatial scene, ViewPort vp) {
  // check culling first.
  if (!scene.checkCulling(vp.getCamera())) {
    return;
  }
  scene.runControlRender(this, vp);
  if (scene instanceof Node) {
    // Recurse for all children
    Node n = (Node) scene;
    List<Spatial> children = n.getChildren();
    // Saving cam state for culling
    int camState = vp.getCamera().getPlaneState();
    for (int i = 0; i < children.size(); i++) {
      // Restoring cam state before proceeding children recursively
      vp.getCamera().setPlaneState(camState);
      renderSubScene(children.get(i), vp);
    }
  } else if (scene instanceof Geometry) {
    // add to the render queue
    Geometry gm = (Geometry) scene;
    if (gm.getMaterial() == null) {
      throw new IllegalStateException("No material is set for Geometry: " + gm.getName());
    }
    vp.getQueue().addToQueue(gm, scene.getQueueBucket());
  }
}

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

int planeState = camera.getPlaneState();
camera.setPlaneState(0);
inFrustum = camera.contains(scene.getWorldBound()) != Camera.FrustumIntersect.Outside && scene.checkCulling(vpCamera);
camera.setPlaneState(planeState);

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

if (!scene.checkCulling(vp.getCamera())) {

相关文章

Spatial类方法