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

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

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

Spatial.setCullHint介绍

[英]setCullHint alters how view frustum culling will treat this spatial.
[中]setCullHint改变了视锥剔除将如何处理此空间。

代码示例

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

public void displayNonDeformingJoint(boolean display) {
  joints.getChild(0).setCullHint(display ? CullHint.Dynamic : CullHint.Always);
  outlines.getChild(0).setCullHint(display ? CullHint.Dynamic : CullHint.Always);
  wires.getChild(0).setCullHint(display ? CullHint.Dynamic : CullHint.Always);
  ((Node) outlines.getChild(1)).getChild(0).setCullHint(display ? CullHint.Dynamic : CullHint.Always);
  ((Node) wires.getChild(1)).getChild(0).setCullHint(display ? CullHint.Dynamic : CullHint.Always);
}

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

@Override
  public void done(LightProbe result) {
    System.err.println("Done rendering env maps");
    tex = EnvMapUtils.getCubeMapCrossDebugViewWithMipMaps(result.getPrefilteredEnvMap(), assetManager);
    rootNode.getChild(0).setCullHint(Spatial.CullHint.Dynamic);
  }
});

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

public void readScenes(JsonPrimitive defaultScene, Node rootNode) throws IOException {
  if (scenes == null) {
    //no scene... lets handle this later...
    throw new AssetLoadException("Gltf files with no scene is not yet supported");
  }
  for (JsonElement scene : scenes) {
    Node sceneNode = new Node();
    //specs says that only the default scene should be rendered,
    // if there are several scenes, they are attached to the rootScene, but they are culled
    sceneNode.setCullHint(Spatial.CullHint.Always);
    sceneNode.setName(getAsString(scene.getAsJsonObject(), "name"));
    JsonArray sceneNodes = scene.getAsJsonObject().getAsJsonArray("nodes");
    sceneNode = customContentManager.readExtensionAndExtras("scene", scene, sceneNode);
    rootNode.attachChild(sceneNode);
    for (JsonElement node : sceneNodes) {
      readChild(sceneNode, node);
    }
  }
  //Setting the default scene cul hint to inherit.
  int activeChild = 0;
  if (defaultScene != null) {
    activeChild = defaultScene.getAsInt();
  }
  rootNode.getChild(activeChild).setCullHint(Spatial.CullHint.Inherit);
}

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

spatial.setCullHint(CullHint.Always);

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

rootNode.getChild(i).setCullHint(Spatial.CullHint.Always);
  this.scaleAsParent(percent, playerPos, distVect);
  currentActiveChild.scaleAsChild(percent, distVect);
} else if (currentActiveChild != null && currentActiveChild.getPositionInParent().equals(vector3f)) {
  rootNode.getChild(i).setCullHint(Spatial.CullHint.Inherit);

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

Spatial sky = SkyFactory.createSky(assetManager, "Textures/Sky/Path.hdr", SkyFactory.EnvMapType.EquirectMap);
rootNode.attachChild(sky);
rootNode.getChild(0).setCullHint(Spatial.CullHint.Always);

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

sky.setCullHint(Spatial.CullHint.Never);
rootNode.attachChild(sky);

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

"Textures/Sky/Bright/FullskiesBlueClear03.dds",
    EnvMapType.CubeMap);
sky.setCullHint(Spatial.CullHint.Never);
rootNode.attachChild(sky);

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

"Textures/Sky/Bright/FullskiesBlueClear03.dds", 
    EnvMapType.CubeMap);
sky.setCullHint(Spatial.CullHint.Never);
rootNode.attachChild(sky);

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

"Textures/Sky/Bright/FullskiesBlueClear03.dds",
        EnvMapType.CubeMap);
sky.setCullHint(Spatial.CullHint.Never);
rootNode.attachChild(sky);

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

@Override
public void setSpatial(Spatial spatial) {
  super.setSpatial(spatial);
  spatial.setCullHint(Spatial.CullHint.Always);
}

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

@Override
protected void controlUpdate(float tpf) {
  AudioNode audioNode = (AudioNode) spatial.getParent();
  if(audioNode.getStatus() == AudioSource.Status.Playing && spatial.getCullHint() == Spatial.CullHint.Always) {
    spatial.setCullHint(Spatial.CullHint.Dynamic);
  } else if(audioNode.getStatus() == AudioSource.Status.Stopped && spatial.getCullHint() == Spatial.CullHint.Dynamic) {
    spatial.setCullHint(Spatial.CullHint.Always);
  }
}

代码示例来源:origin: tonihele/OpenKeeper

private static Spatial loadModel(AssetManager assetManager, String resourceName, Node creatureRoot) {
  // Load the model and attach it without the root
  Spatial model = AssetUtils.loadModel(assetManager, resourceName);
  model = ((Node) model).getChild(0);
  model.setCullHint(Spatial.CullHint.Always);
  creatureRoot.attachChild(model);
  return model;
}

