|
|
@ -40,7 +40,7 @@ public class HeightMap { |
|
|
|
|
|
|
|
|
|
|
|
public static final HashMap<Integer, HeightMap> heightmapByLoadNum = new HashMap<>(); |
|
|
|
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.
|
|
|
|
// Heightmap data for all zones.
|
|
|
|
public static float SCALEVALUE = 1.0f / 255; |
|
|
|
public static float SCALEVALUE = 1.0f / 255; |
|
|
@ -326,16 +326,16 @@ public class HeightMap { |
|
|
|
try { |
|
|
|
try { |
|
|
|
BufferedImage heightmapImage = ImageIO.read(imageFile); |
|
|
|
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.
|
|
|
|
// 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 y = 0; y < heightmapImage.getHeight(); y++) { |
|
|
|
for (int x = 0; x < heightmapImage.getWidth(); x++) { |
|
|
|
for (int x = 0; x < heightmapImage.getWidth(); x++) { |
|
|
|
|
|
|
|
|
|
|
|
Color color = new Color(heightmapImage.getRGB(x, y)); |
|
|
|
Color color = new Color(heightmapImage.getRGB(x, y)); |
|
|
|
colorData[x][y] = color.getRed(); |
|
|
|
colorData[x][y] = (byte) color.getRed(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|