浏览代码

added heightmap grid epsilon for seams

Nicolas Cannasse 5 年之前
父节点
当前提交
6046e453f2
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      hrt/prefab/l3d/HeightMap.hx

+ 2 - 1
hrt/prefab/l3d/HeightMap.hx

@@ -240,6 +240,7 @@ class HeightMapMesh extends h3d.scene.Object {
 	var world : WorldNoSoil;
 	var world : WorldNoSoil;
 	var modelCache : Map<String, h3d.scene.World.WorldModel> = new Map();
 	var modelCache : Map<String, h3d.scene.World.WorldModel> = new Map();
 	var nullModel = new h3d.scene.World.WorldModel(null);
 	var nullModel = new h3d.scene.World.WorldModel(null);
+	var epsilon = 0.5;
 
 
 	public function new(hmap, ?parent) {
 	public function new(hmap, ?parent) {
 		super(parent);
 		super(parent);
@@ -303,7 +304,7 @@ class HeightMapMesh extends h3d.scene.Object {
 		var height = htex == null ? Std.int(size) : htex.height;
 		var height = htex == null ? Std.int(size) : htex.height;
 		var cw = size/width, ch = size/height;
 		var cw = size/width, ch = size/height;
 		if( grid == null || grid.width != width || grid.height != height || grid.cellWidth != cw || grid.cellHeight != ch ) {
 		if( grid == null || grid.width != width || grid.height != height || grid.cellWidth != cw || grid.cellHeight != ch ) {
-			grid = new HeightGrid(width,height,cw,ch);
+			grid = new HeightGrid(width,height,cw+epsilon/width,ch+epsilon/height);
 			grid.addUVs();
 			grid.addUVs();
 			grid.addNormals();
 			grid.addNormals();
 		}
 		}