@Override protected void onDisable() { getApplication().setAppProfiler(null); graph.removeFromParent(); background.removeFromParent(); }
/** * 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); }
/** * 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; }
cubeField.get(i).removeFromParent(); cubeField.remove(cubeField.get(i));
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();
@Override public void update( float tpf ) { if( current != null ) { if( !current.isVisible() ) { current = null; blocker.removeFromParent(); } } }
@Override protected void onDisable() { getApplication().setAppProfiler(null); graph.removeFromParent(); background.removeFromParent(); }
private void updateRange(boolean show) { if (show) { if(rangeGeometry != null) { rangeGeometry.removeFromParent(); } createRangeSphere(); attachChild(rangeGeometry); } else { if(rangeGeometry != null) { rangeGeometry.removeFromParent(); } } }
/** * 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); }
/** * 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; }
/** * 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; }
@Override protected void notifyListeners() { super.notifyListeners(); if (debug) { switch (cState) { case ON: SpatialFactory.getRootNode().attachChild(getDebugGeo()); break; case OFF: getDebugGeo().removeFromParent(); break; } } }
cubeField.get(i).removeFromParent(); cubeField.remove(cubeField.get(i));
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();
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); } }
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();
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; } }
@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); }
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; }