Java Code Examples for com.jme3.terrain.geomipmap.TerrainQuad#setLocalScale()

The following examples show how to use com.jme3.terrain.geomipmap.TerrainQuad#setLocalScale() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TerrainTestTile.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
TiledTerrain() {
    // TERRAIN TEXTURE material
    matTerrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
    matTerrain.setBoolean("useTriPlanarMapping", false);
    matTerrain.setBoolean("WardIso", true);
    matTerrain.setFloat("Shininess", 0);

    // GRASS texture
    Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
    grass.setWrap(WrapMode.Repeat);
    matTerrain.setTexture("DiffuseMap", grass);
    matTerrain.setFloat("DiffuseMap_0_scale", grassScale);

    // CREATE THE TERRAIN
    terrain1 = new TerrainQuad("terrain 1", 65, 513, null);
    terrain1.setMaterial(matTerrain);
    terrain1.setLocalTranslation(-256, -100, -256);
    terrain1.setLocalScale(1f, 1f, 1f);
    this.attachChild(terrain1);

    terrain2 = new TerrainQuad("terrain 2", 65, 513, null);
    terrain2.setMaterial(matTerrain);
    terrain2.setLocalTranslation(-256, -100, 256);
    terrain2.setLocalScale(1f, 1f, 1f);
    this.attachChild(terrain2);

    terrain3 = new TerrainQuad("terrain 3", 65, 513, null);
    terrain3.setMaterial(matTerrain);
    terrain3.setLocalTranslation(256, -100, -256);
    terrain3.setLocalScale(1f, 1f, 1f);
    this.attachChild(terrain3);

    terrain4 = new TerrainQuad("terrain 4", 65, 513, null);
    terrain4.setMaterial(matTerrain);
    terrain4.setLocalTranslation(256, -100, 256);
    terrain4.setLocalScale(1f, 1f, 1f);
    this.attachChild(terrain4);
    
    terrain1.setNeighbourFinder(this);
    terrain2.setNeighbourFinder(this);
    terrain3.setNeighbourFinder(this);
    terrain4.setNeighbourFinder(this);
    
    MultiTerrainLodControl lodControl = new MultiTerrainLodControl(getCamera());
    lodControl.setLodCalculator( new DistanceLodCalculator(65, 2.7f) ); // patch size, and a multiplier
    lodControl.addTerrain(terrain1);
    lodControl.addTerrain(terrain2);
    lodControl.addTerrain(terrain3);// order of these seems to matter
    lodControl.addTerrain(terrain4);
    this.addControl(lodControl);
    
}
 
Example 2
Source File: TerrainTestTile.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
TiledTerrain() {
    // TERRAIN TEXTURE material
    matTerrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
    matTerrain.setBoolean("useTriPlanarMapping", false);
    matTerrain.setBoolean("WardIso", true);
    matTerrain.setFloat("Shininess", 0);

    // GRASS texture
    Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
    grass.setWrap(WrapMode.Repeat);
    matTerrain.setTexture("DiffuseMap", grass);
    matTerrain.setFloat("DiffuseMap_0_scale", grassScale);

    // CREATE THE TERRAIN
    terrain1 = new TerrainQuad("terrain 1", 65, 513, null);
    terrain1.setMaterial(matTerrain);
    terrain1.setLocalTranslation(-256, -100, -256);
    terrain1.setLocalScale(1f, 1f, 1f);
    this.attachChild(terrain1);

    terrain2 = new TerrainQuad("terrain 2", 65, 513, null);
    terrain2.setMaterial(matTerrain);
    terrain2.setLocalTranslation(-256, -100, 256);
    terrain2.setLocalScale(1f, 1f, 1f);
    this.attachChild(terrain2);

    terrain3 = new TerrainQuad("terrain 3", 65, 513, null);
    terrain3.setMaterial(matTerrain);
    terrain3.setLocalTranslation(256, -100, -256);
    terrain3.setLocalScale(1f, 1f, 1f);
    this.attachChild(terrain3);

    terrain4 = new TerrainQuad("terrain 4", 65, 513, null);
    terrain4.setMaterial(matTerrain);
    terrain4.setLocalTranslation(256, -100, 256);
    terrain4.setLocalScale(1f, 1f, 1f);
    this.attachChild(terrain4);
    
    terrain1.setNeighbourFinder(this);
    terrain2.setNeighbourFinder(this);
    terrain3.setNeighbourFinder(this);
    terrain4.setNeighbourFinder(this);
    
    MultiTerrainLodControl lodControl = new MultiTerrainLodControl(getCamera());
    lodControl.setLodCalculator( new DistanceLodCalculator(65, 2.7f) ); // patch size, and a multiplier
    lodControl.addTerrain(terrain1);
    lodControl.addTerrain(terrain2);
    lodControl.addTerrain(terrain3);// order of these seems to matter
    lodControl.addTerrain(terrain4);
    this.addControl(lodControl);
    
}