private static void packNormAt(int x, int y, byte heightMap[][], int i) {
    //
    //  We have to allow for 'edge cases' against the sides of the map, which
    //  complicates matters slightly.
    final float slopeX ;
    if (x > 0 && x < heightMap.length - 1) slopeX = (
      (heightMap[x][y] - heightMap[x - 1][y]) +
      (heightMap[x + 1][y] - heightMap[x][y])
    ) / 2 ;
    else if (x == 0) slopeX = heightMap[x + 1][y] - heightMap[x][y] ;
    else slopeX = heightMap[x][y] - heightMap[x - 1][y] ;
    //
    //  By getting the average slope at a given corner of a tile, we can get an
    //  apropriate normal value.
    final float slopeY ;
    if (y > 0 && y < heightMap[0].length - 1) slopeY = (
      (heightMap[x][y] - heightMap[x][y - 1]) +
      (heightMap[x][y + 1] - heightMap[x][y])
    ) / 2 ;
    else if (y == 0) slopeY = heightMap[x][y + 1] - heightMap[x][y] ;
    else slopeY = heightMap[x][y] - heightMap[x][y - 1] ;
    //
    //  We then pack said normal into the array at the proper index, and
    //  return-
    tempNorm.set(-slopeX / 4, -slopeY / 4, 1) ;
    tempNorm.normalise() ;
    tempN[0 + i] = tempNorm.x ;
    tempN[1 + i] = tempNorm.y ;
    tempN[2 + i] = tempNorm.z ;
  }