示例#1
0
 @Override
 public Node clone(boolean cloneMaterials) {
   BatchNode clone = (BatchNode) super.clone(cloneMaterials);
   if (batches.size() > 0) {
     for (Batch b : batches) {
       for (int i = 0; i < clone.children.size(); i++) {
         if (clone.children.get(i).getName().equals(b.geometry.getName())) {
           clone.children.remove(i);
           break;
         }
       }
     }
     clone.needsFullRebatch = true;
     clone.batches.clear();
     clone.batchesByGeom.clear();
     clone.batch();
   }
   return clone;
 }
示例#2
0
  @Override
  public void simpleInitApp() {
    timer = new NanoTimer();

    batchNode = new SimpleBatchNode("BatchNode");

    xPosition.add(0);
    yPosition.add(0);
    zPosition.add(0);

    mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat1.setColor("Color", ColorRGBA.White);
    mat1.setColor("GlowColor", ColorRGBA.Blue.mult(10));

    mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat2.setColor("Color", ColorRGBA.White);
    mat2.setColor("GlowColor", ColorRGBA.Red.mult(10));

    mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat3.setColor("Color", ColorRGBA.White);
    mat3.setColor("GlowColor", ColorRGBA.Yellow.mult(10));

    mat4 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat4.setColor("Color", ColorRGBA.White);
    mat4.setColor("GlowColor", ColorRGBA.Orange.mult(10));

    randomGenerator();

    // rootNode.attachChild(SkyFactory.createSky(
    //  assetManager, "Textures/SKY02.zip", false));
    inputManager.addMapping("Start Game", new KeyTrigger(KeyInput.KEY_J));
    inputManager.addListener(al, new String[] {"Start Game"});

    getCam().setLocation(new Vector3f(-34.403286f, 126.65158f, 434.791f));
    getCam().setRotation(new Quaternion(0.022630932f, 0.9749435f, -0.18736298f, 0.11776358f));

    batchNode.batch();

    terrain = new Node("terrain");
    terrain.setLocalTranslation(50, 0, 50);
    terrain.attachChild(batchNode);

    flyCam.setMoveSpeed(100);
    rootNode.attachChild(terrain);
    Vector3f pos = new Vector3f(-40, 0, -40);
    batchNode.setLocalTranslation(pos);

    Arrow a = new Arrow(new Vector3f(0, 50, 0));
    Geometry g = new Geometry("a", a);
    g.setLocalTranslation(terrain.getLocalTranslation());
    Material m = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    m.setColor("Color", ColorRGBA.Blue);
    g.setMaterial(m);

    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
    fpp.addFilter(new BloomFilter(BloomFilter.GlowMode.Objects));
    //        SSAOFilter ssao = new SSAOFilter(8.630104f,22.970434f,2.9299977f,0.2999997f);
    //        fpp.addFilter(ssao);
    viewPort.addProcessor(fpp);
    //   viewPort.setBackgroundColor(ColorRGBA.DarkGray);
  }