Browse Source

byte array to save memory.

combat-2
MagicBot 1 year ago
parent
commit
6fd61889a8
  1. 8
      src/engine/InterestManagement/HeightMap.java

8
src/engine/InterestManagement/HeightMap.java

@ -40,7 +40,7 @@ public class HeightMap { @@ -40,7 +40,7 @@ public class HeightMap {
public static final HashMap<Integer, HeightMap> heightmapByLoadNum = new HashMap<>();
public static final HashMap<Integer, int[][]> _pixelData = new HashMap<>();
public static final HashMap<Integer, byte[][]> _pixelData = new HashMap<>();
// Heightmap data for all zones.
public static float SCALEVALUE = 1.0f / 255;
@ -326,16 +326,16 @@ public class HeightMap { @@ -326,16 +326,16 @@ public class HeightMap {
try {
BufferedImage heightmapImage = ImageIO.read(imageFile);
// Generate pixel for this heightmap. RPG channels are all the same
// Generate pixel data for this heightmap. RPG channels are all the same
// in this greyscale TGA heightmap. We will choose red.
int[][] colorData = new int[heightmapImage.getWidth()][heightmapImage.getHeight()];
byte[][] colorData = new byte[heightmapImage.getWidth()][heightmapImage.getHeight()];
for (int y = 0; y < heightmapImage.getHeight(); y++) {
for (int x = 0; x < heightmapImage.getWidth(); x++) {
Color color = new Color(heightmapImage.getRGB(x, y));
colorData[x][y] = color.getRed();
colorData[x][y] = (byte) color.getRed();
}
}

Loading…
Cancel
Save