Package com.jmex.terrain.util

Examples of com.jmex.terrain.util.ProceduralTextureGenerator


    private void assignTexture(TerrainBlock tb, ImageBasedHeightMap heightMap)
    {
        @SuppressWarnings("unused")
        float[] hm = tb.getHeightMap();
        // generate a terrain texture with 2 textures
        ProceduralTextureGenerator pt = new ProceduralTextureGenerator(heightMap);
        pt.addTexture(new ImageIcon(getClass().getClassLoader().getResource(
            "data/water.jpg")), 0, 60, 100);
        pt.addTexture(new ImageIcon(getClass().getClassLoader().getResource(
            "jmetest/data/texture/dirt.jpg")), 60, 100, 200);
        pt.addTexture(new ImageIcon(getClass().getClassLoader().getResource(
            "jmetest/data/texture/highest.jpg")), 100, 200, 380);

        pt.createTexture(512);

        // assign the texture to the terrain
        TextureState ts1 = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();

        ts1.setEnabled(true);

        Texture t1 = TextureManager.loadTexture(pt.getImageIcon().getImage(),MinificationFilter.NearestNeighborLinearMipMap,MagnificationFilter.NearestNeighbor,
                       
                        ts1.getMaxAnisotropic(), true);

        Texture t2 = TextureManager.loadTexture(new ImageIcon(
                getClass().getClassLoader().getResource(
View Full Code Here


        //tb.setLocalTranslation(new Vector3f(-20, -60, -20));
        tb.setModelBound(new BoundingBox());
        tb.updateModelBound();

        // generate a terrain texture with 2 textures
        ProceduralTextureGenerator pt = new ProceduralTextureGenerator(
                heightMap);
        pt.addTexture(new ImageIcon(TestTerrain.class.getClassLoader()
                .getResource("jmetest/data/texture/grassb.png")), -128, 0, 128);
        pt.addTexture(new ImageIcon(TestTerrain.class.getClassLoader()
                .getResource("jmetest/data/texture/dirt.jpg")), 0, 128, 255);
        pt.addTexture(new ImageIcon(TestTerrain.class.getClassLoader()
                .getResource("jmetest/data/texture/highest.jpg")), 128, 255,
                384);
        pt.createTexture(32);
       
        // assign the texture to the terrain
        TextureState ts = display.getRenderer().createTextureState();
        Texture t1 = TextureManager.loadTexture(pt.getImageIcon().getImage(),
                Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR, true);
        ts.setTexture(t1, 0);
       
        //load a detail texture and set the combine modes for the two terrain textures.
        Texture t2 = TextureManager.loadTexture(
View Full Code Here

        //tb.setLocalTranslation(new Vector3f(-20, -60, -20));
        tb.setModelBound(new BoundingBox());
        tb.updateModelBound();

        // generate a terrain texture with 2 textures
        ProceduralTextureGenerator pt = new ProceduralTextureGenerator(
                heightMap);
        pt.addTexture(new ImageIcon(TankApplet.class.getClassLoader()
                .getResource("jmetest/data/texture/grassb.png")), -128, 0, 128);
        pt.addTexture(new ImageIcon(TankApplet.class.getClassLoader()
                .getResource("jmetest/data/texture/dirt.jpg")), 0, 128, 255);
        pt.addTexture(new ImageIcon(TankApplet.class.getClassLoader()
                .getResource("jmetest/data/texture/highest.jpg")), 128, 255,
                384);
        pt.createTexture(32);
       
        // assign the texture to the terrain
        TextureState ts = getRenderer().createTextureState();
        Texture t1 = TextureManager.loadTexture(pt.getImageIcon().getImage(),
                Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR, true);
        ts.setTexture(t1, 0);
       
        //load a detail texture and set the combine modes for the two terrain textures.
        Texture t2 = TextureManager.loadTexture(
View Full Code Here

TOP

Related Classes of com.jmex.terrain.util.ProceduralTextureGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.