helixmind 0.2.25 → 0.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/cli/brain/template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/cli/brain/template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAimE3D"}
|
|
@@ -593,18 +593,144 @@ const EDGE_COLORS = {
|
|
|
593
593
|
belongs_to: '#ff6600', part_of: '#ff6600', supersedes: '#ff4444',
|
|
594
594
|
default: '#334466',
|
|
595
595
|
};
|
|
596
|
-
//
|
|
597
|
-
//
|
|
598
|
-
//
|
|
599
|
-
const
|
|
600
|
-
1: {
|
|
601
|
-
2: {
|
|
602
|
-
3: {
|
|
603
|
-
4: {
|
|
604
|
-
5: {
|
|
605
|
-
6: {
|
|
596
|
+
// V6: Galaxy Brain — Force-directed 3D graph like a neural galaxy
|
|
597
|
+
// Nodes positioned by connections (force layout), not by layer planes
|
|
598
|
+
// Render style per level (size, pulse, activity) but NO spatial separation
|
|
599
|
+
const LEVEL_STYLE = {
|
|
600
|
+
1: { size: 14, pulse: 2.0, activity: 1.0 },
|
|
601
|
+
2: { size: 13, pulse: 1.5, activity: 0.85 },
|
|
602
|
+
3: { size: 11, pulse: 1.0, activity: 0.7 },
|
|
603
|
+
4: { size: 10, pulse: 0.6, activity: 0.5 },
|
|
604
|
+
5: { size: 9, pulse: 0.3, activity: 0.3 },
|
|
605
|
+
6: { size: 12, pulse: 0.8, activity: 0.7 },
|
|
606
606
|
};
|
|
607
|
-
const MAX_RENDERED_EDGES =
|
|
607
|
+
const MAX_RENDERED_EDGES = 12000; // more edges visible in galaxy layout
|
|
608
|
+
|
|
609
|
+
// Force-directed layout: positions nodes based on their connections
|
|
610
|
+
function computeForceLayout(nodeList, edgeList, nodeIdxMapLocal) {
|
|
611
|
+
const N = nodeList.length;
|
|
612
|
+
if (N === 0) return [];
|
|
613
|
+
|
|
614
|
+
const pos = new Array(N);
|
|
615
|
+
// Initialize positions in a sphere with level-based shells
|
|
616
|
+
for (let i = 0; i < N; i++) {
|
|
617
|
+
const lv = nodeList[i].level || 3;
|
|
618
|
+
// L1-L5: inner to outer, L6: outer orbit
|
|
619
|
+
const shell = lv === 6 ? 1.1 : (lv * 0.18 + 0.1);
|
|
620
|
+
const R = 200 * shell;
|
|
621
|
+
// Golden angle spiral for even distribution
|
|
622
|
+
const golden = 2.399963; // Math.PI * (3 - Math.sqrt(5))
|
|
623
|
+
const theta = golden * i;
|
|
624
|
+
const phi = Math.acos(1 - 2 * (i + 0.5) / N);
|
|
625
|
+
pos[i] = {
|
|
626
|
+
x: R * Math.sin(phi) * Math.cos(theta) + (srand(i * 7) - 0.5) * 30,
|
|
627
|
+
y: R * Math.cos(phi) + (srand(i * 13) - 0.5) * 30,
|
|
628
|
+
z: R * Math.sin(phi) * Math.sin(theta) + (srand(i * 19) - 0.5) * 30
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
// Build adjacency for force computation
|
|
633
|
+
const adjList = new Array(N);
|
|
634
|
+
for (let i = 0; i < N; i++) adjList[i] = [];
|
|
635
|
+
for (const e of edgeList) {
|
|
636
|
+
const si = nodeIdxMapLocal[e.source];
|
|
637
|
+
const ti = nodeIdxMapLocal[e.target];
|
|
638
|
+
if (si !== undefined && ti !== undefined) {
|
|
639
|
+
adjList[si].push(ti);
|
|
640
|
+
adjList[ti].push(si);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// Force simulation: 50 iterations
|
|
645
|
+
const ITERATIONS = 50;
|
|
646
|
+
const REPULSION = 8000;
|
|
647
|
+
const ATTRACTION = 0.008;
|
|
648
|
+
const CENTERING = 0.002;
|
|
649
|
+
const DAMPING = 0.85;
|
|
650
|
+
const K_SAMPLES = Math.min(N, 25); // random sample for repulsion
|
|
651
|
+
|
|
652
|
+
const vel = new Array(N);
|
|
653
|
+
for (let i = 0; i < N; i++) vel[i] = { x: 0, y: 0, z: 0 };
|
|
654
|
+
|
|
655
|
+
for (let iter = 0; iter < ITERATIONS; iter++) {
|
|
656
|
+
const temp = 1.0 - iter / ITERATIONS; // cooling
|
|
657
|
+
const repScale = REPULSION * temp;
|
|
658
|
+
|
|
659
|
+
for (let i = 0; i < N; i++) {
|
|
660
|
+
let fx = 0, fy = 0, fz = 0;
|
|
661
|
+
|
|
662
|
+
// Repulsion: random sample K nodes
|
|
663
|
+
for (let k = 0; k < K_SAMPLES; k++) {
|
|
664
|
+
const j = Math.floor(srand(iter * 10007 + i * 997 + k * 31) * N);
|
|
665
|
+
if (j === i) continue;
|
|
666
|
+
const dx = pos[i].x - pos[j].x;
|
|
667
|
+
const dy = pos[i].y - pos[j].y;
|
|
668
|
+
const dz = pos[i].z - pos[j].z;
|
|
669
|
+
const distSq = dx * dx + dy * dy + dz * dz + 1;
|
|
670
|
+
const f = repScale / distSq;
|
|
671
|
+
const dist = Math.sqrt(distSq);
|
|
672
|
+
fx += (dx / dist) * f;
|
|
673
|
+
fy += (dy / dist) * f;
|
|
674
|
+
fz += (dz / dist) * f;
|
|
675
|
+
}
|
|
676
|
+
// Scale repulsion by N/K_SAMPLES for unbiased estimate
|
|
677
|
+
const repBias = N / K_SAMPLES;
|
|
678
|
+
fx *= repBias; fy *= repBias; fz *= repBias;
|
|
679
|
+
|
|
680
|
+
// Attraction: pull toward connected nodes
|
|
681
|
+
for (const j of adjList[i]) {
|
|
682
|
+
const dx = pos[j].x - pos[i].x;
|
|
683
|
+
const dy = pos[j].y - pos[i].y;
|
|
684
|
+
const dz = pos[j].z - pos[i].z;
|
|
685
|
+
const dist = Math.sqrt(dx * dx + dy * dy + dz * dz + 1);
|
|
686
|
+
const f = ATTRACTION * dist;
|
|
687
|
+
fx += (dx / dist) * f;
|
|
688
|
+
fy += (dy / dist) * f;
|
|
689
|
+
fz += (dz / dist) * f;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// Centering force
|
|
693
|
+
fx -= pos[i].x * CENTERING;
|
|
694
|
+
fy -= pos[i].y * CENTERING;
|
|
695
|
+
fz -= pos[i].z * CENTERING;
|
|
696
|
+
|
|
697
|
+
vel[i].x = (vel[i].x + fx) * DAMPING;
|
|
698
|
+
vel[i].y = (vel[i].y + fy) * DAMPING;
|
|
699
|
+
vel[i].z = (vel[i].z + fz) * DAMPING;
|
|
700
|
+
|
|
701
|
+
// Cap velocity
|
|
702
|
+
const maxV = 30 * temp + 2;
|
|
703
|
+
const vLen = Math.sqrt(vel[i].x * vel[i].x + vel[i].y * vel[i].y + vel[i].z * vel[i].z);
|
|
704
|
+
if (vLen > maxV) {
|
|
705
|
+
vel[i].x = vel[i].x / vLen * maxV;
|
|
706
|
+
vel[i].y = vel[i].y / vLen * maxV;
|
|
707
|
+
vel[i].z = vel[i].z / vLen * maxV;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// Apply velocities
|
|
712
|
+
for (let i = 0; i < N; i++) {
|
|
713
|
+
pos[i].x += vel[i].x;
|
|
714
|
+
pos[i].y += vel[i].y;
|
|
715
|
+
pos[i].z += vel[i].z;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
// Scale to fit nicely (target radius ~400)
|
|
720
|
+
let maxDist = 0;
|
|
721
|
+
for (let i = 0; i < N; i++) {
|
|
722
|
+
const d = Math.sqrt(pos[i].x * pos[i].x + pos[i].y * pos[i].y + pos[i].z * pos[i].z);
|
|
723
|
+
if (d > maxDist) maxDist = d;
|
|
724
|
+
}
|
|
725
|
+
const scale = maxDist > 0 ? 400 / maxDist : 1;
|
|
726
|
+
for (let i = 0; i < N; i++) {
|
|
727
|
+
pos[i].x *= scale;
|
|
728
|
+
pos[i].y *= scale;
|
|
729
|
+
pos[i].z *= scale;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
return pos;
|
|
733
|
+
}
|
|
608
734
|
|
|
609
735
|
function srand(s) { const x = Math.sin(s * 9301 + 49297) * 49297; return x - Math.floor(x); }
|
|
610
736
|
function escapeHtml(s) { return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); }
|
|
@@ -617,21 +743,19 @@ document.body.prepend(renderer.domElement);
|
|
|
617
743
|
|
|
618
744
|
const scene = new THREE.Scene();
|
|
619
745
|
scene.background = new THREE.Color('#030308');
|
|
620
|
-
scene.fog = new THREE.FogExp2('#030308', 0.
|
|
746
|
+
scene.fog = new THREE.FogExp2('#030308', 0.0003);
|
|
621
747
|
|
|
622
748
|
const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 12000);
|
|
623
|
-
camera.position.set(
|
|
749
|
+
camera.position.set(600, 350, 600);
|
|
624
750
|
|
|
625
751
|
const controls = new OrbitControls(camera, renderer.domElement);
|
|
626
752
|
controls.target.set(0, 0, 0);
|
|
627
753
|
controls.enableDamping = true;
|
|
628
754
|
controls.dampingFactor = 0.06;
|
|
629
755
|
controls.autoRotate = true;
|
|
630
|
-
controls.autoRotateSpeed = 0.
|
|
756
|
+
controls.autoRotateSpeed = 0.12;
|
|
631
757
|
controls.minDistance = 80;
|
|
632
758
|
controls.maxDistance = 4000;
|
|
633
|
-
controls.maxPolarAngle = Math.PI * 0.85;
|
|
634
|
-
controls.minPolarAngle = Math.PI * 0.15;
|
|
635
759
|
controls.update();
|
|
636
760
|
|
|
637
761
|
// =========== BACKGROUND STARS ===========
|
|
@@ -673,12 +797,11 @@ const nodeMat = new THREE.ShaderMaterial({
|
|
|
673
797
|
void main(){
|
|
674
798
|
vColor = aColor;
|
|
675
799
|
vActivity = aActivity;
|
|
676
|
-
float breath = 1.0 + sin(uTime * aPulse + position.x * .008 + position.z * .006) * (.
|
|
800
|
+
float breath = 1.0 + sin(uTime * aPulse + position.x * .008 + position.z * .006) * (.06 + aActivity * .10);
|
|
677
801
|
vec3 pos = position;
|
|
678
|
-
|
|
679
|
-
pos.
|
|
680
|
-
pos.
|
|
681
|
-
pos.z += cos(uTime * .08 + position.x * .004) * aActivity * 3.0;
|
|
802
|
+
pos.y += sin(uTime * (.3 + aActivity * .2) + position.x * .01 + position.z * .015) * (2.0 + aActivity * 3.0);
|
|
803
|
+
pos.x += sin(uTime * .08 + position.z * .003) * aActivity * 2.0;
|
|
804
|
+
pos.z += cos(uTime * .06 + position.x * .003) * aActivity * 2.0;
|
|
682
805
|
vAlpha = aHighlight;
|
|
683
806
|
vec4 mv = modelViewMatrix * vec4(pos, 1.0);
|
|
684
807
|
gl_PointSize = aSize * breath * aHighlight * (500.0 / -mv.z);
|
|
@@ -693,13 +816,13 @@ const nodeMat = new THREE.ShaderMaterial({
|
|
|
693
816
|
vec2 c = gl_PointCoord - vec2(.5);
|
|
694
817
|
float d = length(c);
|
|
695
818
|
if(d > .5) discard;
|
|
696
|
-
float act = 0.
|
|
697
|
-
float core = exp(-d*d*
|
|
698
|
-
float g1 = exp(-d*d*
|
|
699
|
-
float g2 = exp(-d*d*
|
|
700
|
-
float g3 = exp(-d*d*
|
|
819
|
+
float act = 0.5 + vActivity * 0.5;
|
|
820
|
+
float core = exp(-d*d*120.0) * (0.6 + act * 0.4);
|
|
821
|
+
float g1 = exp(-d*d*20.0) * .4 * act;
|
|
822
|
+
float g2 = exp(-d*d*5.0) * .15 * act;
|
|
823
|
+
float g3 = exp(-d*d*1.5) * .05;
|
|
701
824
|
float i = core + g1 + g2 + g3;
|
|
702
|
-
gl_FragColor = vec4(vColor * (1.0 + core * .
|
|
825
|
+
gl_FragColor = vec4(vColor * (1.0 + core * .4), i * vAlpha);
|
|
703
826
|
}
|
|
704
827
|
\`,
|
|
705
828
|
transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,
|
|
@@ -733,38 +856,6 @@ const particleMat = new THREE.PointsMaterial({
|
|
|
733
856
|
blending: THREE.AdditiveBlending, depthWrite: false, sizeAttenuation: true
|
|
734
857
|
});
|
|
735
858
|
|
|
736
|
-
// Fog nebula material — very soft, large, dim particles for volumetric clouds
|
|
737
|
-
const fogMat = new THREE.ShaderMaterial({
|
|
738
|
-
uniforms: { uTime: { value: 0 } },
|
|
739
|
-
vertexShader: \`
|
|
740
|
-
attribute float aSize;
|
|
741
|
-
attribute vec3 aColor;
|
|
742
|
-
varying vec3 vColor;
|
|
743
|
-
uniform float uTime;
|
|
744
|
-
void main(){
|
|
745
|
-
vColor = aColor;
|
|
746
|
-
vec3 pos = position;
|
|
747
|
-
pos.x += sin(uTime * 0.05 + position.y * 0.003 + position.z * 0.002) * 12.0;
|
|
748
|
-
pos.z += cos(uTime * 0.04 + position.y * 0.004 + position.x * 0.002) * 12.0;
|
|
749
|
-
pos.y += sin(uTime * 0.06 + position.x * 0.002) * 6.0;
|
|
750
|
-
vec4 mv = modelViewMatrix * vec4(pos, 1.0);
|
|
751
|
-
gl_PointSize = aSize * (400.0 / -mv.z);
|
|
752
|
-
gl_Position = projectionMatrix * mv;
|
|
753
|
-
}
|
|
754
|
-
\`,
|
|
755
|
-
fragmentShader: \`
|
|
756
|
-
varying vec3 vColor;
|
|
757
|
-
void main(){
|
|
758
|
-
vec2 c = gl_PointCoord - vec2(.5);
|
|
759
|
-
float d = length(c);
|
|
760
|
-
if(d > .5) discard;
|
|
761
|
-
float glow = exp(-d*d*2.0) * .35 + exp(-d*d*0.5) * .18;
|
|
762
|
-
gl_FragColor = vec4(vColor, glow);
|
|
763
|
-
}
|
|
764
|
-
\`,
|
|
765
|
-
transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,
|
|
766
|
-
});
|
|
767
|
-
|
|
768
859
|
// =========== SCENE OBJECTS (rebuilt by rebuildScene) ===========
|
|
769
860
|
let nodePoints = null;
|
|
770
861
|
let nodeGeo = null;
|
|
@@ -772,8 +863,6 @@ let edgeLines = null;
|
|
|
772
863
|
let edgeGeo = null;
|
|
773
864
|
let particlePoints = null;
|
|
774
865
|
let particleGeo = null;
|
|
775
|
-
let fogPoints = null;
|
|
776
|
-
let fogGeo = null;
|
|
777
866
|
|
|
778
867
|
// Data arrays rebuilt per scene
|
|
779
868
|
let nodes = [];
|
|
@@ -787,7 +876,6 @@ let pData = [];
|
|
|
787
876
|
let nCount = 0;
|
|
788
877
|
let eCount = 0;
|
|
789
878
|
let pCount = 0;
|
|
790
|
-
let orbitRings = [];
|
|
791
879
|
|
|
792
880
|
const PARTICLES_PER_EDGE = 3;
|
|
793
881
|
const tc = new THREE.Color();
|
|
@@ -798,9 +886,6 @@ function rebuildScene() {
|
|
|
798
886
|
if (nodeGeo) { nodeGeo.dispose(); scene.remove(nodePoints); }
|
|
799
887
|
if (edgeGeo) { edgeGeo.dispose(); scene.remove(edgeLines); }
|
|
800
888
|
if (particleGeo) { particleGeo.dispose(); scene.remove(particlePoints); }
|
|
801
|
-
if (fogGeo) { fogGeo.dispose(); scene.remove(fogPoints); }
|
|
802
|
-
orbitRings.forEach(r => { r.geometry.dispose(); r.material.dispose(); scene.remove(r); });
|
|
803
|
-
orbitRings = [];
|
|
804
889
|
|
|
805
890
|
nodes = BRAIN_DATA.nodes;
|
|
806
891
|
nCount = nodes.length;
|
|
@@ -813,30 +898,17 @@ function rebuildScene() {
|
|
|
813
898
|
byLevel[lv].push(i);
|
|
814
899
|
});
|
|
815
900
|
|
|
816
|
-
//
|
|
817
|
-
positions = new Array(nCount);
|
|
818
|
-
for (const [lv, indices] of Object.entries(byLevel)) {
|
|
819
|
-
const s = SPATIAL[lv] || SPATIAL[3];
|
|
820
|
-
const c = indices.length;
|
|
821
|
-
indices.forEach((ni, j) => {
|
|
822
|
-
const angle = (j / Math.max(c, 1)) * Math.PI * 2 + (srand(ni * 19) - 0.5) * 1.2;
|
|
823
|
-
const r = s.iR + srand(ni * 7) * (s.oR - s.iR);
|
|
824
|
-
const spiral = angle + r * 0.005 + srand(ni * 23) * 0.8;
|
|
825
|
-
const y = (s.yBase || 0) + (srand(ni * 11) - 0.5) * s.yS;
|
|
826
|
-
// Heavy organic jitter — chaotic like a nebula/universe
|
|
827
|
-
const jitterX = (srand(ni * 29) - 0.5) * r * 0.3;
|
|
828
|
-
const jitterZ = (srand(ni * 37) - 0.5) * r * 0.3;
|
|
829
|
-
positions[ni] = new THREE.Vector3(
|
|
830
|
-
Math.cos(spiral) * r + jitterX + (s.cx || 0),
|
|
831
|
-
y,
|
|
832
|
-
Math.sin(spiral) * r + jitterZ + (s.cz || 0)
|
|
833
|
-
);
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
// Build adjacency + nodeIdxMap
|
|
901
|
+
// Build nodeIdxMap first (needed for force layout)
|
|
838
902
|
nodeIdxMap = {};
|
|
839
903
|
nodes.forEach((n, i) => { nodeIdxMap[n.id] = i; });
|
|
904
|
+
|
|
905
|
+
// Force-directed 3D layout
|
|
906
|
+
const forcePos = computeForceLayout(nodes, BRAIN_DATA.edges, nodeIdxMap);
|
|
907
|
+
positions = new Array(nCount);
|
|
908
|
+
for (let i = 0; i < nCount; i++) {
|
|
909
|
+
const fp = forcePos[i] || { x: 0, y: 0, z: 0 };
|
|
910
|
+
positions[i] = new THREE.Vector3(fp.x, fp.y, fp.z);
|
|
911
|
+
}
|
|
840
912
|
adj = {};
|
|
841
913
|
nodeEdgeMap = {};
|
|
842
914
|
BRAIN_DATA.edges.forEach((e, ei) => {
|
|
@@ -864,7 +936,7 @@ function rebuildScene() {
|
|
|
864
936
|
for (let i = 0; i < nCount; i++) {
|
|
865
937
|
const p = positions[i];
|
|
866
938
|
const n = nodes[i];
|
|
867
|
-
const s =
|
|
939
|
+
const s = LEVEL_STYLE[n.level] || LEVEL_STYLE[3];
|
|
868
940
|
nPos[i * 3] = p.x; nPos[i * 3 + 1] = p.y; nPos[i * 3 + 2] = p.z;
|
|
869
941
|
tc.set(LEVEL_COLORS_HEX[n.level] || 0x00FFFF);
|
|
870
942
|
nCol[i * 3] = tc.r; nCol[i * 3 + 1] = tc.g; nCol[i * 3 + 2] = tc.b;
|
|
@@ -882,64 +954,6 @@ function rebuildScene() {
|
|
|
882
954
|
nodePoints = new THREE.Points(nodeGeo, nodeMat);
|
|
883
955
|
scene.add(nodePoints);
|
|
884
956
|
|
|
885
|
-
// ---- ORBIT RINGS (one per layer, centered at layer's spiral offset) ----
|
|
886
|
-
for (let lv = 1; lv <= 6; lv++) {
|
|
887
|
-
const s = SPATIAL[lv];
|
|
888
|
-
if (!s || !(byLevel[lv] || []).length) continue;
|
|
889
|
-
const ringRadius = s.oR * 0.85;
|
|
890
|
-
const ringGeo = new THREE.RingGeometry(ringRadius - 0.3, ringRadius + 0.3, 96);
|
|
891
|
-
const ringColor = new THREE.Color(LEVEL_COLORS_HEX[lv] || 0x00FFFF);
|
|
892
|
-
const ringMat = new THREE.MeshBasicMaterial({
|
|
893
|
-
color: ringColor, transparent: true, opacity: 0.06 + (s.activity || 0.5) * 0.06, side: THREE.DoubleSide,
|
|
894
|
-
blending: THREE.AdditiveBlending, depthWrite: false,
|
|
895
|
-
});
|
|
896
|
-
const ring = new THREE.Mesh(ringGeo, ringMat);
|
|
897
|
-
ring.rotation.x = -Math.PI / 2;
|
|
898
|
-
ring.position.set(s.cx || 0, s.yBase, s.cz || 0);
|
|
899
|
-
ring.userData.level = lv;
|
|
900
|
-
scene.add(ring);
|
|
901
|
-
orbitRings.push(ring);
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
// ---- FOG NEBULA PARTICLES (volumetric cloud around each layer) ----
|
|
905
|
-
const FOG_PER_LAYER = 80;
|
|
906
|
-
const fogArr = [];
|
|
907
|
-
const ftc = new THREE.Color();
|
|
908
|
-
for (let lv = 1; lv <= 6; lv++) {
|
|
909
|
-
const s = SPATIAL[lv];
|
|
910
|
-
if (!s || !(byLevel[lv] || []).length) continue;
|
|
911
|
-
ftc.set(LEVEL_COLORS_HEX[lv] || 0x00FFFF);
|
|
912
|
-
const act = s.activity || 0.5;
|
|
913
|
-
for (let j = 0; j < FOG_PER_LAYER; j++) {
|
|
914
|
-
const seed = lv * 1000 + j;
|
|
915
|
-
const angle = srand(seed * 67) * Math.PI * 2;
|
|
916
|
-
const r = srand(seed * 73) * s.oR * 1.3;
|
|
917
|
-
fogArr.push({
|
|
918
|
-
x: Math.cos(angle) * r + (s.cx || 0),
|
|
919
|
-
y: s.yBase + (srand(seed * 79) - 0.5) * s.yS * 2.0,
|
|
920
|
-
z: Math.sin(angle) * r + (s.cz || 0),
|
|
921
|
-
cr: ftc.r * (0.15 + act * 0.15), cg: ftc.g * (0.15 + act * 0.15), cb: ftc.b * (0.15 + act * 0.15),
|
|
922
|
-
size: 50 + srand(seed * 83) * 100,
|
|
923
|
-
});
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
const fTotal = fogArr.length;
|
|
927
|
-
fogGeo = new THREE.BufferGeometry();
|
|
928
|
-
const fPos = new Float32Array(fTotal * 3);
|
|
929
|
-
const fCol = new Float32Array(fTotal * 3);
|
|
930
|
-
const fSz = new Float32Array(fTotal);
|
|
931
|
-
for (let i = 0; i < fTotal; i++) {
|
|
932
|
-
const f = fogArr[i];
|
|
933
|
-
fPos[i * 3] = f.x; fPos[i * 3 + 1] = f.y; fPos[i * 3 + 2] = f.z;
|
|
934
|
-
fCol[i * 3] = f.cr; fCol[i * 3 + 1] = f.cg; fCol[i * 3 + 2] = f.cb;
|
|
935
|
-
fSz[i] = f.size;
|
|
936
|
-
}
|
|
937
|
-
fogGeo.setAttribute('position', new THREE.BufferAttribute(fPos, 3));
|
|
938
|
-
fogGeo.setAttribute('aColor', new THREE.BufferAttribute(fCol, 3));
|
|
939
|
-
fogGeo.setAttribute('aSize', new THREE.BufferAttribute(fSz, 1));
|
|
940
|
-
fogPoints = new THREE.Points(fogGeo, fogMat);
|
|
941
|
-
scene.add(fogPoints);
|
|
942
|
-
|
|
943
957
|
// ---- EDGES (LineSegments) ----
|
|
944
958
|
// Prioritize cross-level edges (vertical) over intra-level (horizontal)
|
|
945
959
|
const allEdges = [];
|
|
@@ -967,17 +981,18 @@ function rebuildScene() {
|
|
|
967
981
|
const alphaScale = Math.min(1.0, 3000 / eCount);
|
|
968
982
|
|
|
969
983
|
for (let i = 0; i < eCount; i++) {
|
|
970
|
-
const { si, ti, weight, crossLevel } = validEdges[i];
|
|
984
|
+
const { si, ti, weight, type, crossLevel } = validEdges[i];
|
|
971
985
|
const s = positions[si], t = positions[ti];
|
|
972
986
|
const o = i * 6;
|
|
973
987
|
ePos[o] = s.x; ePos[o + 1] = s.y; ePos[o + 2] = s.z;
|
|
974
988
|
ePos[o + 3] = t.x; ePos[o + 4] = t.y; ePos[o + 5] = t.z;
|
|
975
|
-
|
|
976
|
-
|
|
989
|
+
// Color by edge type for galaxy look
|
|
990
|
+
const edgeColor = EDGE_COLORS[type] || EDGE_COLORS.default;
|
|
991
|
+
sc.set(edgeColor); dc.set(edgeColor);
|
|
977
992
|
eCol[o] = sc.r; eCol[o + 1] = sc.g; eCol[o + 2] = sc.b;
|
|
978
993
|
eCol[o + 3] = dc.r; eCol[o + 4] = dc.g; eCol[o + 5] = dc.b;
|
|
979
|
-
//
|
|
980
|
-
const baseAlpha =
|
|
994
|
+
// Galaxy: all edges visible, weighted by importance
|
|
995
|
+
const baseAlpha = 0.06 + weight * 0.14;
|
|
981
996
|
eAlpha[i * 2] = baseAlpha * alphaScale;
|
|
982
997
|
eAlpha[i * 2 + 1] = baseAlpha * alphaScale;
|
|
983
998
|
}
|
|
@@ -989,13 +1004,13 @@ function rebuildScene() {
|
|
|
989
1004
|
edgeLines = new THREE.LineSegments(edgeGeo, edgeMat);
|
|
990
1005
|
scene.add(edgeLines);
|
|
991
1006
|
|
|
992
|
-
// ---- FLOWING PARTICLES (
|
|
1007
|
+
// ---- FLOWING PARTICLES (on stronger connections) ----
|
|
993
1008
|
pData = [];
|
|
994
1009
|
const maxParticleEdges = Math.min(eCount, 2000);
|
|
995
1010
|
for (let i = 0; i < maxParticleEdges; i++) {
|
|
996
|
-
const { si, ti, weight
|
|
997
|
-
if (
|
|
998
|
-
const particleCount = weight > 0.
|
|
1011
|
+
const { si, ti, weight } = validEdges[i];
|
|
1012
|
+
if (weight < 0.4) continue; // only on stronger connections
|
|
1013
|
+
const particleCount = weight > 0.7 ? 2 : 1;
|
|
999
1014
|
for (let j = 0; j < particleCount; j++) {
|
|
1000
1015
|
pData.push({
|
|
1001
1016
|
edgeIdx: i, progress: srand(i * 100 + j * 31),
|
|
@@ -1145,8 +1160,8 @@ function updateHighlights() {
|
|
|
1145
1160
|
const activeEdgeTypes = getActiveEdgeTypes();
|
|
1146
1161
|
const alphaS = Math.min(1.0, 3000 / eCount);
|
|
1147
1162
|
for (let i = 0; i < eCount; i++) {
|
|
1148
|
-
const { si, ti, weight, type
|
|
1149
|
-
const baseA =
|
|
1163
|
+
const { si, ti, weight, type } = validEdges[i];
|
|
1164
|
+
const baseA = 0.06 + weight * 0.14;
|
|
1150
1165
|
let a = baseA * alphaS;
|
|
1151
1166
|
|
|
1152
1167
|
// Level toggle: hide edges connected to hidden levels
|
|
@@ -1174,11 +1189,6 @@ function updateHighlights() {
|
|
|
1174
1189
|
}
|
|
1175
1190
|
ea.needsUpdate = true;
|
|
1176
1191
|
|
|
1177
|
-
// Update orbit ring visibility
|
|
1178
|
-
orbitRings.forEach(ring => {
|
|
1179
|
-
const lv = ring.userData.level;
|
|
1180
|
-
ring.material.opacity = levelToggles[lv] === false ? 0 : 0.08;
|
|
1181
|
-
});
|
|
1182
1192
|
}
|
|
1183
1193
|
|
|
1184
1194
|
function getActiveEdgeTypes() {
|
|
@@ -1241,7 +1251,7 @@ function closeSidebar(evt) {
|
|
|
1241
1251
|
controls.autoRotate = true;
|
|
1242
1252
|
camTween = {
|
|
1243
1253
|
startPos: camera.position.clone(), startLookAt: controls.target.clone(),
|
|
1244
|
-
targetPos: new THREE.Vector3(
|
|
1254
|
+
targetPos: new THREE.Vector3(600, 350, 600), targetLookAt: new THREE.Vector3(0, 0, 0),
|
|
1245
1255
|
progress: 0
|
|
1246
1256
|
};
|
|
1247
1257
|
}
|
|
@@ -1341,7 +1351,6 @@ function animate() {
|
|
|
1341
1351
|
// Update shader uniforms
|
|
1342
1352
|
nodeMat.uniforms.uTime.value = t;
|
|
1343
1353
|
edgeMat.uniforms.uTime.value = t;
|
|
1344
|
-
fogMat.uniforms.uTime.value = t;
|
|
1345
1354
|
|
|
1346
1355
|
// Camera tween
|
|
1347
1356
|
if (camTween) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/cli/brain/template.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,IAAiB;IACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAEtC,OAAO;;;;;;0CAMiC,IAAI,CAAC,IAAI,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCA2ZxB,IAAI,CAAC,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