Package Hexel.chunk

Examples of Hexel.chunk.Chunk


    Set<Vector3i> loadedChunks = this.cVisMan.simulatedChunks;
    int minNextSimStep = Integer.MAX_VALUE;
    for (Vector3i pos : loadedChunks) {
      toUpdate.add(pos);
      Chunk chunk = BlockSimulator.this.chunks.getChunk(pos);
      minNextSimStep = Math.min(minNextSimStep, chunk.nextSimStep);
    }
    if (minNextSimStep == Integer.MAX_VALUE)
      LogData.set("minNextSim", Integer.MAX_VALUE);
    else
      LogData.set("minNextSim", (minNextSimStep - engine.time) + " " + minNextSimStep);

    do {
      deltas.clear();
      goAgain = false;
      for (Vector3i pos : toUpdate) {
        Chunk chunk = BlockSimulator.this.chunks.getChunk(pos);
        chunk.beingUpdated = true;
        simChunk(pos, deltas, step);
        if (chunk.nextSimStep == -1){
          goAgain = true;
        }
      }
      for (BlockDelta delta : deltas.values()) {
        BlockSimulator.this.chunks.setBlock(delta.x, delta.y, delta.z, delta.block, tmp3i, tmp2i, null);
        BlockSimulator.this.chunks.setStepsToSim(delta.x, delta.y, delta.z, delta.srcStepsToSim-1, tmp3i);
        if (delta.srcStepsToSim-1 > 0){
          tmp3i.x = (int) Math.floor(delta.x / 32.0);
          tmp3i.y = (int) Math.floor(delta.y / 16.0);
          tmp3i.z = (int) Math.floor(delta.z / 32.0);
          Chunk chunk = BlockSimulator.this.chunks.getChunk(tmp3i);
          if (!fastified.contains(chunk)){
            chunk.fastMode = true;
            fastified.add(chunk);
          }
        }
        delta.recycle();
      }
    } while (goAgain);

    for (Vector3i pos : toUpdate) {
      Chunk chunk = BlockSimulator.this.chunks.getChunk(pos);
      chunk.needFirstSim = false;
      chunk.beingUpdated = false;
    }
    for (Chunk chunk : fastified){
      chunk.fastMode = false;
View Full Code Here


      chunk.fastMode = false;
    }
  }

  private void simChunk(Vector3i p, Hashtable<Vector3i, BlockDelta> deltas, int step){
    Chunk chunk = this.chunks.getChunk(p);

    if (chunk.nextSimStep != -1 && chunk.nextSimStep > step) {
      return;
    }
    chunk.nextSimStep = Integer.MAX_VALUE;

    Vector2i tmp2 = new Vector2i();

    for (int x = 0; x < 32; x++) {
      for (int y = 0; y < 16; y++) {
        for (int z = 0; z < 32; z++) {
          Block b = chunk.get(x, y, z);
          int gx = p.x * 32 + x;
          int gy = p.y * 16 + y;
          int gz = p.z * 32 + z;
          HighestBlockChunk hbc = chunks.getHighestBlockChunkAtXY(gx, gy, tmp2);
          simBlock(gx, gy, gz, chunk, hbc, b, step, deltas);
View Full Code Here

  public Chunk genChunk(Vector3i pos) {
    return this.genChunk(pos.x, pos.y, pos.z);
  }

  public Chunk genChunk(int cx, int cy, int cz) {
    Chunk chunk = new Chunk(cx, cy, cz);

    Vector2i tmp = new Vector2i();

    for (int x = 0; x < 32; x++) {
      for (int y = 0; y < 16; y++) {
        for (int z = 0; z < 32; z++) {
          int gx = cx * 32 + x;
          int gy = cy * 16 + y;
          int gz = cz * 32 + z;
          Block b = this.tm.getBlock(gx, gy, gz, tmp);
          chunk.set(x, y, z, b);
          chunk.stepsToSim[x][y][z] = 100;
          chunk.nextSimSteps[x][y][z] = -1;
          if (!(b instanceof BlockTransparent))
            chunks.updateHighestBlockAtXY(gx, gy, gz, tmp);

View Full Code Here

    }
    this.chunkVertexBufferGeneratorThreadPool.execute(new Runnable() {
      @Override
      public void run() {
        for (Vector3i point : points) {
          Chunk chunk = ChunkRenderer.this.chunks.getChunk(point);
          GLChunk glChunk = new GLChunk(engine, chunk, ChunkRenderer.this.chunks);
          glChunk.position = new Vector3i(chunk.cx, chunk.cy,
              chunk.cz);
          glChunk.genArrayList();
          ChunkRenderer.this.loadGLChunk(glChunk);
View Full Code Here

TOP

Related Classes of Hexel.chunk.Chunk

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.