mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
train 3d visualizations
This commit is contained in:
@@ -113,7 +113,7 @@ function buildAcacia(rng: () => number): THREE.Group {
|
||||
tree.add(branch);
|
||||
}
|
||||
const canopyMat = new THREE.MeshStandardMaterial({
|
||||
color: rng() > 0.5 ? 0x5d7a35 : 0x6b8342,
|
||||
color: rng() > 0.5 ? 0x2f7d32 : 0x3c8d40,
|
||||
roughness: 1,
|
||||
});
|
||||
const canopy = new THREE.Mesh(new THREE.SphereGeometry(2.6 + rng() * 1.6, 10, 8), canopyMat);
|
||||
@@ -124,7 +124,7 @@ function buildAcacia(rng: () => number): THREE.Group {
|
||||
}
|
||||
|
||||
function buildShrub(rng: () => number): THREE.Mesh {
|
||||
const dry = [0x9c8a4d, 0x8f7a3e, 0xa89a5e, 0x7d8a4a];
|
||||
const dry = [0x3c7d33, 0x4f9e3f, 0x2e6b28, 0x5da84a];
|
||||
const shrub = new THREE.Mesh(
|
||||
new THREE.SphereGeometry(0.5 + rng() * 0.8, 7, 6),
|
||||
new THREE.MeshStandardMaterial({ color: dry[Math.floor(rng() * dry.length)], roughness: 1 }),
|
||||
@@ -196,8 +196,8 @@ function buildScenery(scene: THREE.Scene, trackLen: number) {
|
||||
const rng = makeRng(1234567);
|
||||
buildClouds(scene, rng);
|
||||
const spread = Math.max(trackLen, 600);
|
||||
// sand variation: lighter wind-blown patches
|
||||
const patchMat = new THREE.MeshStandardMaterial({ color: 0xe6cfa3, roughness: 1 });
|
||||
// grass variation: darker meadow patches
|
||||
const patchMat = new THREE.MeshStandardMaterial({ color: 0x4f8f3a, roughness: 1 });
|
||||
const patchGeo = new THREE.CircleGeometry(4, 8);
|
||||
const patches = new THREE.InstancedMesh(patchGeo, patchMat, 160);
|
||||
const m4 = new THREE.Matrix4();
|
||||
@@ -212,8 +212,8 @@ function buildScenery(scene: THREE.Scene, trackLen: number) {
|
||||
patches.setMatrixAt(i, m4);
|
||||
}
|
||||
scene.add(patches);
|
||||
// low dunes on the horizon sides
|
||||
const duneMat = new THREE.MeshStandardMaterial({ color: 0xcaa878, roughness: 1 });
|
||||
// low green hills on the horizon sides
|
||||
const duneMat = new THREE.MeshStandardMaterial({ color: 0x4a8a38, roughness: 1 });
|
||||
for (let i = 0; i < 12; i++) {
|
||||
const dune = new THREE.Mesh(new THREE.SphereGeometry(30 + rng() * 50, 12, 8), duneMat);
|
||||
dune.scale.set(1.6 + rng(), 0.12 + rng() * 0.08, 1 + rng());
|
||||
@@ -289,7 +289,7 @@ function buildTrack(scene: THREE.Scene, length: number) {
|
||||
// ground
|
||||
const ground = new THREE.Mesh(
|
||||
new THREE.PlaneGeometry(4000, 1600),
|
||||
new THREE.MeshStandardMaterial({ color: 0xd8b98a, roughness: 1 }),
|
||||
new THREE.MeshStandardMaterial({ color: 0x5da043, roughness: 1 }),
|
||||
);
|
||||
ground.rotation.x = -Math.PI / 2;
|
||||
ground.position.y = -0.02;
|
||||
@@ -593,7 +593,7 @@ export function Train3DVisualization({ schedule, onClose }: Train3DVisualization
|
||||
host.appendChild(renderer.domElement);
|
||||
|
||||
// lights: bright sunny day
|
||||
scene.add(new THREE.HemisphereLight(0xcfe8ff, 0xcaa878, 1.0));
|
||||
scene.add(new THREE.HemisphereLight(0xcfe8ff, 0x6f9c4e, 1.0));
|
||||
const sun = new THREE.DirectionalLight(0xfff4d6, 2.4);
|
||||
sun.position.set(-120, 180, 90);
|
||||
scene.add(sun);
|
||||
|
||||
Reference in New Issue
Block a user