-1

I am trying to do terrain generation in jMonkeyEnging, and have followed the tutorial (http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_terrain) but have run into a slight problem. At last chunck of code in the simpleInitApp method (the Level Of Detail), I am getting the errors:

1. Cannot Find Symbol: class list
2. Cannot Find Symbol: class camera
3. Cannot Find Symbol: class arrayList

when I delete the Level Of Detail coding, I get the error when running:

1. SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
    at mygame.Main.simpleInitApp(Main.java:35)
        at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:231)
    at         com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:129)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)
    at java.lang.Thread.run(Thread.java:722)

What am I doing wrong, that's not in the tutorial(or my code, below)

    package mygame;

    import com.jme3.app.SimpleApplication;
    import com.jme3.material.Material;
    import com.jme3.terrain.geomipmap.TerrainLodControl;
    import com.jme3.terrain.heightmap.AbstractHeightMap;
    import com.jme3.terrain.geomipmap.TerrainQuad;
    import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator;
    import com.jme3.terrain.heightmap.HillHeightMap; // for exercise 2
    import com.jme3.terrain.heightmap.ImageBasedHeightMap;
    import com.jme3.texture.Texture;
    import com.jme3.texture.Texture.WrapMode;
    import jme3tools.converters.ImageToAwt;

    /**
     * test
     * @author Me
     */
    public class Main extends SimpleApplication {

        public static void main(String[] args) {
            Main app = new Main();
            app.start();
        }

        private TerrainQuad terrain;
        Material mat_terrain;

        @Override
        public void simpleInitApp() {
            flyCam.setMoveSpeed(50);

            //add grass to the mat_terrain
            Texture grass = assetManager.loadTexture("Textures/grass.jpg");
            mat_terrain.setTexture("tex1", grass);
            mat_terrain.setFloat("tex1Scale", 64f);

            //add dirt to the mat_terrain
            Texture dirt = assetManager.loadTexture("Textures/dirt.jpg");
            mat_terrain.setTexture("tex2", dirt);
            mat_terrain.setFloat("tex2Scale", 32f);

            //add roads to the mat_terrain
            Texture road = assetManager.loadTexture("Textures/road.jpg");
            mat_terrain.setTexture("tex2", road);
            mat_terrain.setFloat("tex3Scale", 128f);

            //deal with the generation
            AbstractHeightMap heightMap = null;
            HillHeightMap heightmap = null;
            try {
                heightmap = new HillHeightMap(513, 1000, 50, 100, (byte) 3);
            } catch (Exception ex) {
                ex.printStackTrace();
            }

            //create the world
            int patchSize = 65;
            terrain = new TerrainQuad("my terrain", patchSize, 513,                    heightmap.getHeightMap());

            //material, position, scale

            terrain.setMaterial(mat_terrain);
            terrain.setLocalTranslation(0, -100, 0);
            terrain.setLocalScale(2f, 1f, 2f);
            rootNode.attachChild(terrain);

            //LOD
            List<Camera> cameras = new ArrayList<Camera>();
            cameras.add(getCamera());
            TerrainLodControl control = new TerrainLodControl(terrain, cameras);
            terrain.addControl(control);
        }
    }
JAW1025
  • 676
  • 2
  • 8
  • 17

1 Answers1

0

You need to import Camera (from the jME3 render package) as well as List and ArrayList (from java.util).

You'd also be better off posting any jME related questions to the forum at http://jmonkeyengine.org/forum

sbook
  • 841
  • 1
  • 8
  • 13