Files
the-nexus/modules/utils/geometry.js
Alexander Whitestone 75e51619df WIP: Claude Code progress on #414
Automated salvage commit — agent session ended (exit 124).
Work in progress, may need continuation.
2026-03-24 18:22:39 -04:00

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);
}