Static method to save memory.

This commit is contained in:
2023-09-14 12:28:36 -04:00
parent dfca767476
commit f646075311
+7 -7
View File
@@ -103,7 +103,7 @@ public class HeightMap {
// Generate pixel array from image data
generatePixelData();
generatePixelData(this);
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
@@ -423,19 +423,19 @@ public class HeightMap {
return interpolatedHeight;
}
private void generatePixelData() {
private static void generatePixelData(HeightMap heightMap) {
Color color;
// 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 x = 0; x < this.heightmapImage.getWidth(); x++) {
for (int y = 0; y < heightMap.heightmapImage.getHeight(); y++) {
for (int x = 0; x < heightMap.heightmapImage.getWidth(); x++) {
color = new Color(this.heightmapImage.getRGB(x, y));
pixelColorValues[x][y] = color.getRed();
color = new Color(heightMap.heightmapImage.getRGB(x, y));
heightMap.pixelColorValues[x][y] = color.getRed();
}
}