浏览代码

Fix Build

ShiroSmith 6 年之前
父节点
当前提交
227145d7c7
共有 2 个文件被更改,包括 5 次插入7 次删除
  1. 4 5
      h3d/scene/pbr/terrain/Terrain.hx
  2. 1 2
      h3d/scene/pbr/terrain/Tile.hx

+ 4 - 5
h3d/scene/pbr/terrain/Terrain.hx

@@ -41,15 +41,14 @@ class Terrain extends Object {
 		o.heightBlendStrength = heightBlendStrength;
 		o.heightBlendSharpness = heightBlendSharpness;
 
-		o.tiles.resize(tiles.length);
 		for( i in 0...tiles.length ){
-			o.tiles[i] = Std.instance(tiles[i].clone(), Tile);
-			o.tiles[i].parent = o;
+			var t = Std.instance(tiles[i].clone(), Tile);
+			t.parent = o;
+			o.tiles.push(t);
 		}
 
-		o.surfaces.resize(surfaces.length);
 		for( i in 0...surfaces.length )
-			o.surfaces[i] = surfaces[i].clone();
+			o.surfaces.push(surfaces[i].clone());
 
 		o.surfaceArray = surfaceArray.clone();
 

+ 1 - 2
h3d/scene/pbr/terrain/Tile.hx

@@ -35,9 +35,8 @@ class Tile extends h3d.scene.Mesh {
 		o.heightMap = heightMap.clone();
 		o.surfaceIndexMap = surfaceIndexMap.clone();
 
-		o.surfaceWeights.resize(surfaceWeights.length);
 		for( i in 0...surfaceWeights.length )
-			o.surfaceWeights[i] = surfaceWeights[i].clone();
+			o.surfaceWeights.push(surfaceWeights[i].clone());
 
 		o.surfaceWeightArray = new h3d.mat.TextureArray(getTerrain().weightMapResolution, getTerrain().weightMapResolution, surfaceWeights.length, [Target], R8);
 		o.surfaceWeightArray.wrap = Clamp;