|  |  | @ -56,6 +56,8 @@ public class HeightMap { | 
			
		
	
		
		
			
				
					
					|  |  |  |     public float bucketWidthY; |  |  |  |     public float bucketWidthY; | 
			
		
	
		
		
			
				
					
					|  |  |  |     public float seaLevel = 0; |  |  |  |     public float seaLevel = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |     public int[][] pixelColorValues; |  |  |  |     public int[][] pixelColorValues; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public int bucketCountX; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public int bucketCountY; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public float zone_minBlend; |  |  |  |     public float zone_minBlend; | 
			
		
	
		
		
			
				
					
					|  |  |  |     public float zone_maxBlend; |  |  |  |     public float zone_maxBlend; | 
			
		
	
	
		
		
			
				
					|  |  | @ -95,13 +97,11 @@ public class HeightMap { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         // Calculate the data we do not load from table
 |  |  |  |         // Calculate the data we do not load from table
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         float numOfBucketsX = this.heightmapImage.getWidth() - 1; |  |  |  |         bucketCountX = this.heightmapImage.getWidth() - 1; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         float calculatedWidthX = this.fullExtentsX / numOfBucketsX; |  |  |  |         this.bucketWidthX = this.fullExtentsX / bucketCountX; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         this.bucketWidthX = calculatedWidthX; |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         float numOfBucketsY = this.heightmapImage.getHeight() - 1; |  |  |  |         bucketCountY = this.heightmapImage.getHeight() - 1; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         float calculatedWidthY = this.fullExtentsY / numOfBucketsY; |  |  |  |         this.bucketWidthY = this.fullExtentsY / bucketCountY; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         this.bucketWidthY = calculatedWidthY; |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         // Generate pixel array from image data
 |  |  |  |         // Generate pixel array from image data
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -325,22 +325,16 @@ public class HeightMap { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public Vector2f getGridSquare(Vector2f zoneLoc) { |  |  |  |     public Vector2f getGridSquare(Vector2f zoneLoc) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         // Clamp values.
 |  |  |  |         float xBucket = (zoneLoc.x / this.bucketWidthX); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |         float yBucket = (zoneLoc.y / this.bucketWidthY); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         if (zoneLoc.x < 0) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             zoneLoc.setX(0); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (zoneLoc.x >= this.fullExtentsX) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             zoneLoc.setX(this.fullExtentsX); |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (zoneLoc.y < 0) |  |  |  |         // Standing on the pole
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             zoneLoc.setY(0); |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (zoneLoc.y > this.fullExtentsY) |  |  |  |         if (xBucket == this.bucketCountX) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             zoneLoc.setY(this.fullExtentsY); |  |  |  |             xBucket--; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         float xBucket = (zoneLoc.x / this.bucketWidthX); |  |  |  |         if (yBucket == this.bucketCountY) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         float yBucket = (zoneLoc.y / this.bucketWidthY); |  |  |  |             yBucket--; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         return new Vector2f(xBucket, yBucket); |  |  |  |         return new Vector2f(xBucket, yBucket); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |