auto-git:
[change] src/geometry/terrain-mesh.ts
This commit is contained in:
@@ -373,7 +373,9 @@ function pushTerrainLodVertex(
|
|||||||
yOffset: number,
|
yOffset: number,
|
||||||
positions: number[],
|
positions: number[],
|
||||||
uvs: number[],
|
uvs: number[],
|
||||||
layerWeights: number[]
|
layerWeights: number[],
|
||||||
|
foliageMaskWeights: number[],
|
||||||
|
options: TerrainMeshBuildOptions
|
||||||
) {
|
) {
|
||||||
const localX = sampleX * terrain.cellSize;
|
const localX = sampleX * terrain.cellSize;
|
||||||
const localY = getTerrainHeightAtSample(terrain, sampleX, sampleZ) + yOffset;
|
const localY = getTerrainHeightAtSample(terrain, sampleX, sampleZ) + yOffset;
|
||||||
@@ -390,6 +392,17 @@ function pushTerrainLodVertex(
|
|||||||
for (const weight of sampleLayerWeights) {
|
for (const weight of sampleLayerWeights) {
|
||||||
layerWeights.push(weight);
|
layerWeights.push(weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const foliageMask =
|
||||||
|
options.foliageMaskLayerId === undefined ||
|
||||||
|
options.foliageMaskLayerId === null
|
||||||
|
? null
|
||||||
|
: getTerrainFoliageMask(terrain, options.foliageMaskLayerId);
|
||||||
|
foliageMaskWeights.push(
|
||||||
|
foliageMask === null
|
||||||
|
? 0
|
||||||
|
: getTerrainFoliageMaskValueAtSample(foliageMask, sampleX, sampleZ)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pushTerrainLodSkirtSegment(
|
function pushTerrainLodSkirtSegment(
|
||||||
@@ -402,7 +415,9 @@ function pushTerrainLodSkirtSegment(
|
|||||||
positions: number[],
|
positions: number[],
|
||||||
uvs: number[],
|
uvs: number[],
|
||||||
layerWeights: number[],
|
layerWeights: number[],
|
||||||
indices: number[]
|
foliageMaskWeights: number[],
|
||||||
|
indices: number[],
|
||||||
|
options: TerrainMeshBuildOptions
|
||||||
) {
|
) {
|
||||||
const topStart = positions.length / 3;
|
const topStart = positions.length / 3;
|
||||||
pushTerrainLodVertex(
|
pushTerrainLodVertex(
|
||||||
@@ -412,7 +427,9 @@ function pushTerrainLodSkirtSegment(
|
|||||||
0,
|
0,
|
||||||
positions,
|
positions,
|
||||||
uvs,
|
uvs,
|
||||||
layerWeights
|
layerWeights,
|
||||||
|
foliageMaskWeights,
|
||||||
|
options
|
||||||
);
|
);
|
||||||
const topEnd = positions.length / 3;
|
const topEnd = positions.length / 3;
|
||||||
pushTerrainLodVertex(
|
pushTerrainLodVertex(
|
||||||
@@ -422,7 +439,9 @@ function pushTerrainLodSkirtSegment(
|
|||||||
0,
|
0,
|
||||||
positions,
|
positions,
|
||||||
uvs,
|
uvs,
|
||||||
layerWeights
|
layerWeights,
|
||||||
|
foliageMaskWeights,
|
||||||
|
options
|
||||||
);
|
);
|
||||||
const bottomStart = positions.length / 3;
|
const bottomStart = positions.length / 3;
|
||||||
pushTerrainLodVertex(
|
pushTerrainLodVertex(
|
||||||
@@ -432,7 +451,9 @@ function pushTerrainLodSkirtSegment(
|
|||||||
-skirtDepth,
|
-skirtDepth,
|
||||||
positions,
|
positions,
|
||||||
uvs,
|
uvs,
|
||||||
layerWeights
|
layerWeights,
|
||||||
|
foliageMaskWeights,
|
||||||
|
options
|
||||||
);
|
);
|
||||||
const bottomEnd = positions.length / 3;
|
const bottomEnd = positions.length / 3;
|
||||||
pushTerrainLodVertex(
|
pushTerrainLodVertex(
|
||||||
@@ -442,7 +463,9 @@ function pushTerrainLodSkirtSegment(
|
|||||||
-skirtDepth,
|
-skirtDepth,
|
||||||
positions,
|
positions,
|
||||||
uvs,
|
uvs,
|
||||||
layerWeights
|
layerWeights,
|
||||||
|
foliageMaskWeights,
|
||||||
|
options
|
||||||
);
|
);
|
||||||
|
|
||||||
indices.push(topStart, bottomStart, bottomEnd);
|
indices.push(topStart, bottomStart, bottomEnd);
|
||||||
|
|||||||
Reference in New Issue
Block a user