Example #1
0
  public void randomGenerator() {
    for (int i = startAt; i < maxCubes - 1; i++) {
      randomize();
      Geometry box = new Geometry("Box" + i, new Box(Vector3f.ZERO, 1, 1, 1));
      box.setLocalTranslation(
          new Vector3f(
              xPosition.get(xPosition.size() - 1),
              yPosition.get(yPosition.size() - 1),
              zPosition.get(zPosition.size() - 1)));
      batchNode.attachChild(box);
      if (i < 500) {
        box.setMaterial(mat1);
      } else if (i < 1000) {

        box.setMaterial(mat2);
      } else if (i < 1500) {

        box.setMaterial(mat3);
      } else {

        box.setMaterial(mat4);
      }
    }
  }
 /**
  * @param m
  * @param n
  * @param w
  * @param h
  * @param pix
  */
 public InteractiveRenderer(int m, int n, int w, int h) {
   W = w;
   H = h;
   renderer = new Renderer();
   pixels = renderer.init(W, H);
   Geometry g = this.add();
   texture = new Texture(pixels, W, H, "grid", false);
   Material material = new Material();
   material.setTexture(texture);
   g.setMaterial(material);
   g.setDoubleSided(true);
   g.mesh(m, n);
   g.name = "mesh";
   init();
 }
Example #3
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);
  }