Add retro diner kiosk scenery with beat-reactive neon signage
- Build a wireframe diner kiosk (facade, serving hatch, rooftop star, pylon sign, gas pump, shrubs) via makeDinerKiosk() - Place two mirrored kiosks on opposite lanes far apart so one appears only occasionally - Reuse the existing palm-tree scroll/recycle pass by pushing kiosks into palmTrees with a longer recycleZ spacing - Drive neonRed and warmGlow material opacity from beat energy so signage flickers brighter on the bass
This commit is contained in:
parent
a0de5649ef
commit
8d1dfb03d4
|
|
@ -736,6 +736,114 @@ if (canvas) {
|
||||||
shooting.active = true;
|
shooting.active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------- Retro diner kiosk (white body, neon-red signage) ----------
|
||||||
|
const kioskWhite = new THREE.LineBasicMaterial({ color: 0xe9edf3, transparent: true, opacity: 0.8 });
|
||||||
|
const neonRed = new THREE.LineBasicMaterial({ color: 0xff2b4a, transparent: true, opacity: 0.9 });
|
||||||
|
const warmGlow = new THREE.LineBasicMaterial({ color: 0xffc46b, transparent: true, opacity: 0.75 });
|
||||||
|
const shrubGreen = new THREE.LineBasicMaterial({ color: 0x3fd68f, transparent: true, opacity: 0.55 });
|
||||||
|
|
||||||
|
function starPts(rOut, rIn, n = 5) {
|
||||||
|
const pts = [];
|
||||||
|
for (let i = 0; i < n * 2; i++) {
|
||||||
|
const r = i % 2 === 0 ? rOut : rIn;
|
||||||
|
const a = (i / (n * 2)) * Math.PI * 2 - Math.PI / 2;
|
||||||
|
pts.push(new THREE.Vector3(Math.cos(a) * r, Math.sin(a) * r, 0));
|
||||||
|
}
|
||||||
|
return pts;
|
||||||
|
}
|
||||||
|
|
||||||
|
function rectRing(group, mat, w, d, y, cx = 0, cz = 0) {
|
||||||
|
const h = w / 2, k = d / 2;
|
||||||
|
return addLoop(group, mat, [V3(cx + h, y, cz + k), V3(cx - h, y, cz + k), V3(cx - h, y, cz - k), V3(cx + h, y, cz - k)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeDinerKiosk() {
|
||||||
|
const g = new THREE.Group(); // ground at y=0, front facing +Z (toward the camera)
|
||||||
|
|
||||||
|
// ---- Kiosk building: main box + stepped crown ----
|
||||||
|
addPart(g, kioskWhite, new THREE.BoxGeometry(6, 3.2, 4), 0, 1.6, 0);
|
||||||
|
addPart(g, kioskWhite, new THREE.BoxGeometry(6.6, 0.25, 4.6), 0, 3.32, 0);
|
||||||
|
addPart(g, kioskWhite, new THREE.BoxGeometry(4.4, 0.3, 3.0), 0, 3.62, -0.3);
|
||||||
|
rectRing(g, neonRed, 6.6, 4.6, 3.46); // neon roofline
|
||||||
|
|
||||||
|
// ---- Front facade ----
|
||||||
|
// Round diner window with warm interior glow
|
||||||
|
const roundWin = new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(circlePtsZ(0.8, 12)), kioskWhite);
|
||||||
|
roundWin.position.set(-1.5, 2.0, 2.01); g.add(roundWin);
|
||||||
|
const roundGlass = new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(circlePtsZ(0.62, 12)), warmGlow);
|
||||||
|
roundGlass.position.set(-1.5, 2.0, 2.02); g.add(roundGlass);
|
||||||
|
|
||||||
|
// Serving hatch: frame, glowing glass, counter ledge, neon awning
|
||||||
|
addPart(g, kioskWhite, new THREE.BoxGeometry(1.9, 1.3, 0.06), 1.5, 1.7, 2.01);
|
||||||
|
addPart(g, warmGlow, new THREE.BoxGeometry(1.55, 1.0, 0.03), 1.5, 1.68, 2.03);
|
||||||
|
addPart(g, kioskWhite, new THREE.BoxGeometry(2.2, 0.12, 0.7), 1.5, 0.9, 2.3);
|
||||||
|
addPart(g, neonRed, new THREE.BoxGeometry(2.4, 0.1, 1.1), 1.5, 2.75, 2.55, -0.35, 0, 0);
|
||||||
|
|
||||||
|
// Door with window, knob and step
|
||||||
|
addPart(g, kioskWhite, new THREE.BoxGeometry(0.95, 2.1, 0.06), -2.7, 1.05, 2.01);
|
||||||
|
addPart(g, warmGlow, new THREE.BoxGeometry(0.55, 0.75, 0.03), -2.7, 1.6, 2.03);
|
||||||
|
const knob = new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(circlePtsZ(0.06, 8)), kioskWhite);
|
||||||
|
knob.position.set(-2.35, 0.95, 2.05); g.add(knob);
|
||||||
|
addPart(g, kioskWhite, new THREE.BoxGeometry(1.3, 0.12, 0.6), -2.7, 0.06, 2.35);
|
||||||
|
|
||||||
|
// Menu board with "text" lines
|
||||||
|
addPart(g, kioskWhite, new THREE.BoxGeometry(1.2, 0.85, 0.05), 2.45, 2.3, 2.01);
|
||||||
|
for (const my of [2.55, 2.35, 2.15]) {
|
||||||
|
addPart(g, warmGlow, new THREE.BoxGeometry(0.85, 0.05, 0.02), 2.45, my, 2.03);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Rooftop star sign ----
|
||||||
|
addPart(g, kioskWhite, new THREE.CylinderGeometry(0.06, 0.06, 1.3, 5), 0, 4.4, -0.3);
|
||||||
|
const roofStar = new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(starPts(0.75, 0.3)), neonRed);
|
||||||
|
roofStar.position.set(0, 5.55, -0.3); g.add(roofStar);
|
||||||
|
|
||||||
|
// ---- Tower pylon sign: pole, twin disc, neon star ----
|
||||||
|
addPart(g, kioskWhite, new THREE.CylinderGeometry(0.09, 0.09, 6.4, 6), -4.6, 3.2, 0.6);
|
||||||
|
const pylonDisc = new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(circlePtsZ(1.25, 14)), kioskWhite);
|
||||||
|
pylonDisc.position.set(-4.6, 5.3, 0.6); g.add(pylonDisc);
|
||||||
|
const pylonInner = new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(circlePtsZ(0.95, 12)), neonRed);
|
||||||
|
pylonInner.position.set(-4.6, 5.3, 0.62); g.add(pylonInner);
|
||||||
|
const pylonStar = new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(starPts(0.6, 0.24)), neonRed);
|
||||||
|
pylonStar.position.set(-4.6, 5.3, 0.64); g.add(pylonStar);
|
||||||
|
const pylonCap = new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(circlePtsZ(0.18, 8)), neonRed);
|
||||||
|
pylonCap.position.set(-4.6, 6.5, 0.6); g.add(pylonCap);
|
||||||
|
|
||||||
|
// ---- Gas pump station: canopy, posts, pump ----
|
||||||
|
addPart(g, kioskWhite, new THREE.BoxGeometry(2.8, 0.16, 2.0), 5.0, 2.7, 0.4);
|
||||||
|
rectRing(g, neonRed, 2.8, 2.0, 2.58, 5.0, 0.4); // canopy neon edge
|
||||||
|
addPart(g, kioskWhite, new THREE.CylinderGeometry(0.07, 0.07, 2.7, 5), 6.1, 1.35, -0.25);
|
||||||
|
addPart(g, kioskWhite, new THREE.CylinderGeometry(0.07, 0.07, 2.7, 5), 6.1, 1.35, 1.05);
|
||||||
|
rectRing(g, kioskWhite, 2.6, 1.8, 0.02, 5.0, 0.4); // pump pad
|
||||||
|
addPart(g, kioskWhite, new THREE.BoxGeometry(0.75, 0.18, 0.55), 5.0, 0.09, 0.4); // pump base
|
||||||
|
addPart(g, kioskWhite, new THREE.BoxGeometry(0.55, 1.0, 0.38), 5.0, 0.68, 0.4); // pump body
|
||||||
|
const meter = new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(circlePtsZ(0.2, 8)), warmGlow);
|
||||||
|
meter.position.set(5.0, 0.95, 0.61); g.add(meter);
|
||||||
|
const pumpTop = new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(circlePtsZ(0.2, 8)), neonRed);
|
||||||
|
pumpTop.position.set(5.0, 1.22, 0.4); g.add(pumpTop);
|
||||||
|
addPart(g, kioskWhite, new THREE.BoxGeometry(0.1, 0.32, 0.1), 5.3, 0.75, 0.4); // nozzle
|
||||||
|
|
||||||
|
// ---- Shrubs for a touch of life ----
|
||||||
|
const shrubA = new THREE.LineSegments(new THREE.EdgesGeometry(new THREE.IcosahedronGeometry(0.4, 0)), shrubGreen);
|
||||||
|
shrubA.position.set(-3.7, 0.3, 2.6); g.add(shrubA);
|
||||||
|
const shrubB = new THREE.LineSegments(new THREE.EdgesGeometry(new THREE.IcosahedronGeometry(0.45, 0)), shrubGreen);
|
||||||
|
shrubB.position.set(3.5, 0.35, 2.5); g.add(shrubB);
|
||||||
|
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Two kiosks on opposite lanes, far apart so one shows up only occasionally
|
||||||
|
const kioskA = makeDinerKiosk();
|
||||||
|
kioskA.position.set(20, 0, -40);
|
||||||
|
const kioskB = makeDinerKiosk();
|
||||||
|
kioskB.position.set(-20, 0, -130);
|
||||||
|
kioskB.scale.x = -1; // mirrored so its sign side faces the road
|
||||||
|
for (const k of [kioskA, kioskB]) {
|
||||||
|
k.userData.baseX = k.position.x;
|
||||||
|
k.userData.recycleZ = -180; // long spacing = "occasional"
|
||||||
|
scene.add(k);
|
||||||
|
palmTrees.push(k); // reuse the same scroll & recycle pass
|
||||||
|
}
|
||||||
|
|
||||||
// ---------- Beat / bass reactivity surface ----------
|
// ---------- Beat / bass reactivity surface ----------
|
||||||
const state = {
|
const state = {
|
||||||
beat: 0, // smoothed bass energy 0..1
|
beat: 0, // smoothed bass energy 0..1
|
||||||
|
|
@ -797,7 +905,7 @@ if (canvas) {
|
||||||
t.position.x += dt * speed * Math.sin(state.dirAngle);
|
t.position.x += dt * speed * Math.sin(state.dirAngle);
|
||||||
t.position.z += dt * speed * Math.cos(state.dirAngle);
|
t.position.z += dt * speed * Math.cos(state.dirAngle);
|
||||||
if (t.position.z > 15) {
|
if (t.position.z > 15) {
|
||||||
t.position.z = -54;
|
t.position.z = t.userData.recycleZ || -54;
|
||||||
t.position.x = t.userData.baseX; // snap back to column lane on recycle
|
t.position.x = t.userData.baseX; // snap back to column lane on recycle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -818,6 +926,10 @@ if (canvas) {
|
||||||
beamMat.opacity = 0.1 + state.beat * 0.14;
|
beamMat.opacity = 0.1 + state.beat * 0.14;
|
||||||
poolMat.opacity = 0.3 + state.beat * 0.45;
|
poolMat.opacity = 0.3 + state.beat * 0.45;
|
||||||
|
|
||||||
|
// Diner kiosk: neon signage flickers brighter on the beat
|
||||||
|
neonRed.opacity = 0.7 + state.beat * 0.3;
|
||||||
|
warmGlow.opacity = 0.55 + state.beat * 0.4;
|
||||||
|
|
||||||
// Equalizer skyline: idle shimmer + bass-driven growth
|
// Equalizer skyline: idle shimmer + bass-driven growth
|
||||||
const eqPos = eqGeo.attributes.position;
|
const eqPos = eqGeo.attributes.position;
|
||||||
for (let i = 0; i < EQ_BARS; i++) {
|
for (let i = 0; i < EQ_BARS; i++) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue