Ok Herkules, I decompiled SimpleHeighmap.class from your DRTS project.(Hope thats ok)
I understand everything until i got to this part
1 2 3 4 5 6 7 8 9 10
| private static Raster getHeightRaster(Image image, int i) { int j = image.getWidth(null); int k = image.getHeight(null); int l = j / i; int i1 = k / i; BufferedImage bufferedimage = new BufferedImage(l, i1, 10); bufferedimage.createGraphics().drawImage(image, 0, 0, l, i1, null); return bufferedimage.getData(); } |
I searched around the Java Docs and couldn't find the method for this
1
| bufferedimage.createGraphics().drawImage(image, 0, 0, l, i1, null); |
I know your drawing the image and then retrieving the Raster from the bufferedimage but can you explain the variables that
drawImage(image, 0, 0, l, i1, null);
takes?
Also what is the variable i, and why is j and k, the width and height being divided by it?(See code)
1 2
| int l = j / i; int i1 = k / i; |
Another question, how would you go about creating a the terrain from the info you get from the Raster? Would you input the height info and stuff into a QuadArray?
Thanks.