159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta/*
259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * Copyright (c) 2009-2010 jMonkeyEngine
359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * All rights reserved.
459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta *
559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * Redistribution and use in source and binary forms, with or without
659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * modification, are permitted provided that the following conditions are
759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * met:
859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta *
959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * * Redistributions of source code must retain the above copyright
1059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta *   notice, this list of conditions and the following disclaimer.
1159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta *
1259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * * Redistributions in binary form must reproduce the above copyright
1359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta *   notice, this list of conditions and the following disclaimer in the
1459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta *   documentation and/or other materials provided with the distribution.
1559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta *
1659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
1759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta *   may be used to endorse or promote products derived from this software
1859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta *   without specific prior written permission.
1959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta *
2059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
2459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
2859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
2959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta */
3259b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartapackage jme3test.light;
3359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
3459b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.app.SimpleApplication;
3559b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.bounding.BoundingBox;
3659b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.font.BitmapText;
3759b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.light.AmbientLight;
3859b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.light.PointLight;
3959b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.light.SpotLight;
4059b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.material.Material;
4159b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.math.ColorRGBA;
4259b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.math.FastMath;
4359b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.math.Quaternion;
4459b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.math.Vector3f;
4559b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.scene.Geometry;
4659b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.scene.Spatial;
4759b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.terrain.geomipmap.TerrainLodControl;
4859b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.terrain.geomipmap.TerrainQuad;
4959b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator;
5059b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.terrain.heightmap.AbstractHeightMap;
5159b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.terrain.heightmap.ImageBasedHeightMap;
5259b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.texture.Texture;
5359b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.texture.Texture.WrapMode;
5459b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport com.jme3.util.SkyFactory;
5559b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartaimport jme3tools.converters.ImageToAwt;
5659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
5759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta/**
5859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * Uses the terrain's lighting texture with normal maps and lights.
5959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta *
6059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta * @author bowens
6159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta */
6259b2e6871c65f58fdad78cd7229c292f6a177578Scott Bartapublic class TestSpotLightTerrain extends SimpleApplication {
6359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
6459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    private TerrainQuad terrain;
6559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    Material matTerrain;
6659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    Material matWire;
6759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    boolean wireframe = false;
6859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    boolean triPlanar = false;
6959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    boolean wardiso = false;
7059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    boolean minnaert = false;
7159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    protected BitmapText hintText;
7259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    PointLight pl;
7359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    Geometry lightMdl;
7459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    private float grassScale = 64;
7559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    private float dirtScale = 16;
7659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    private float rockScale = 128;
7759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    SpotLight sl;
7859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
7959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    public static void main(String[] args) {
8059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        TestSpotLightTerrain app = new TestSpotLightTerrain();
8159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        app.start();
8259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    }
8359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
8459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
8559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    @Override
8659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    public void simpleInitApp() {
8759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        makeTerrain();
8859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        flyCam.setMoveSpeed(50);
8959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
9059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        sl = new SpotLight();
9159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        sl.setSpotRange(100);
9259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        sl.setSpotOuterAngle(20 * FastMath.DEG_TO_RAD);
9359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        sl.setSpotInnerAngle(15 * FastMath.DEG_TO_RAD);
9459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        sl.setDirection(new Vector3f(-0.39820394f, -0.73094344f, 0.55421597f));
9559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        sl.setPosition(new Vector3f(-64.61567f, -87.615425f, -202.41328f));
9659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        rootNode.addLight(sl);
9759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
9859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        AmbientLight ambLight = new AmbientLight();
9959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        ambLight.setColor(new ColorRGBA(0.8f, 0.8f, 0.8f, 0.2f));
10059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        rootNode.addLight(ambLight);
10159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
10259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        cam.setLocation(new Vector3f(-41.219646f, -84.8363f, -171.67267f));
10359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        cam.setRotation(new Quaternion(-0.04562731f, 0.89917684f, -0.09668826f, -0.4243236f));
10459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        sl.setDirection(cam.getDirection());
10559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        sl.setPosition(cam.getLocation());
10659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
10759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    }
10859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
10959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta      @Override
11059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    public void simpleUpdate(float tpf) {
11159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        super.simpleUpdate(tpf);
11259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        sl.setDirection(cam.getDirection());
11359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        sl.setPosition(cam.getLocation());
11459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
11559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    }
11659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
11759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    private void makeTerrain() {
11859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        // TERRAIN TEXTURE material
11959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
12059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setBoolean("useTriPlanarMapping", false);
12159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setBoolean("WardIso", true);
12259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
12359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        // ALPHA map (for splat textures)
12459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alpha1.png"));
12559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setTexture("AlphaMap_1", assetManager.loadTexture("Textures/Terrain/splat/alpha2.png"));
12659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
12759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        // HEIGHTMAP image (for the terrain heightmap)
12859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture heightMapImage = assetManager.loadTexture("Textures/Terrain/splat/mountains512.png");
12959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
13059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
13159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        // GRASS texture
13259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
13359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        grass.setWrap(WrapMode.Repeat);
13459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setTexture("DiffuseMap", grass);
13559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setFloat("DiffuseMap_0_scale", grassScale);
13659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
13759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        // DIRT texture
13859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
13959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        dirt.setWrap(WrapMode.Repeat);
14059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setTexture("DiffuseMap_1", dirt);
14159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setFloat("DiffuseMap_1_scale", dirtScale);
14259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
14359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        // ROCK texture
14459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture rock = assetManager.loadTexture("Textures/Terrain/splat/road.jpg");
14559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        rock.setWrap(WrapMode.Repeat);
14659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setTexture("DiffuseMap_2", rock);
14759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setFloat("DiffuseMap_2_scale", rockScale);
14859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
14959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        // BRICK texture
15059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture brick = assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall.jpg");
15159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        brick.setWrap(WrapMode.Repeat);
15259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setTexture("DiffuseMap_3", brick);
15359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setFloat("DiffuseMap_3_scale", rockScale);
15459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
15559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        // RIVER ROCK texture
15659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture riverRock = assetManager.loadTexture("Textures/Terrain/Pond/Pond.jpg");
15759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        riverRock.setWrap(WrapMode.Repeat);
15859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setTexture("DiffuseMap_4", riverRock);
15959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setFloat("DiffuseMap_4_scale", rockScale);
16059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
16159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
16259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture normalMap0 = assetManager.loadTexture("Textures/Terrain/splat/grass_normal.jpg");
16359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        normalMap0.setWrap(WrapMode.Repeat);
16459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture normalMap1 = assetManager.loadTexture("Textures/Terrain/splat/dirt_normal.png");
16559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        normalMap1.setWrap(WrapMode.Repeat);
16659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture normalMap2 = assetManager.loadTexture("Textures/Terrain/splat/road_normal.png");
16759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        normalMap2.setWrap(WrapMode.Repeat);
16859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setTexture("NormalMap", normalMap0);
16959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setTexture("NormalMap_1", normalMap2);
17059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setTexture("NormalMap_2", normalMap2);
17159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matTerrain.setTexture("NormalMap_4", normalMap2);
17259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
17359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        // WIREFRAME material
17459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
17559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matWire.getAdditionalRenderState().setWireframe(true);
17659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        matWire.setColor("Color", ColorRGBA.Green);
17759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
17859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        createSky();
17959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
18059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        // CREATE HEIGHTMAP
18159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        AbstractHeightMap heightmap = null;
18259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        try {
18359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta            //heightmap = new HillHeightMap(1025, 1000, 50, 100, (byte) 3);
18459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
18559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta            heightmap = new ImageBasedHeightMap(heightMapImage.getImage(), 1f);
18659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta            heightmap.load();
18759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
18859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        } catch (Exception e) {
18959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta            e.printStackTrace();
19059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        }
19159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
19259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());//, new LodPerspectiveCalculatorFactory(getCamera(), 4)); // add this in to see it use entropy for LOD calculations
19359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        TerrainLodControl control = new TerrainLodControl(terrain, getCamera());
19459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        control.setLodCalculator( new DistanceLodCalculator(65, 2.7f) );
19559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        terrain.addControl(control);
19659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        terrain.setMaterial(matTerrain);
19759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        terrain.setModelBound(new BoundingBox());
19859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        terrain.updateModelBound();
19959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        terrain.setLocalTranslation(0, -100, 0);
20059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        terrain.setLocalScale(1f, 1f, 1f);
20159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        rootNode.attachChild(terrain);
20259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    }
20359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
20459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    private void createSky() {
20559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");
20659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg");
20759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");
20859b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");
20959b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");
21059b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");
21159b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
21259b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
21359b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta        rootNode.attachChild(sky);
21459b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta    }
21559b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
21659b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta
21759b2e6871c65f58fdad78cd7229c292f6a177578Scott Barta}
218