代码示例来源:origin: tonihele/OpenKeeper

private static void hideAllNodes(Node root) {
  UnitFlowerControl aufc = root.getControl(UnitFlowerControl.class);
  for (Spatial child : root.getChildren()) {
    // Don't hide the unit flower
    if (Boolean.FALSE.equals(child.getUserData(AssetUtils.USER_DATA_KEY_REMOVABLE))) {
      continue;
    }
    child.setCullHint(Spatial.CullHint.Always);
    // Also stop any animations
    AnimControl animControl = (AnimControl) child.getControl(AnimControl.class);
    if (animControl != null) {
      animControl.setEnabled(false);
    }
  }
}

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

protected Spatial getDebugShape() {
  Spatial spatial = DebugShapeFactory.getDebugShape(collisionShape);
  if (spatial == null) {
    return new Node("nullnode");
  }
  if (spatial instanceof Node) {
    List<Spatial> children = ((Node) spatial).getChildren();
    for (Iterator<Spatial> it1 = children.iterator(); it1.hasNext();) {
      Spatial spatial1 = it1.next();
      Geometry geom = ((Geometry) spatial1);
      geom.setMaterial(debugMaterialBlue);
      geom.setCullHint(Spatial.CullHint.Never);
    }
  } else {
    Geometry geom = ((Geometry) spatial);
    geom.setMaterial(debugMaterialBlue);
    geom.setCullHint(Spatial.CullHint.Never);
  }
  spatial.setCullHint(Spatial.CullHint.Never);
  return spatial;
}

代码示例来源:origin: tonihele/OpenKeeper

@Override
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
  // Start the real animation
  Spatial spat = root.getChild(resource.getName());
  AnimControl animControl = spat.getControl(AnimControl.class);
  spat.setCullHint(Spatial.CullHint.Inherit);
  AnimChannel c = animControl.getChannel(0);
  LoopMode loopMode = c.getLoopMode();
  c.setAnim(ANIM_NAME, 0);
  if (loopMode != null) {
    c.setLoopMode(loopMode);
  }
  animControl.setEnabled(true);
  // Hide us
  control.setEnabled(false);
  control.getSpatial().setCullHint(Spatial.CullHint.Always);
}

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

public void readScenes(JsonPrimitive defaultScene, Node rootNode) throws IOException {
  if (scenes == null) {
    //no scene... lets handle this later...
    throw new AssetLoadException("Gltf files with no scene is not yet supported");
  }
  for (JsonElement scene : scenes) {
    Node sceneNode = new Node();
    //specs says that only the default scene should be rendered,
    // if there are several scenes, they are attached to the rootScene, but they are culled
    sceneNode.setCullHint(Spatial.CullHint.Always);
    sceneNode.setName(getAsString(scene.getAsJsonObject(), "name"));
    JsonArray sceneNodes = scene.getAsJsonObject().getAsJsonArray("nodes");
    sceneNode = customContentManager.readExtensionAndExtras("scene", scene, sceneNode);
    rootNode.attachChild(sceneNode);
    for (JsonElement node : sceneNodes) {
      readChild(sceneNode, node);
    }
  }
  //Setting the default scene cul hint to inherit.
  int activeChild = 0;
  if (defaultScene != null) {
    activeChild = defaultScene.getAsInt();
  }
  rootNode.getChild(activeChild).setCullHint(Spatial.CullHint.Inherit);
}

代码示例来源:origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport-jmonkey

sky.setCullHint(CullHint.Never);

代码示例来源:origin: tonihele/OpenKeeper

@Override
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
  cyclesCount++;
  // Signal that the main animation cycle is done
  animationControl.onAnimationCycleDone();
  // See if we need to stop
  if (animationControl.isStopAnimation() || channel.getLoopMode() == LoopMode.DontLoop) {
    // Stop us
    control.setEnabled(false);
    // We need to stop
    if (resource.getFlags().contains(ArtResource.ArtResourceFlag.HAS_END_ANIMATION)) {
      // Hide us
      control.getSpatial().setCullHint(Spatial.CullHint.Always);
      Spatial spat = root.getChild(END_ANIMATION_NAME);
      AnimControl animControl = spat.getControl(AnimControl.class);
      spat.setCullHint(Spatial.CullHint.Inherit);
      AnimChannel c = animControl.getChannel(0);
      LoopMode loopMode = c.getLoopMode();
      c.setAnim(ANIM_NAME, 0);
      if (loopMode != null) {
        c.setLoopMode(loopMode);
      }
      animControl.setEnabled(true);
    } else {
      // Signal stop
      animationControl.onAnimationStop();
    }
  }
}

代码示例来源:origin: tonihele/OpenKeeper

spat.setCullHint(Spatial.CullHint.Inherit);
if (animControl != null) { // Not all are anims
  AnimChannel channel = animControl.getChannel(0);

相关文章

Spatial类方法