feat: implement glowing memory orbs and fix portal duplication bug
This commit is contained in:
17
app.js
17
app.js
@@ -3129,3 +3129,20 @@ init().then(() => {
|
||||
connectMemPalace();
|
||||
mineMemPalaceContent();
|
||||
});
|
||||
|
||||
// Project Mnemosyne — Holographic Memory
|
||||
function spawnMemoryOrb(position, color = 0x4af0c0, size = 0.5) {
|
||||
const geometry = new THREE.SphereGeometry(size, 32, 32);
|
||||
const material = new THREE.MeshPhongMaterial({
|
||||
color: color,
|
||||
emissive: color,
|
||||
emissiveIntensity: 2,
|
||||
transparent: true,
|
||||
opacity: 0.8,
|
||||
shininess: 100
|
||||
});
|
||||
const orb = new THREE.Mesh(geometry, material);
|
||||
orb.position.copy(position);
|
||||
orb.userData.pulse = 0;
|
||||
return orb;
|
||||
}
|
||||
|
||||
@@ -503,6 +503,11 @@ export function getSceneObjectCount() {
|
||||
export function addPortal(def) {
|
||||
if (!scene || !def.id) return false;
|
||||
|
||||
// Remove existing portal if it already exists to prevent duplication
|
||||
if (registry.has(def.id)) {
|
||||
removePortal(def.id);
|
||||
}
|
||||
|
||||
const color = def.color != null ? parseColor(def.color) : 0x00ffaa;
|
||||
const s = def.scale ?? 1;
|
||||
const group = new THREE.Group();
|
||||
|
||||
@@ -193,9 +193,13 @@ function handleMemoryEvent(msg) {
|
||||
geometry: 'sphere',
|
||||
position: { x: pos.x + (Math.random() - 0.5) * 5, y: 1, z: pos.z + (Math.random() - 0.5) * 5 },
|
||||
material: {
|
||||
type: 'physical',
|
||||
color: categoryColors[data.category] || 0xcccccc,
|
||||
emissive: categoryColors[data.category] || 0xcccccc,
|
||||
emissiveIntensity: 2,
|
||||
emissiveIntensity: 3,
|
||||
transmission: 0.6,
|
||||
roughness: 0.1,
|
||||
metalness: 0.1,
|
||||
opacity: 0.8,
|
||||
},
|
||||
scale: 0.2 + (data.trust_score || 0.5) * 0.5,
|
||||
|
||||
Reference in New Issue
Block a user