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

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

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

Geometry.removeFromParent介绍

暂无

代码示例

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

@Override
protected void onDisable() {
  getApplication().setAppProfiler(null);
  graph.removeFromParent();
  background.removeFromParent();
}

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

/**
 * Used to reset cubeField 
 */
private void gameReset(){
  Score = 0;
  lowCap = 10;
  colorInt = 0;
  highCap = 40;
  difficulty = highCap;
  for (Geometry cube : cubeField){
    cube.removeFromParent();
  }
  cubeField.clear();
  if (fcube != null){
    fcube.removeFromParent();
  }
  fcube = createFirstCube();
  obstacleColors.clear();
  obstacleColors.add(ColorRGBA.Orange);
  obstacleColors.add(ColorRGBA.Red);
  obstacleColors.add(ColorRGBA.Yellow);
  renderer.setBackgroundColor(ColorRGBA.White);
  speed = lowCap / 400f;
  coreTime = 20.0f;
  coreTime2 = 10.0f;
  diffHelp=lowCap;
  player.setLocalTranslation(0,0,0);
}

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

/**
 * Optimizes a scene by combining Geometry with the same material.
 * All Geometries found in the scene are detached from their parent and
 * a new Node containing the optimized Geometries is attached.
 * @param scene The scene to optimize
 * @param useLods true if you want the resulting geometry to keep lod information
 * @return The newly created optimized geometries attached to a node
 */
public static Node optimize(Node scene, boolean useLods) {
  ArrayList<Geometry> geoms = new ArrayList<Geometry>();
  gatherGeoms(scene, geoms);
  List<Geometry> batchedGeoms = makeBatches(geoms, useLods);
  for (Geometry geom : batchedGeoms) {
    scene.attachChild(geom);
  }
  for (Iterator<Geometry> it = geoms.iterator(); it.hasNext();) {
    Geometry geometry = it.next();
    geometry.removeFromParent();
  }
  // Since the scene is returned unaltered the transform must be reset
  scene.setLocalTransform(Transform.IDENTITY);
  return scene;
}

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

cubeField.get(i).removeFromParent();
cubeField.remove(cubeField.get(i));

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

