Browse Source

Pixel values are shorts for memory

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
f1a2bea67c
  1. 10
      src/engine/InterestManagement/Terrain.java

10
src/engine/InterestManagement/Terrain.java

@ -172,6 +172,8 @@ public class Terrain { @@ -172,6 +172,8 @@ public class Terrain {
if (this.zone.guild_zone)
return 5.0f;
// Determine terrain and offset from top left vertex
Vector2f terrain_cell = getTerrainCell(terrain_loc);
int pixel_x = (int) Math.floor(terrain_cell.x);
@ -181,10 +183,10 @@ public class Terrain { @@ -181,10 +183,10 @@ public class Terrain {
// 4 surrounding vertices from the pixel array.
float top_left_pixel = terrain_pixel_data[pixel_x][pixel_y];
float top_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y];
float bottom_left_pixel = terrain_pixel_data[pixel_x][pixel_y + 1];
float bottom_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y + 1];
short top_left_pixel = terrain_pixel_data[pixel_x][pixel_y];
short top_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y];
short bottom_left_pixel = terrain_pixel_data[pixel_x][pixel_y + 1];
short bottom_right_pixel = terrain_pixel_data[pixel_x + 1][pixel_y + 1];
// Interpolate between the 4 vertices

Loading…
Cancel
Save