Пример #1
0
  @Override
  public void run() {
    // try { Thread.sleep(15000); } catch (InterruptedException e) { }//debug delay to see loading
    // effects

    System.out.println("Thread [" + ID + "] started. MapSize=" + mapSize);
    long startTime = System.currentTimeMillis();

    // do work
    if (!stop) {
      heightMap =
          NoiseGen.generateWrappingNoise4D(seed, mapSize, scale, octaves, persistence, lacunarity);
    }
    if (!stop) {
      tileMap = NoiseGen.createTileMap(heightMap, tiles);
    }
    if (!stop) {
      pixelatedTileMap = NoiseGen.createPixelatedTileMap(tileMap, tiles);
    }

    // finish
    long endTime = System.currentTimeMillis() - startTime;
    isDone = true;
    if (stop) {
      System.out.println("Thread [" + ID + "] killed. " + endTime + "ms");
    } else {
      System.out.println("Thread [" + ID + "] complete in : " + endTime + "ms. MapSize=" + mapSize);
    }
  }
Пример #2
0
  public PlanetGen(NoiseGen noiseGen, int radius) {
    Pixmap pixmap = noiseGen.getTexture(NoiseGen.TextureNoise.PLANET, /*7*/ 3);
    Texture t = new Texture(pixmap);
    t.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    pixmap.dispose();

    ModelBuilder builder = new ModelBuilder();

    model =
        new ModelInstance(
            builder.createSphere(
                radius * 2,
                radius * 2,
                radius * 2,
                32,
                16,
                new Material(TextureAttribute.createDiffuse(t)),
                VertexAttributes.Usage.Position
                    | VertexAttributes.Usage.Normal
                    | VertexAttributes.Usage.TextureCoordinates));
  }