@Override
  public void simpleInitApp() {
    viewPort.setBackgroundColor(ColorRGBA.White);
    flyCam.setMoveSpeed(50);

    /** A simple textured sphere */
    Sphere sphereMesh = new Sphere(16, 16, 1);
    Geometry sphereGeo = new Geometry("lit textured sphere", sphereMesh);
    Material sphereMat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    sphereMat.setTexture("DiffuseMap", assetManager.loadTexture("Interface/Monkey.png"));
    sphereMat.setBoolean("UseMaterialColors", true);
    sphereMat.setColor("Diffuse", ColorRGBA.Gray);
    sphereMat.setColor("Ambient", ColorRGBA.Gray);
    // alpha test start
    sphereMat.getAdditionalRenderState().setAlphaTest(true);
    sphereMat.getAdditionalRenderState().setAlphaFallOff(.5f);
    sphereGeo.setQueueBucket(Bucket.Transparent);
    // alpha test end
    sphereGeo.setMaterial(sphereMat);
    sphereGeo.move(-2f, 0f, 0f);
    sphereGeo.rotate(FastMath.DEG_TO_RAD * -90, FastMath.DEG_TO_RAD * 120, 0f);
    rootNode.attachChild(sphereGeo);

    /**
     * This material turns the box into a stained glass window. The texture has an alpha channel and
     * is partially transparent.
     */
    Box windowMesh = new Box(new Vector3f(0f, 0f, 0f), 1f, 1.4f, 0.01f);
    Geometry windowGeo = new Geometry("stained glass window", windowMesh);
    Material windowMat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    windowMat.setTexture("DiffuseMap", assetManager.loadTexture("Textures/mucha-window.png"));
    windowMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
    windowGeo.setMaterial(windowMat);
    windowGeo.setQueueBucket(Bucket.Transparent);
    windowGeo.setMaterial(windowMat);
    windowGeo.move(1, 0, 0);
    rootNode.attachChild(windowGeo);

    /**
     * A box with its material color "bleeding" through. The texture has an alpha channel and is
     * partially transparent.
     */
    Cylinder logMesh = new Cylinder(32, 32, 1, 8, true);
    TangentBinormalGenerator.generate(logMesh);
    Geometry logGeo = new Geometry("Bleed-through color", logMesh);
    Material logMat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    logMat.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Bark/bark_diffuse.png"));
    logMat.setTexture("NormalMap", assetManager.loadTexture("Textures/Bark/bark_normal.png"));
    logMat.setBoolean("UseMaterialColors", true);
    logMat.setColor("Diffuse", ColorRGBA.Orange);
    logMat.setColor("Ambient", ColorRGBA.Gray);
    logMat.setBoolean("UseAlpha", true);
    logGeo.setMaterial(logMat);
    logGeo.move(0f, 0f, -2f);
    logGeo.rotate(0f, FastMath.DEG_TO_RAD * 90, 0f);
    rootNode.attachChild(logGeo);

    /** Must add a light to make the lit object visible! */
    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(1, 0, -2).normalizeLocal());
    sun.setColor(ColorRGBA.White);
    rootNode.addLight(sun);
    AmbientLight ambient = new AmbientLight();
    ambient.setColor(ColorRGBA.White);
    rootNode.addLight(ambient);
  }
  public void simpleInitApp() {

    DirectionalLight dl = new DirectionalLight();
    dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
    rootNode.addLight(dl);
    AmbientLight al = new AmbientLight();
    al.setColor(ColorRGBA.White.mult(0.6f));
    rootNode.addLight(al);

    // model = (Node) assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml");
    Spatial s = assetManager.loadModel(MODEL);
    if (s instanceof Node) {
      model = (Node) s;
    } else {
      model = new Node();
      model.attachChild(s);
    }

    BoundingBox b = ((BoundingBox) model.getWorldBound());
    model.setLocalScale(1.2f / (b.getYExtent() * 2));
    //  model.setLocalTranslation(0,-(b.getCenter().y - b.getYExtent())* model.getLocalScale().y,
    // 0);
    for (Spatial spatial : model.getChildren()) {
      if (spatial instanceof Geometry) {
        Geometry geom = (Geometry) spatial;
        Material mat = geom.getMaterial();
        mat.setTransparent(true);
        mat.getAdditionalRenderState().setAlphaTest(true);
        mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
        geom.setQueueBucket(RenderQueue.Bucket.Transparent);
        listGeoms.add(geom);
      }
    }
    ChaseCamera chaseCam = new ChaseCamera(cam, inputManager);
    model.addControl(chaseCam);
    chaseCam.setLookAtOffset(b.getCenter());
    chaseCam.setDefaultDistance(5);
    chaseCam.setMinVerticalRotation(-FastMath.HALF_PI + 0.01f);
    chaseCam.setZoomSensitivity(0.5f);

    //           ch = model.getControl(AnimControl.class).createChannel();
    //          ch.setAnim("Wave");
    SkeletonControl c = model.getControl(SkeletonControl.class);
    if (c != null) {
      c.setEnabled(false);
    }

    reductionvalue = 0.80f;
    lodLevel = 1;
    //        for (final Geometry geometry : listGeoms) {
    //            LodGenerator lodGenerator = new LodGenerator(geometry);
    //            lodGenerator.bakeLods(LodGenerator.TriangleReductionMethod.PROPORTIONAL,
    // reductionvalue);
    //            geometry.setLodLevel(lodLevel);
    //
    //        }

    rootNode.attachChild(model);
    flyCam.setEnabled(false);

    guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
    hudText = new BitmapText(guiFont, false);
    hudText.setSize(guiFont.getCharSet().getRenderedSize());
    hudText.setText(computeNbTri() + " tris");
    hudText.setLocalTranslation(cam.getWidth() / 2, hudText.getLineHeight(), 0);
    guiNode.attachChild(hudText);

    inputManager.addListener(
        new ActionListener() {
          public void onAction(String name, boolean isPressed, float tpf) {
            if (isPressed) {
              if (name.equals("plus")) {
                //                        lodLevel++;
                //                        for (Geometry geometry : listGeoms) {
                //                            if (geometry.getMesh().getNumLodLevels() <= lodLevel)
                // {
                //                                lodLevel = 0;
                //                            }
                //                            geometry.setLodLevel(lodLevel);
                //                        }
                //                        jaimeText.setText(computeNbTri() + " tris");

                reductionvalue += 0.05f;
                updateLod();
              }
              if (name.equals("minus")) {
                //                        lodLevel--;
                //                        for (Geometry geometry : listGeoms) {
                //                            if (lodLevel < 0) {
                //                                lodLevel = geometry.getMesh().getNumLodLevels() -
                // 1;
                //                            }
                //                            geometry.setLodLevel(lodLevel);
                //                        }
                //                        jaimeText.setText(computeNbTri() + " tris");

                reductionvalue -= 0.05f;
                updateLod();
              }
              if (name.equals("wireFrame")) {
                wireFrame = !wireFrame;
                for (Geometry geometry : listGeoms) {
                  geometry.getMaterial().getAdditionalRenderState().setWireframe(wireFrame);
                }
              }
            }
          }

          private void updateLod() {
            reductionvalue = FastMath.clamp(reductionvalue, 0.0f, 1.0f);
            makeLod(LodGenerator.TriangleReductionMethod.PROPORTIONAL, reductionvalue, 1);
          }
        },
        "plus",
        "minus",
        "wireFrame");

    inputManager.addMapping("plus", new KeyTrigger(KeyInput.KEY_ADD));
    inputManager.addMapping("minus", new KeyTrigger(KeyInput.KEY_SUBTRACT));
    inputManager.addMapping("wireFrame", new KeyTrigger(KeyInput.KEY_SPACE));
  }