forked from MagicBane/Server
Static method to save memory.
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user