Automated salvage commit — agent session ended (exit 124). Work in progress, may need continuation.
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
// modules/utils/geometry.js — Shared geometry helpers
|
|
import * as THREE from 'three';
|
|
|
|
/**
|
|
* Creates a flat horizontal ring (lying in the XZ plane).
|
|
*
|
|
* @param {number} innerR
|
|
* @param {number} outerR
|
|
* @param {number|THREE.Color} color
|
|
* @param {number} [opacity=0.4]
|
|
* @returns {{ mesh: THREE.Mesh, mat: THREE.MeshBasicMaterial }}
|
|
*/
|
|
export function createHorizontalRing(innerR, outerR, color, opacity = 0.4) {
|
|
const geo = new THREE.RingGeometry(innerR, outerR, 64);
|
|
const mat = new THREE.MeshBasicMaterial({
|
|
color, transparent: true, opacity,
|
|
side: THREE.DoubleSide, depthWrite: false,
|
|
});
|
|
const mesh = new THREE.Mesh(geo, mat);
|
|
mesh.rotation.x = -Math.PI / 2;
|
|
return { mesh, mat };
|
|
}
|
|
|
|
/**
|
|
* Creates a thin emissive strip (a very flat box).
|
|
*
|
|
* @param {number} width
|
|
* @param {number|THREE.Color} color
|
|
* @param {number} [opacity=0.55]
|
|
* @returns {THREE.Mesh}
|
|
*/
|
|
export function createGlowStrip(width, color, opacity = 0.55) {
|
|
const geo = new THREE.BoxGeometry(width, 0.035, 0.035);
|
|
const mat = new THREE.MeshBasicMaterial({ color, transparent: true, opacity });
|
|
return new THREE.Mesh(geo, mat);
|
|
}
|