Browse Source

Fix bigprim for terrain

ShiroSmith 5 years ago
parent
commit
97dec27f54
1 changed files with 3 additions and 3 deletions
  1. 3 3
      hrt/prefab/terrain/Tile.hx

+ 3 - 3
hrt/prefab/terrain/Tile.hx

@@ -95,7 +95,7 @@ class Tile extends h3d.scene.Mesh {
 		bigPrim = new h3d.prim.BigPrimitive(9, true);
 		inline function addVertice(x : Float, y : Float, i : Int) {
 			// Pos
-			bigPrim.addPoint(x, y, getHeight(x / terrain.tileSize.x, y / terrain.tileSize.y)); // Use addPoint() instead of addVertexValue() for the bounds
+			bigPrim.addPoint(x, y, getHeight(x / terrain.tileSize.x, y / terrain.tileSize.y, true)); // Use addPoint() instead of addVertexValue() for the bounds
 			// Normal
 			bigPrim.addVertexValue(bytes.getFloat(i * stride));
 			bigPrim.addVertexValue(bytes.getFloat(i * stride + 4));
@@ -536,8 +536,8 @@ class Tile extends h3d.scene.Mesh {
 
 		}
 		else{
-			var x = hxd.Math.floor(u * (pixels.width - 1) + 0.5);
-			var y = hxd.Math.floor(v * (pixels.height - 1) + 0.5);
+			var x = hxd.Math.floor(u * (pixels.width - 1));
+			var y = hxd.Math.floor(v * (pixels.height - 1));
 			return pixels.getPixelF(x, y).r;
 		}
 	}