if (needsFullRebatch) {
  for (Batch batch : batches.getArray()) {
    batch.geometry.removeFromParent();
      list.add(0, batch.geometry);
      batchName = batch.geometry.getName();
      batch.geometry.removeFromParent();
    } else {
      batch = new Batch();

代码示例来源:origin: jMonkeyEngine-Contributions/Lemur

@Override
public void update( float tpf ) {
  if( current != null ) {
    if( !current.isVisible() ) {
      current = null;
      blocker.removeFromParent();
    }
  }
}

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

@Override
protected void onDisable() {
  getApplication().setAppProfiler(null);
  graph.removeFromParent();
  background.removeFromParent();
}

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

private void updateRange(boolean show) {
  if (show) {
    if(rangeGeometry != null) {
      rangeGeometry.removeFromParent();
    }
    createRangeSphere();
    attachChild(rangeGeometry);
  } else {
    if(rangeGeometry != null) {
      rangeGeometry.removeFromParent();
    }
  }
}

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

/**
 * Used to reset cubeField 
 */
private void gameReset(){
  Score = 0;
  lowCap = 10;
  colorInt = 0;
  highCap = 40;
  difficulty = highCap;
  for (Geometry cube : cubeField){
    cube.removeFromParent();
  }
  cubeField.clear();
  if (fcube != null){
    fcube.removeFromParent();
  }
  fcube = createFirstCube();
  obstacleColors.clear();
  obstacleColors.add(ColorRGBA.Orange);
  obstacleColors.add(ColorRGBA.Red);
  obstacleColors.add(ColorRGBA.Yellow);
  renderer.setBackgroundColor(ColorRGBA.White);
  speed = lowCap / 400f;
  coreTime = 20.0f;
  coreTime2 = 10.0f;
  diffHelp=lowCap;
  player.setLocalTranslation(0,0,0);
}

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

/**
 * Optimizes a scene by combining Geometry with the same material.
 * All Geometries found in the scene are detached from their parent and
 * a new Node containing the optimized Geometries is attached.
 * @param scene The scene to optimize
 * @param useLods true if you want the resulting geometry to keep lod information
 * @return The newly created optimized geometries attached to a node
 */
public static Node optimize(Node scene, boolean useLods) {
  ArrayList<Geometry> geoms = new ArrayList<Geometry>();
  gatherGeoms(scene, geoms);
  List<Geometry> batchedGeoms = makeBatches(geoms, useLods);
  for (Geometry geom : batchedGeoms) {
    scene.attachChild(geom);
  }
  for (Iterator<Geometry> it = geoms.iterator(); it.hasNext();) {
    Geometry geometry = it.next();
    geometry.removeFromParent();
  }
  // Since the scene is returned unaltered the transform must be reset
  scene.setLocalTransform(Transform.IDENTITY);
  return scene;
}

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

/**
 * Optimizes a scene by combining Geometry with the same material.
 * All Geometries found in the scene are detached from their parent and
 * a new Node containing the optimized Geometries is attached.
 * @param scene The scene to optimize
 * @param useLods true if you want the resulting geometry to keep lod information
 * @return The newly created optimized geometries attached to a node
 */
public static Node optimize(Node scene, boolean useLods) {
  ArrayList<Geometry> geoms = new ArrayList<Geometry>();
  gatherGeoms(scene, geoms);
  List<Geometry> batchedGeoms = makeBatches(geoms, useLods);
  for (Geometry geom : batchedGeoms) {
    scene.attachChild(geom);
  }
  for (Iterator<Geometry> it = geoms.iterator(); it.hasNext();) {
    Geometry geometry = it.next();
    geometry.removeFromParent();
  }
  // Since the scene is returned unaltered the transform must be reset
  scene.setLocalTransform(Transform.IDENTITY);
  
  return scene;
}

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

@Override
protected void notifyListeners() {
  super.notifyListeners();
  if (debug) {
    switch (cState) {
      case ON:
        SpatialFactory.getRootNode().attachChild(getDebugGeo());
        break;
      case OFF:
        getDebugGeo().removeFromParent();
        break;
    }
  }
}

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

cubeField.get(i).removeFromParent();
cubeField.remove(cubeField.get(i));

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

if (needsFullRebatch) {
  for (Batch batch : batches.getArray()) {
    batch.geometry.removeFromParent();
      list.add(0, batch.geometry);
      batchName = batch.geometry.getName();
      batch.geometry.removeFromParent();
    } else {
      batch = new Batch();

代码示例来源:origin: jMonkeyEngine-Contributions/Lemur

public void release() {
    // Up to the effect to remove the popup... we'll do it if the
    // popup doesn't exist. 
    if( popup instanceof Panel && ((Panel)popup).hasEffect("close") ) {
      ((Panel)popup).runEffect("close");
      // Would be nice if there was a way to run something at the end 
      // of an effect just to be sure.
    } else {
      popup.removeFromParent();
    }
    blocker.removeFromParent();
    if( closeCommand != null ) {
      closeCommand.execute(PopupState.this);
    }
    
    // Release our cursor request
    GuiGlobals.getInstance().releaseCursorEnabled(this);
  }
}

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

if (needsFullRebatch) {
  for (Batch batch : batches.getArray()) {
    batch.geometry.removeFromParent();
      list.add(0, batch.geometry);
      batchName = batch.geometry.getName();
      batch.geometry.removeFromParent();
    } else {
      batch = new Batch();

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

private void fixScreen(Spatial device) {
  List<Spatial> screens = SpatialUtils.getSpatialsByRole(device, "Screen");
    if (screens.size() > 0) {
      Geometry geo = (Geometry) screens.get(0);
      Node p = geo.getParent();
      geo.removeFromParent();
      geo = new Geometry("Screen", new Quad(1f, 0.6f));
      geo.setUserData("ID", "Screen1");
      geo.setUserData("ROLE", "Screen");
      Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      mat.setTexture("ColorMap", assetManager.loadTexture("Textures/FrontSmartPhone.jpg"));
      geo.setMaterial(mat);
      geo.move(-1.4f, 0f, -0.6f);
      geo.rotate(-FastMath.HALF_PI, 0f, 0f);
      geo.setLocalScale(Vector3f.UNIT_XYZ.divide(p.getWorldScale()));
      p.attachChild(geo);
      setState(State.Success);
      return;
    }
}

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

@Override
public void runCommand(Application app) {
  DevicesAppState devicesAppState = app.getStateManager().getState(DevicesAppState.class);
  Node device = devicesAppState.getDevice(deviceId);
  if (device != null) {
    List<Spatial> screens = SpatialUtils.getSpatialsByRole(device, "Screen");
    if (screens.size() > 0) {
      Geometry geo = (Geometry) screens.get(0);
      Node p = geo.getParent();
      geo.removeFromParent();
      geo = new Geometry("Screen", new Quad(1f, 0.6f));
      geo.setUserData("ID", "Screen1");
      geo.setUserData("ROLE", "Screen");
      Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      mat.setTexture("ColorMap", assetManager.loadTexture(imagePath));
      geo.setMaterial(mat);
      geo.move(-1.4f, 0f, -0.6f);
      geo.rotate(-FastMath.HALF_PI, 0f, 0f);
      geo.setLocalScale(Vector3f.UNIT_XYZ.divide(p.getWorldScale()));
      p.attachChild(geo);
      setState(State.Success);
      return;
    }
  }
  setState(State.Fail);
}

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

public void setSkeletonWireVisible(boolean skeletonWireVisible) {
  if (skeletonWireVisible) {
    if (skeletonWireGeom == null) {
      SkeletonWire skeletonWire = new SkeletonWire(skeleton);
      skeletonWireGeom = new Geometry("skeletonWire", skeletonWire);
      Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      mat.setColor("Color", ColorRGBA.Green);
      mat.getAdditionalRenderState().setDepthTest(false);
      mat.getAdditionalRenderState().setDepthWrite(false);
      skeletonWireGeom.setMaterial(mat);
      skeletonWireGeom.setQueueBucket(Bucket.Transparent);
      attachChild(skeletonWireGeom);
      skeletonWire.updateGeometry();
    }
  } else {
    if (skeletonWireGeom != null) {
      skeletonWireGeom.removeFromParent();
      skeletonWireGeom = null;
    }
  }
  this.skeletonWireVisible = skeletonWireVisible;
}

相关文章