auto-git:
[add] src/rendering/terrain-layer-material.ts [add] tests/domain/terrains.test.ts [change] src/app/App.tsx [change] src/core/terrain-brush.ts [change] src/document/migrate-scene-document.ts [change] src/document/scene-document-validation.ts [change] src/document/scene-document.ts [change] src/document/terrains.ts [change] src/geometry/terrain-brush.ts [change] src/geometry/terrain-mesh.ts [change] src/runtime-three/rapier-collision-world.ts [change] src/runtime-three/runtime-host.ts [change] src/runtime-three/runtime-scene-build.ts [change] src/viewport-three/ViewportCanvas.tsx [change] src/viewport-three/ViewportPanel.tsx [change] src/viewport-three/viewport-host.ts [change] tests/domain/build-runtime-scene.test.ts [change] tests/domain/rapier-collision-world.test.ts [change] tests/domain/terrain.command.test.ts [change] tests/domain/water-material.test.ts [change] tests/geometry/terrain-brush.test.ts [change] tests/geometry/terrain-mesh.test.ts [change] tests/serialization/scene-document-json.test.ts [change] tests/unit/terrain-foundation.integration.test.tsx [change] tests/unit/viewport-canvas.test.tsx
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
||||
Vector3,
|
||||
SpotLight,
|
||||
TextureLoader,
|
||||
Texture,
|
||||
WebGLRenderTarget,
|
||||
WebGLRenderer
|
||||
} from "three";
|
||||
@@ -88,6 +89,10 @@ import {
|
||||
} from "../rendering/water-material";
|
||||
import { createFogQualityMaterial } from "../rendering/fog-material";
|
||||
import { updatePlanarReflectionCamera } from "../rendering/planar-reflection";
|
||||
import {
|
||||
createTerrainLayerBlendMaterial,
|
||||
getTerrainLayerTexture
|
||||
} from "../rendering/terrain-layer-material";
|
||||
import {
|
||||
applyWhiteboxBevelToMaterial,
|
||||
shouldApplyWhiteboxBevel
|
||||
@@ -1924,14 +1929,7 @@ export class RuntimeHost {
|
||||
kind: "terrain",
|
||||
enabled: true
|
||||
}).geometry;
|
||||
const mesh = new Mesh(
|
||||
geometry,
|
||||
new MeshStandardMaterial({
|
||||
color: 0x708b57,
|
||||
roughness: 0.98,
|
||||
metalness: 0
|
||||
})
|
||||
);
|
||||
const mesh = new Mesh(geometry, this.createRuntimeTerrainMaterial(terrain));
|
||||
|
||||
mesh.position.set(
|
||||
terrain.position.x,
|
||||
@@ -1948,6 +1946,18 @@ export class RuntimeHost {
|
||||
this.applyShadowState();
|
||||
}
|
||||
|
||||
private createRuntimeTerrainMaterial(terrain: RuntimeTerrain): Material {
|
||||
const layerTextures = terrain.layers.map((layer) =>
|
||||
getTerrainLayerTexture(layer.material, (material) =>
|
||||
this.getOrCreateTextureSet(material).baseColor
|
||||
)
|
||||
) as [Texture, Texture, Texture, Texture];
|
||||
|
||||
return createTerrainLayerBlendMaterial({
|
||||
layerTextures
|
||||
});
|
||||
}
|
||||
|
||||
private createFogMaterialSet(
|
||||
brush: RuntimeBoxBrushInstance,
|
||||
volumeRenderPaths: {
|
||||
@@ -2771,7 +2781,43 @@ export class RuntimeHost {
|
||||
return [];
|
||||
}
|
||||
|
||||
for (const terrain of this.runtimeScene.terrains) {
|
||||
if (!terrain.visible) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const derivedMesh = buildTerrainDerivedMeshData({
|
||||
...terrain,
|
||||
kind: "terrain",
|
||||
enabled: true
|
||||
});
|
||||
|
||||
contactBounds.push({
|
||||
kind: "triangleMesh",
|
||||
vertices: derivedMesh.positions,
|
||||
indices: derivedMesh.indices,
|
||||
mergeProfile: "aggressive",
|
||||
transform: {
|
||||
position: terrain.position,
|
||||
rotationDegrees: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0
|
||||
},
|
||||
scale: {
|
||||
x: 1,
|
||||
y: 1,
|
||||
z: 1
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (const collider of this.runtimeScene.colliders) {
|
||||
if (collider.source === "terrain") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (collider.kind === "trimesh" && collider.source === "brush") {
|
||||
if (collider.brushId === brush.id) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user