Package Hexel.generation.terrainGenerator.originalPlateGenerator.heightMap

Source Code of Hexel.generation.terrainGenerator.originalPlateGenerator.heightMap.HeightMap

package Hexel.generation.terrainGenerator.originalPlateGenerator.heightMap;

import Hexel.generation.terrainGenerator.originalPlateGenerator.plate.PlateSum;
import Hexel.generation.terrainGenerator.originalPlateGenerator.plate.PlateSumChunks;

public class HeightMap {

  private PlateSumChunks smallPSCs;
  private PlateSumChunks bigPSCs;

  private static final int SCALE = 2;

  public HeightMap() {
    this.smallPSCs = new PlateSumChunks();
    this.bigPSCs = new PlateSumChunks();
  }

  public int getHeight(int px, int py) {
    PlateSum small = this.smallPSCs.getPlateSum(px, py);
    PlateSum big = this.bigPSCs.getPlateSum(px / SCALE, py / SCALE);
    double h = 0;
    if (big.baseHeight < 0) {
      h = big.baseHeight;
      if (h + big.heightVar < 0)
        h += big.heightVar;
    } else {
      h = small.additions + Math.max(small.baseHeight, 0)
          + small.heightVar;
    }
    return (int) h;
  }

  public double getResistanceToChange(int px, int py) {
    PlateSum small = this.smallPSCs.getPlateSum(px, py);
    return small.resistanceToChange;
  }
}
TOP

Related Classes of Hexel.generation.terrainGenerator.originalPlateGenerator.heightMap.HeightMap

TOP
Copyright © 2018 www.massapi.com. 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.