/** * Runs on the rendering thread * @param shifted quads are still attached to the parent and don't need to re-load */ protected void attachQuadAt(TerrainQuad q, int quadrant, Vector3f quadCell, boolean shifted) { q.setQuadrant((short) quadrant); if (!shifted) this.attachChild(q); Vector3f loc = quadCell.mult(this.quadSize - 1).subtract(quarterSize, 0, quarterSize);// quadrant location handled TerrainQuad automatically now q.setLocalTranslation(loc); if (!shifted) { for (TerrainGridListener l : listeners) { l.tileAttached(quadCell, q); } } updateModelBound(); }
split, stepScale, heightBlock1, totalSize, tempOffset, offsetAmount); quad1.setLocalTranslation(origin1); quad1.quadrant = 1; this.attachChild(quad1); split, stepScale, heightBlock2, totalSize, tempOffset, offsetAmount); quad2.setLocalTranslation(origin2); quad2.quadrant = 2; this.attachChild(quad2); split, stepScale, heightBlock3, totalSize, tempOffset, offsetAmount); quad3.setLocalTranslation(origin3); quad3.quadrant = 3; this.attachChild(quad3); split, stepScale, heightBlock4, totalSize, tempOffset, offsetAmount); quad4.setLocalTranslation(origin4); quad4.quadrant = 4; this.attachChild(quad4);
terrain1.setLocalTranslation(-256, -100, -256); terrain1.setLocalScale(1f, 1f, 1f); this.attachChild(terrain1); terrain2.setLocalTranslation(-256, -100, 256); terrain2.setLocalScale(1f, 1f, 1f); this.attachChild(terrain2); terrain3.setLocalTranslation(256, -100, -256); terrain3.setLocalScale(1f, 1f, 1f); this.attachChild(terrain3); terrain4.setLocalTranslation(256, -100, 256); terrain4.setLocalScale(1f, 1f, 1f); this.attachChild(terrain4);
terrain.setMaterial(matRock); terrain.setLocalScale(new Vector3f(5, 5, 5)); terrain.setLocalTranslation(new Vector3f(0, -30, 0)); terrain.setLocked(false); // unlock it so we can edit the height
terrain.setMaterial(matRock); terrain.setLocalScale(new Vector3f(5, 5, 5)); terrain.setLocalTranslation(new Vector3f(0, -30, 0)); terrain.setLocked(false); // unlock it so we can edit the height
terrain.setMaterial(matRock); terrain.setLocalScale(new Vector3f(5, 5, 5)); terrain.setLocalTranslation(new Vector3f(0, -30, 0)); terrain.setLocked(false); // unlock it so we can edit the height
terrain.setMaterial(matRock); terrain.setLocalScale(new Vector3f(5, 5, 5)); terrain.setLocalTranslation(new Vector3f(0, -30, 0)); terrain.setLocked(false); // unlock it so we can edit the height
terrain.addControl(control); terrain.setMaterial(matTerrain); terrain.setLocalTranslation(0, -100, 0); terrain.setLocalScale(2.5f, 0.5f, 2.5f); rootNode.attachChild(terrain);
terrainQuad.addControl(control); terrainQuad.setMaterial(matTerrain); terrainQuad.setLocalTranslation(0, -100, 0); terrainQuad.setLocalScale(4f, 0.25f, 4f); rootNode.attachChild(terrainQuad);
terrain.setLocalTranslation(0, -100, 0); terrain.setLocalScale(2f, 1f, 2f); rootNode.attachChild(terrain);
terrain.addControl(control); terrain.setMaterial(matRock); terrain.setLocalTranslation(0, -100, 0); terrain.setLocalScale(2f, 0.5f, 2f); rootNode.attachChild(terrain);
terrain.addControl(control); terrain.setMaterial(matRock); terrain.setLocalTranslation(0, -100, 0); terrain.setLocalScale(8f, 0.5f, 8f); rootNode.attachChild(terrain);
terrain.setLocalTranslation(0, -100, 0); terrain.setLocalScale(2f, 1f, 2f); rootNode.attachChild(terrain);
terrain.setModelBound(new BoundingBox()); terrain.updateModelBound(); terrain.setLocalTranslation(0, -100, 0); terrain.setLocalScale(1f, 1f, 1f); rootNode.attachChild(terrain);
terrain.setLocalTranslation(0, 0, 0); terrain.setLocalScale(2f, 1f, 2f);
terrain.setModelBound(new BoundingBox()); terrain.updateModelBound(); terrain.setLocalTranslation(0, -100, 0); terrain.setLocalScale(1f, 1f, 1f); rootNode.attachChild(terrain);
/** * Runs on the rendering thread * @param shifted quads are still attached to the parent and don't need to re-load */ protected void attachQuadAt(TerrainQuad q, int quadrant, Vector3f quadCell, boolean shifted) { q.setQuadrant((short) quadrant); if (!shifted) this.attachChild(q); Vector3f loc = quadCell.mult(this.quadSize - 1).subtract(quarterSize, 0, quarterSize);// quadrant location handled TerrainQuad automatically now q.setLocalTranslation(loc); if (!shifted) { for (TerrainGridListener l : listeners) { l.tileAttached(quadCell, q); } } updateModelBound(); }
public void randomizeHeightMap() { if(terrain != null) { try { HillHeightMap heightmap = new HillHeightMap(513, 2000, 25, 100, (long)((byte)100 * Math.random())); Material mat = terrain.getMaterial(); Vector3f scale = terrain.getLocalScale(); Vector3f trans = terrain.getLocalTranslation(); rootNode.detachChildNamed("Terrain"); terrain = new TerrainQuad("Terrain", 65, 513, heightmap.getHeightMap()); terrain.setLocalTranslation(trans); terrain.setLocalScale(scale); terrain.setMaterial(mat); terrain.setShadowMode(ShadowMode.Receive); rootNode.attachChild(terrain); } catch(Exception ex) { ex.printStackTrace(); } } }
split, stepScale, heightBlock1, totalSize, tempOffset, offsetAmount); quad1.setLocalTranslation(origin1); quad1.quadrant = 1; this.attachChild(quad1); split, stepScale, heightBlock2, totalSize, tempOffset, offsetAmount); quad2.setLocalTranslation(origin2); quad2.quadrant = 2; this.attachChild(quad2); split, stepScale, heightBlock3, totalSize, tempOffset, offsetAmount); quad3.setLocalTranslation(origin3); quad3.quadrant = 3; this.attachChild(quad3); split, stepScale, heightBlock4, totalSize, tempOffset, offsetAmount); quad4.setLocalTranslation(origin4); quad4.quadrant = 4; this.attachChild(quad4);
public void setStaticGeometry(Node staticNode) { this.staticNode = staticNode; // Add SKY direct to Root Spatial sky = staticNode.getChild("Skymap"); if(sky != null) { sky.removeFromParent(); this.rootNode.attachChild(sky); } // Add TERRAIN direct to Root Spatial terra = staticNode.getChild("Terrain"); if(terra != null) { terra.removeFromParent(); // ShadowMode mode = terra.getShadowMode(); terrain = (TerrainQuad)terra; terrain.setLocalTranslation(appScaled / 2, 0, appScaled / 2); this.rootNode.attachChild(terrain); /** 5. The LOD (level of detail) depends on were the camera is: */ TerrainLodControl control = new TerrainLodControl(terrain, cam); terrain.addControl(control); terrain.setShadowMode(ShadowMode.Receive); } GeometryBatchFactory.optimize(this.staticNode, true); this.rootNode.attachChild(this.staticNode); }