Browse Source

Static method to save memory.

feature-region-set
MagicBot 1 year ago
parent
commit
f646075311
  1. 14
      src/engine/InterestManagement/HeightMap.java

14
src/engine/InterestManagement/HeightMap.java

@ -103,7 +103,7 @@ public class HeightMap {
// Generate pixel array from image data // Generate pixel array from image data
generatePixelData(); generatePixelData(this);
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this); HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
@ -423,19 +423,19 @@ public class HeightMap {
return interpolatedHeight; return interpolatedHeight;
} }
private void generatePixelData() { private static void generatePixelData(HeightMap heightMap) {
Color color; Color color;
// Generate altitude lookup table for this heightmap // Generate altitude lookup table for this heightmap
this.pixelColorValues = new int[this.heightmapImage.getWidth()][this.heightmapImage.getHeight()]; heightMap.pixelColorValues = new int[heightMap.heightmapImage.getWidth()][heightMap.heightmapImage.getHeight()];
for (int y = 0; y < this.heightmapImage.getHeight(); y++) { for (int y = 0; y < heightMap.heightmapImage.getHeight(); y++) {
for (int x = 0; x < this.heightmapImage.getWidth(); x++) { for (int x = 0; x < heightMap.heightmapImage.getWidth(); x++) {
color = new Color(this.heightmapImage.getRGB(x, y)); color = new Color(heightMap.heightmapImage.getRGB(x, y));
pixelColorValues[x][y] = color.getRed(); heightMap.pixelColorValues[x][y] = color.getRed();
} }
} }

Loading…
Cancel
Save