@celestia-island/hikari 0.55.261 → 0.55.263
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.
- package/package.json +1 -1
- package/src/components/HkBoard3D.controls.test.tsx +99 -0
- package/src/components/HkBoard3D.tsx +44 -4
- package/src/components/HkMenu.rail.test.tsx +72 -3
- package/src/components/HkMenu.scss +7 -7
- package/src/components/HkSidebar.scss +14 -10
- package/src/components/HkSidebar.styles.test.ts +55 -10
- package/src/components/HkSidebar.tsx +6 -5
- package/src/components/HkSolarLocationSetting.tsx +3 -3
- package/src/components/HkTimeZoneGlobe.board.test.tsx +263 -0
- package/src/components/HkTimeZoneGlobe.scss +42 -13
- package/src/components/HkTimeZoneGlobe.test.tsx +33 -0
- package/src/components/HkTimeZoneGlobe.tsx +66 -34
- package/src/scene3d/holographicFleetBody.test.ts +214 -90
- package/src/scene3d/holographicFleetBody.ts +327 -231
- package/src/scene3d/holographicFleetScene.test.ts +156 -106
- package/src/scene3d/holographicFleetScene.ts +47 -64
- package/src/theme/solarGlobeMap.ts +1 -1
- package/src/theme/solarTimeZones.ts +6 -6
|
@@ -66,14 +66,6 @@ function collectDisposables(root: THREE.Object3D): {
|
|
|
66
66
|
return { geos, mats };
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
/** Every material this scene builds (the basic/standard Mesh, Line and
|
|
70
|
-
* Sprite materials) carries a `color`. */
|
|
71
|
-
function hasColor(
|
|
72
|
-
material: THREE.Material,
|
|
73
|
-
): material is THREE.Material & { color: THREE.Color } {
|
|
74
|
-
return "color" in material;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
69
|
function stubEngine(): StubEngine {
|
|
78
70
|
const scene = new THREE.Scene();
|
|
79
71
|
const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 4000);
|
|
@@ -621,67 +613,102 @@ describe("buildFleetScene teardown", () => {
|
|
|
621
613
|
});
|
|
622
614
|
|
|
623
615
|
it("dims offline hubs as well as offline nodes", () => {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
616
|
+
// ONE hub in the fleet, built twice from the SAME spec: the palette
|
|
617
|
+
// assigns colours per roster position, so comparing two different
|
|
618
|
+
// bodies would compare two different base colours.
|
|
619
|
+
const spec = buildFleetSceneSpec([{ node_id: "hub-a", tier: 3, station_count: 0 }]);
|
|
620
|
+
const online = stubEngine();
|
|
621
|
+
buildFleetScene(online, callbacks()).update(spec, {});
|
|
622
|
+
const offline = stubEngine();
|
|
623
|
+
buildFleetScene(offline, callbacks()).update(spec, { "hub-a": true });
|
|
631
624
|
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
engine.registered.get(
|
|
635
|
-
if (
|
|
636
|
-
const material =
|
|
637
|
-
if (
|
|
625
|
+
const colorsOf = (engine: StubEngine) => {
|
|
626
|
+
const out: number[] = [];
|
|
627
|
+
engine.registered.get("hub-a")!.object.traverse((o) => {
|
|
628
|
+
if (!(o instanceof THREE.Mesh || o instanceof THREE.Line)) return;
|
|
629
|
+
const material = o.material as THREE.Material & { color?: THREE.Color };
|
|
630
|
+
if (!("color" in material) || !material.color) return;
|
|
631
|
+
out.push(material.color.r);
|
|
638
632
|
});
|
|
639
|
-
|
|
633
|
+
expect(out.length, "coloured materials").toBeGreaterThan(0);
|
|
634
|
+
return out;
|
|
640
635
|
};
|
|
641
|
-
const live =
|
|
642
|
-
const dark =
|
|
643
|
-
expect(
|
|
644
|
-
|
|
636
|
+
const live = colorsOf(online);
|
|
637
|
+
const dark = colorsOf(offline);
|
|
638
|
+
expect(dark.length).toBe(live.length);
|
|
639
|
+
for (let i = 0; i < live.length; i += 1) {
|
|
640
|
+
expect(dark[i], `material ${i} dimmed`).toBeCloseTo(live[i] * 0.3, 5);
|
|
641
|
+
}
|
|
645
642
|
});
|
|
646
643
|
});
|
|
647
644
|
|
|
648
645
|
describe("buildFleetScene body dressing", () => {
|
|
649
|
-
/** The registered group's centre
|
|
646
|
+
/** The registered group's invisible centre proxy (the pick target). */
|
|
650
647
|
function bodyMesh(engine: StubEngine, id: string): THREE.Mesh {
|
|
651
648
|
const group = engine.registered.get(id)!.object;
|
|
652
|
-
const mesh = group.getObjectByName("fleet-hologram-
|
|
649
|
+
const mesh = group.getObjectByName("fleet-hologram-core");
|
|
653
650
|
expect(mesh, `${id} body mesh`).toBeDefined();
|
|
654
651
|
return mesh as THREE.Mesh;
|
|
655
652
|
}
|
|
656
653
|
|
|
657
|
-
it("builds
|
|
654
|
+
it("builds every body as a disc-shell hologram with no solid sphere left", () => {
|
|
658
655
|
const engine = stubEngine();
|
|
659
656
|
const handle = buildFleetScene(engine, callbacks());
|
|
660
657
|
handle.update(buildFleetSceneSpec(ROWS), {});
|
|
661
658
|
|
|
662
|
-
|
|
663
|
-
expect(bodyMesh(engine, "edge-1").geometry).toBeInstanceOf(THREE.DodecahedronGeometry);
|
|
664
|
-
for (const [id, ringCount] of [["hub-a", 3], ["edge-1", 2]] as const) {
|
|
659
|
+
for (const id of ["hub-a", "edge-1", "edge-2"]) {
|
|
665
660
|
const root = engine.registered.get(id)!.object;
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
661
|
+
// User direction 2026-10-31: EVERY solid sphere is replaced — no
|
|
662
|
+
// SphereGeometry anywhere in the scene graph, bodies included.
|
|
663
|
+
const spheres: THREE.Mesh[] = [];
|
|
664
|
+
root.traverse((o) => {
|
|
665
|
+
if (o instanceof THREE.Mesh && o.geometry instanceof THREE.SphereGeometry) {
|
|
666
|
+
spheres.push(o);
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
expect(spheres, `${id} solid spheres`).toHaveLength(0);
|
|
670
|
+
|
|
671
|
+
// The two fused structures: six overlapping shell dials and a
|
|
672
|
+
// fat-centre ring spindle, plus ONE detailed camera-facing dial.
|
|
673
|
+
// (Scoped to the body's own hologram — its satellite holograms
|
|
674
|
+
// carry spindles too.)
|
|
675
|
+
const holograms = root.getObjectsByProperty("name", "fleet-hologram");
|
|
676
|
+
expect(holograms, `${id} body hologram`).toHaveLength(1);
|
|
677
|
+
const hologram = holograms[0]!;
|
|
678
|
+
expect(
|
|
679
|
+
hologram.getObjectsByProperty("name", "fleet-hologram-disc-shell"),
|
|
680
|
+
`${id} disc shell`,
|
|
681
|
+
).toHaveLength(1);
|
|
680
682
|
expect(
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
).toHaveLength(
|
|
683
|
+
hologram.getObjectsByProperty("name", "fleet-hologram-ring-spindle"),
|
|
684
|
+
`${id} ring spindle`,
|
|
685
|
+
).toHaveLength(1);
|
|
686
|
+
expect(
|
|
687
|
+
hologram.getObjectsByProperty("name", "fleet-hologram-front-dial"),
|
|
688
|
+
`${id} front dial`,
|
|
689
|
+
).toHaveLength(1);
|
|
690
|
+
// The legacy polyhedron and its shared wireframe are gone.
|
|
691
|
+
expect(root.getObjectsByProperty("name", "fleet-hologram-polyhedron")).toHaveLength(0);
|
|
692
|
+
expect(root.getObjectsByProperty("name", "fleet-hologram-face-ring")).toHaveLength(0);
|
|
684
693
|
}
|
|
694
|
+
|
|
695
|
+
// Main cores are denser than node cores (hub 9 spindle rings and a
|
|
696
|
+
// 48-tick dial; node 6 and 28) — measured on the body's own hologram,
|
|
697
|
+
// never its satellites'.
|
|
698
|
+
const hub = engine.registered.get("hub-a")!.object
|
|
699
|
+
.getObjectsByProperty("name", "fleet-hologram")[0]!;
|
|
700
|
+
const node = engine.registered.get("edge-1")!.object
|
|
701
|
+
.getObjectsByProperty("name", "fleet-hologram")[0]!;
|
|
702
|
+
const spindleOf = (root: THREE.Object3D) =>
|
|
703
|
+
root.getObjectsByProperty("name", "fleet-hologram-ring-spindle-circle").length;
|
|
704
|
+
const ticksOf = (root: THREE.Object3D) => {
|
|
705
|
+
const ticks = root.getObjectByName("fleet-hologram-face-dial-ticks");
|
|
706
|
+
return ticks ? (ticks as THREE.LineSegments).geometry.getAttribute("position").count / 2 : 0;
|
|
707
|
+
};
|
|
708
|
+
expect(spindleOf(hub)).toBe(9);
|
|
709
|
+
expect(spindleOf(node)).toBe(6);
|
|
710
|
+
expect(ticksOf(hub)).toBe(48);
|
|
711
|
+
expect(ticksOf(node)).toBe(28);
|
|
685
712
|
handle.dispose();
|
|
686
713
|
});
|
|
687
714
|
|
|
@@ -697,15 +724,15 @@ describe("buildFleetScene body dressing", () => {
|
|
|
697
724
|
expect(mats.length).toBeGreaterThan(0);
|
|
698
725
|
const spies = [...geos, ...mats].map((resource) => vi.spyOn(resource, "dispose"));
|
|
699
726
|
|
|
700
|
-
// A refresh rebuilds every body: the previous generation's
|
|
701
|
-
//
|
|
727
|
+
// A refresh rebuilds every body: the previous generation's shells,
|
|
728
|
+
// dials and materials must not survive as GPU garbage.
|
|
702
729
|
handle.update(spec, {});
|
|
703
730
|
for (const spy of spies) expect(spy).toHaveBeenCalledTimes(1);
|
|
704
731
|
expect(engine.registered.get("edge-1")!.object).not.toBe(retired);
|
|
705
732
|
handle.dispose();
|
|
706
733
|
});
|
|
707
734
|
|
|
708
|
-
it("keeps coronas and
|
|
735
|
+
it("keeps coronas and satellites out of recursive picking while the centre stays clickable", () => {
|
|
709
736
|
const starEngine = stubEngine();
|
|
710
737
|
const starHandle = buildFleetScene(starEngine, callbacks());
|
|
711
738
|
const starSpec = buildFleetSceneSpec([{ node_id: "hub-a", tier: 3, station_count: 0 }]);
|
|
@@ -730,29 +757,28 @@ describe("buildFleetScene body dressing", () => {
|
|
|
730
757
|
const handle = buildFleetScene(engine, callbacks());
|
|
731
758
|
handle.update(buildFleetSceneSpec(ROWS), {});
|
|
732
759
|
const group = engine.registered.get("edge-1")!.object;
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
const at = moon!.getWorldPosition(new THREE.Vector3());
|
|
740
|
-
const moonRay = new THREE.Raycaster(
|
|
760
|
+
// Satellites are holograms now (no solid moon mesh): find the first
|
|
761
|
+
// one and confirm it never joins recursive picking.
|
|
762
|
+
const satellites = group.getObjectsByProperty("name", "fleet-hologram-satellite");
|
|
763
|
+
expect(satellites.length).toBeGreaterThan(0);
|
|
764
|
+
const at = satellites[0]!.getWorldPosition(new THREE.Vector3());
|
|
765
|
+
const satelliteRay = new THREE.Raycaster(
|
|
741
766
|
at.clone().add(new THREE.Vector3(0, 0, 10)),
|
|
742
767
|
new THREE.Vector3(0, 0, -1),
|
|
743
768
|
);
|
|
744
|
-
expect(
|
|
769
|
+
expect(satelliteRay.intersectObject(group, true)).toHaveLength(0);
|
|
745
770
|
handle.dispose();
|
|
746
771
|
});
|
|
747
772
|
|
|
748
|
-
it("never resizes a body — the
|
|
773
|
+
it("never resizes a body — the circular marks carry the affordances", () => {
|
|
749
774
|
const engine = stubEngine();
|
|
750
775
|
const handle = buildFleetScene(engine, callbacks());
|
|
751
776
|
handle.update(buildFleetSceneSpec(ROWS), {});
|
|
752
777
|
|
|
753
778
|
// The old hover affordance scaled the body the pointer was aiming at
|
|
754
779
|
// (1.18×, lerped per frame). Nothing may write that scale any more —
|
|
755
|
-
// the
|
|
780
|
+
// the front dial and the selection ring mark bodies without touching
|
|
781
|
+
// their transforms.
|
|
756
782
|
for (const id of ["hub-a", "edge-1"]) {
|
|
757
783
|
expect(bodyMesh(engine, id).scale.x).toBe(1);
|
|
758
784
|
}
|
|
@@ -764,7 +790,7 @@ describe("buildFleetScene body dressing", () => {
|
|
|
764
790
|
handle.dispose();
|
|
765
791
|
});
|
|
766
792
|
|
|
767
|
-
it("dims a gateway's
|
|
793
|
+
it("dims a gateway's satellite holograms with the gateway itself", () => {
|
|
768
794
|
const online = stubEngine();
|
|
769
795
|
buildFleetScene(online, callbacks()).update(buildFleetSceneSpec(ROWS), {});
|
|
770
796
|
const offline = stubEngine();
|
|
@@ -776,45 +802,63 @@ describe("buildFleetScene body dressing", () => {
|
|
|
776
802
|
"edge-1": true,
|
|
777
803
|
});
|
|
778
804
|
|
|
779
|
-
/** Every body- and
|
|
805
|
+
/** Every body- and satellite-material colour under a group (the
|
|
806
|
+
* holograms are lines and planes now — Mesh AND Line both carry a
|
|
807
|
+
* colour). */
|
|
780
808
|
const colors = (engine: StubEngine, id: string) => {
|
|
781
809
|
const out: number[] = [];
|
|
782
810
|
engine.registered.get(id)!.object.traverse((o) => {
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
811
|
+
if (!(o instanceof THREE.Mesh || o instanceof THREE.Line)) return;
|
|
812
|
+
const material = o.material as THREE.Material & { color?: THREE.Color };
|
|
813
|
+
if (!("color" in material) || !material.color) return;
|
|
814
|
+
out.push(material.color.r);
|
|
787
815
|
});
|
|
788
816
|
return out;
|
|
789
817
|
};
|
|
790
818
|
for (const id of ["hub-a", "edge-1"]) {
|
|
791
819
|
const live = colors(online, id);
|
|
792
820
|
const dark = colors(offline, id);
|
|
793
|
-
expect(live.length, `${id} body +
|
|
821
|
+
expect(live.length, `${id} body + satellites`).toBeGreaterThan(1);
|
|
822
|
+
expect(dark.length, `${id} dark structure mirrors live`).toBe(live.length);
|
|
794
823
|
for (let i = 0; i < live.length; i += 1) {
|
|
795
|
-
expect(dark[i], `${id} body/
|
|
824
|
+
expect(dark[i], `${id} body/satellite ${i} dimmed`).toBeCloseTo(live[i] * 0.3, 5);
|
|
796
825
|
}
|
|
797
826
|
}
|
|
798
827
|
});
|
|
799
828
|
|
|
800
|
-
it("
|
|
829
|
+
it("marks the selection with the scene's circular ring, never a corner frame", () => {
|
|
801
830
|
const engine = stubEngine();
|
|
802
831
|
const handle = buildFleetScene(engine, callbacks());
|
|
803
832
|
handle.update(buildFleetSceneSpec(ROWS), {});
|
|
804
833
|
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
834
|
+
const ringOf = (id: string) =>
|
|
835
|
+
engine.registered.get(id)!.object.getObjectByName("fleet-hologram-selection-ring");
|
|
836
|
+
for (const id of ROWS.map((r) => r.node_id)) {
|
|
837
|
+
expect(ringOf(id), `${id} focus ring`).toBeTruthy();
|
|
838
|
+
expect(ringOf(id)!.visible).toBe(false);
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// The board's cube cursor is suppressed for these bodies: the whole
|
|
842
|
+
// story is the per-body circular ring plus `setSelection(null)`.
|
|
808
843
|
handle.setSelected("edge-1");
|
|
809
|
-
expect(engine.selections
|
|
844
|
+
expect(engine.selections.at(-1)).toBe(null);
|
|
845
|
+
expect(ringOf("edge-1")!.visible).toBe(true);
|
|
846
|
+
expect(ringOf("hub-a")!.visible).toBe(false);
|
|
810
847
|
handle.setSelected("hub-a");
|
|
811
|
-
expect(
|
|
848
|
+
expect(ringOf("edge-1")!.visible).toBe(false);
|
|
849
|
+
expect(ringOf("hub-a")!.visible).toBe(true);
|
|
812
850
|
handle.setSelected(null);
|
|
813
|
-
expect(
|
|
851
|
+
expect(ringOf("hub-a")!.visible).toBe(false);
|
|
852
|
+
|
|
853
|
+
// The mark survives a rebuild: the view re-plays setSelected after
|
|
854
|
+
// every update, so the new generation must be able to show it too.
|
|
855
|
+
handle.setSelected("edge-1");
|
|
856
|
+
handle.update(buildFleetSceneSpec(ROWS), {});
|
|
857
|
+
handle.setSelected("edge-1");
|
|
858
|
+
expect(ringOf("edge-1")!.visible).toBe(true);
|
|
814
859
|
|
|
815
|
-
//
|
|
816
|
-
//
|
|
817
|
-
// scene-root children it owns are the two lights and the orbit lines.
|
|
860
|
+
// Every MESH the builder put in the scene lives under a registered
|
|
861
|
+
// body; the only scene-root children it owns are the orbit lines.
|
|
818
862
|
const roots = new Set([...engine.registered.values()].map((d) => d.object));
|
|
819
863
|
for (const child of engine.scene.children) {
|
|
820
864
|
if ((child as THREE.Light).isLight || !(child as THREE.Mesh).isMesh) continue;
|
|
@@ -824,21 +868,20 @@ describe("buildFleetScene body dressing", () => {
|
|
|
824
868
|
}
|
|
825
869
|
|
|
826
870
|
handle.dispose();
|
|
827
|
-
// Dispose never leaves
|
|
871
|
+
// Dispose never leaves a mark pinned on a dead scene.
|
|
828
872
|
expect(engine.selections.at(-1)).toBe(null);
|
|
829
873
|
});
|
|
830
874
|
|
|
831
|
-
it("
|
|
875
|
+
it("opts every body out of the board's corner frames", () => {
|
|
832
876
|
const engine = stubEngine();
|
|
833
877
|
const handle = buildFleetScene(engine, callbacks());
|
|
834
878
|
handle.update(buildFleetSceneSpec(ROWS), {});
|
|
835
879
|
|
|
836
|
-
//
|
|
837
|
-
//
|
|
838
|
-
//
|
|
880
|
+
// Straight-edged brackets — hover AND selection — fight the ring
|
|
881
|
+
// silhouette, so the scene draws its own circular marks instead
|
|
882
|
+
// (user direction 2026-10-31).
|
|
839
883
|
for (const id of ["hub-a", "edge-1"]) {
|
|
840
|
-
|
|
841
|
-
expect(def.frameObject, `${id} frame target`).toBe(bodyMesh(engine, id));
|
|
884
|
+
expect(engine.registered.get(id)!.frameObject, `${id} frame opt-out`).toBeNull();
|
|
842
885
|
}
|
|
843
886
|
handle.dispose();
|
|
844
887
|
});
|
|
@@ -944,29 +987,36 @@ describe("buildFleetScene framing", () => {
|
|
|
944
987
|
handle.dispose();
|
|
945
988
|
});
|
|
946
989
|
|
|
947
|
-
it("builds its
|
|
990
|
+
it("builds its satellites at the radius the enclosure measures", () => {
|
|
948
991
|
const engine = stubEngine();
|
|
949
992
|
const handle = buildFleetScene(engine, callbacks());
|
|
950
993
|
const spec = buildFleetSceneSpec(ROWS);
|
|
951
994
|
handle.update(spec, {});
|
|
952
995
|
|
|
953
|
-
// One constant, two consumers: the drawn
|
|
954
|
-
// literals would let the enclosure under-measure
|
|
955
|
-
|
|
956
|
-
const
|
|
957
|
-
const
|
|
958
|
-
group.
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
996
|
+
// One constant, two consumers: the drawn satellite hologram and
|
|
997
|
+
// `bodyReach`. Two literals would let the enclosure under-measure
|
|
998
|
+
// what it frames.
|
|
999
|
+
const withSatellites = spec.planets.find((p) => p.satellites > 0)!;
|
|
1000
|
+
const group = engine.registered.get(withSatellites.id)!.object;
|
|
1001
|
+
const satellites = group.getObjectsByProperty("name", "fleet-hologram-satellite");
|
|
1002
|
+
expect(satellites.length).toBe(withSatellites.satellites);
|
|
1003
|
+
// Each miniature hologram sits on its pivot at the orbit radius the
|
|
1004
|
+
// spec measures — and its own extent stays within the MOON_RADIUS
|
|
1005
|
+
// constant. Precise mode: the default grows a flat disc's box by √2
|
|
1006
|
+
// when its bounding-box corners pass through a 45° rotation.
|
|
1007
|
+
group.updateMatrixWorld(true);
|
|
1008
|
+
for (const satellite of satellites) {
|
|
1009
|
+
const box = new THREE.Box3().setFromObject(satellite, true);
|
|
1010
|
+
const size = box.getSize(new THREE.Vector3());
|
|
1011
|
+
const center = box.getCenter(new THREE.Vector3());
|
|
1012
|
+
const at = satellite.getWorldPosition(new THREE.Vector3());
|
|
1013
|
+
expect(center.distanceTo(at)).toBeLessThanOrEqual(1e-4);
|
|
1014
|
+
expect(size.length() / 2).toBeLessThanOrEqual(MOON_RADIUS * Math.sqrt(3) + 1e-9);
|
|
1015
|
+
}
|
|
1016
|
+
// …and the reach really accounts for them: the outermost satellite's
|
|
1017
|
+
// orbit plus its own radius is what the enclosure has to cover.
|
|
1018
|
+
const outer = satelliteOrbit(withSatellites.radius, withSatellites.satellites - 1);
|
|
1019
|
+
expect(bodyReach(withSatellites)).toBeGreaterThanOrEqual(outer.radius + MOON_RADIUS);
|
|
970
1020
|
handle.dispose();
|
|
971
1021
|
});
|
|
972
1022
|
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
* HkBoard3D engine.
|
|
4
4
|
*
|
|
5
5
|
* The spec (holographicFleetSpec.ts) is pure; this module is the three.js
|
|
6
|
-
* side:
|
|
7
|
-
* rings, label chips and the
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* side: disc-shell holograms with camera-facing dials, miniature
|
|
7
|
+
* satellite holograms, glow halos, orbit rings, label chips and the
|
|
8
|
+
* per-frame motion/camera tick. The selection mark is the scene's own
|
|
9
|
+
* CIRCULAR focus ring (user direction 2026-10-31): the board's 8-corner
|
|
10
|
+
* cube cursor is suppressed for these bodies because straight corners
|
|
11
|
+
* fight the ring silhouette.
|
|
11
12
|
*
|
|
12
13
|
* Ownership: everything the builder creates is disposed through its
|
|
13
14
|
* handle — geometries, materials, the glow texture and every registered
|
|
@@ -21,6 +22,7 @@ import { fitDistance, lerpPalette } from "../utils/scene3d";
|
|
|
21
22
|
|
|
22
23
|
import {
|
|
23
24
|
makeFleetHologram,
|
|
25
|
+
makeSatelliteHologram,
|
|
24
26
|
poseFleetHologram,
|
|
25
27
|
type FleetHologram,
|
|
26
28
|
} from "./holographicFleetBody";
|
|
@@ -107,8 +109,8 @@ export function buildFleetScene(
|
|
|
107
109
|
callbacks: FleetSceneCallbacks,
|
|
108
110
|
): FleetSceneHandle {
|
|
109
111
|
const bodies = new Map<string, BodyEntry>();
|
|
110
|
-
/** Non-registered decoration (
|
|
111
|
-
*
|
|
112
|
+
/** Non-registered decoration (orbit rings, the core marker) — tracked
|
|
113
|
+
* separately so dispose() can strip them from the scene. */
|
|
112
114
|
const decor: THREE.Object3D[] = [];
|
|
113
115
|
/** The spec the current sky was built from (framing reads it). */
|
|
114
116
|
let lastSpec: FleetSceneSpec | null = null;
|
|
@@ -119,20 +121,10 @@ export function buildFleetScene(
|
|
|
119
121
|
let disposed = false;
|
|
120
122
|
const glowTexture = createGlowTexture();
|
|
121
123
|
|
|
122
|
-
//
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
decor.push(ambient, key);
|
|
127
|
-
engine.scene.add(ambient, key);
|
|
128
|
-
|
|
129
|
-
// The selection mark is the BOARD's cube cursor (user direction
|
|
130
|
-
// 2026-10-01: no ring — the 8-corner frame, pinned for as long as the
|
|
131
|
-
// selection lasts). `setSelected` below hands the id straight to
|
|
132
|
-
// `engine.setSelection`; the board measures the frame once against the
|
|
133
|
-
// body (the same `frameObject` rule the hover frame uses, so coronas
|
|
134
|
-
// and moons stay outside the box), rides the body through its orbit,
|
|
135
|
-
// and re-measures on its own when a roster rebuild swaps the object.
|
|
124
|
+
// No scene lights: every material this builder puts in the scene is
|
|
125
|
+
// unlit (Line, MeshBasic, Sprite). The old lights existed for the
|
|
126
|
+
// solid moons, which are holograms now too (user direction
|
|
127
|
+
// 2026-10-31: replace EVERY solid sphere).
|
|
136
128
|
|
|
137
129
|
function disposeObject(root: THREE.Object3D): void {
|
|
138
130
|
root.traverse((obj) => {
|
|
@@ -151,8 +143,9 @@ export function buildFleetScene(
|
|
|
151
143
|
return;
|
|
152
144
|
}
|
|
153
145
|
// Everything else this builder puts in the scene that owns GPU
|
|
154
|
-
// resources is a Mesh,
|
|
155
|
-
//
|
|
146
|
+
// resources is a Mesh (pick proxies, dial cores, ticker planes),
|
|
147
|
+
// a Line (dial rings, spindle circles, orbit rings) or Points —
|
|
148
|
+
// all three carry `geometry` + `material`.
|
|
156
149
|
if (
|
|
157
150
|
obj instanceof THREE.Mesh ||
|
|
158
151
|
obj instanceof THREE.Line ||
|
|
@@ -217,10 +210,6 @@ export function buildFleetScene(
|
|
|
217
210
|
glow.raycast = () => undefined;
|
|
218
211
|
group.add(glow);
|
|
219
212
|
|
|
220
|
-
// The star lights its own system (an offline hub barely lights it).
|
|
221
|
-
const light = new THREE.PointLight(color, offline ? 25 : 70, 0, 1.8);
|
|
222
|
-
group.add(light);
|
|
223
|
-
|
|
224
213
|
return { spec, group, mesh, hologram, glow, satellites: [] };
|
|
225
214
|
}
|
|
226
215
|
|
|
@@ -236,20 +225,16 @@ export function buildFleetScene(
|
|
|
236
225
|
function addSatellites(entry: BodyEntry, parentRadius: number, offline: boolean): void {
|
|
237
226
|
for (let j = 0; j < entry.spec.satellites; j++) {
|
|
238
227
|
const h = lerpPalette([...SATELLITE_PALETTE], (j + 1) / (entry.spec.satellites + 1));
|
|
239
|
-
// A
|
|
240
|
-
//
|
|
241
|
-
//
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
new THREE.SphereGeometry(MOON_RADIUS, 10, 8),
|
|
246
|
-
new THREE.MeshStandardMaterial({ color, roughness: 0.9, metalness: 0.15 }),
|
|
247
|
-
);
|
|
248
|
-
moon.raycast = () => undefined;
|
|
228
|
+
// A satellite is a miniature hologram riding its gateway: an
|
|
229
|
+
// offline gateway with bright satellites would be the same lie as
|
|
230
|
+
// an offline star burning at full brightness — the hologram dims
|
|
231
|
+
// the WHOLE body from the raw palette colour (no double dimming:
|
|
232
|
+
// the base colour goes in undimmed, like makeFleetHologram).
|
|
233
|
+
const satellite = makeSatelliteHologram(MOON_RADIUS, toColor(h), offline);
|
|
249
234
|
const pivot = new THREE.Group();
|
|
250
|
-
pivot.add(
|
|
235
|
+
pivot.add(satellite);
|
|
251
236
|
const orbit = satelliteOrbit(parentRadius, j);
|
|
252
|
-
|
|
237
|
+
satellite.position.set(orbit.radius, 0, 0);
|
|
253
238
|
pivot.rotation.x = orbit.tilt;
|
|
254
239
|
pivot.userData.orbit = orbit;
|
|
255
240
|
entry.group.add(pivot);
|
|
@@ -283,8 +268,6 @@ export function buildFleetScene(
|
|
|
283
268
|
glow.scale.setScalar(7);
|
|
284
269
|
glow.raycast = () => undefined;
|
|
285
270
|
group.add(glow);
|
|
286
|
-
const light = new THREE.PointLight(0xffe9b8, 80, 0, 1.8);
|
|
287
|
-
group.add(light);
|
|
288
271
|
engine.setObject("__star-system-core__", {
|
|
289
272
|
object: group,
|
|
290
273
|
pickable: false,
|
|
@@ -370,7 +353,6 @@ export function buildFleetScene(
|
|
|
370
353
|
dropRegistryCore();
|
|
371
354
|
for (let i = decor.length - 1; i >= 0; i--) {
|
|
372
355
|
const obj = decor[i];
|
|
373
|
-
if (obj === ambient || obj === key) continue;
|
|
374
356
|
engine.scene.remove(obj);
|
|
375
357
|
disposeObject(obj);
|
|
376
358
|
decor.splice(i, 1);
|
|
@@ -385,11 +367,10 @@ export function buildFleetScene(
|
|
|
385
367
|
bodies.set(star.id, entry);
|
|
386
368
|
engine.setObject(star.id, {
|
|
387
369
|
object: entry.group,
|
|
388
|
-
//
|
|
389
|
-
// the
|
|
390
|
-
//
|
|
391
|
-
|
|
392
|
-
frameObject: entry.mesh,
|
|
370
|
+
// No board frame of any kind: the straight-edged hover bracket
|
|
371
|
+
// fights the ring silhouette, so the scene's own circular marks
|
|
372
|
+
// (front dial + selection ring) carry the affordances instead.
|
|
373
|
+
frameObject: null,
|
|
393
374
|
label: callbacks.makeLabel(star),
|
|
394
375
|
labelOffset: [0, hologramOuterRadius(star) + 0.65, 0],
|
|
395
376
|
marker: "dot",
|
|
@@ -407,8 +388,8 @@ export function buildFleetScene(
|
|
|
407
388
|
engine.scene.add(ring);
|
|
408
389
|
engine.setObject(planet.id, {
|
|
409
390
|
object: entry.group,
|
|
410
|
-
// Same rule as the stars: the
|
|
411
|
-
frameObject:
|
|
391
|
+
// Same rule as the stars: the circular marks, never a bracket.
|
|
392
|
+
frameObject: null,
|
|
412
393
|
label: callbacks.makeLabel(planet),
|
|
413
394
|
labelOffset: [0, hologramOuterRadius(planet) + 0.55, 0],
|
|
414
395
|
marker: "dot",
|
|
@@ -509,7 +490,7 @@ export function buildFleetScene(
|
|
|
509
490
|
if (spec.orbitRadius > 0) {
|
|
510
491
|
entry.group.position.set(...bodyPositionAt(spec, elapsed));
|
|
511
492
|
}
|
|
512
|
-
poseFleetHologram(entry.hologram, elapsed, spec.spinPeriodSec);
|
|
493
|
+
poseFleetHologram(entry.hologram, elapsed, spec.spinPeriodSec, engine.camera.quaternion);
|
|
513
494
|
for (const pivot of entry.satellites) {
|
|
514
495
|
const orbit = pivot.userData.orbit as { periodSec: number; phase: number };
|
|
515
496
|
pivot.rotation.y = orbit.phase + (elapsed / orbit.periodSec) * Math.PI * 2;
|
|
@@ -520,7 +501,9 @@ export function buildFleetScene(
|
|
|
520
501
|
entry.glow.scale.setScalar(base * (1 + 0.06 * Math.sin(elapsed * 0.8 + spec.radius)));
|
|
521
502
|
}
|
|
522
503
|
}
|
|
523
|
-
if (coreHologram)
|
|
504
|
+
if (coreHologram) {
|
|
505
|
+
poseFleetHologram(coreHologram, elapsed, 80, engine.camera.quaternion);
|
|
506
|
+
}
|
|
524
507
|
}
|
|
525
508
|
|
|
526
509
|
removeTick = engine.addTick((dt, elapsed) => {
|
|
@@ -573,14 +556,13 @@ export function buildFleetScene(
|
|
|
573
556
|
followLast.set(p.x, p.y, p.z);
|
|
574
557
|
}
|
|
575
558
|
|
|
576
|
-
// (The selection mark needs nothing here: the
|
|
577
|
-
// rides the
|
|
559
|
+
// (The selection mark needs nothing here: the circular focus ring
|
|
560
|
+
// lives INSIDE each body's group, so it rides the body's own world
|
|
561
|
+
// matrix and faces the camera through poseFleetHologram.)
|
|
578
562
|
|
|
579
|
-
//
|
|
580
|
-
//
|
|
581
|
-
//
|
|
582
|
-
// from `frameObject` below — the body mesh, so a hub's corona and a
|
|
583
|
-
// gateway's moons stay outside the box.
|
|
563
|
+
// (No hover mark either: `frameObject: null` opts every body out of
|
|
564
|
+
// the board's corner frame — the straight edges fight the ring
|
|
565
|
+
// silhouette, and the front dial already reads as the affordance.)
|
|
584
566
|
});
|
|
585
567
|
|
|
586
568
|
return {
|
|
@@ -592,12 +574,13 @@ export function buildFleetScene(
|
|
|
592
574
|
reanchorFollow();
|
|
593
575
|
},
|
|
594
576
|
setSelected(id: string | null) {
|
|
595
|
-
//
|
|
596
|
-
//
|
|
597
|
-
//
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
577
|
+
// These holograms carry their own circular focus mark. Suppress the
|
|
578
|
+
// board's cube cursor here; otherwise it wraps the sphere in six
|
|
579
|
+
// straight edges and fights the ring-shell silhouette.
|
|
580
|
+
for (const [bodyId, entry] of bodies) {
|
|
581
|
+
entry.hologram.selectionRing.visible = bodyId === id;
|
|
582
|
+
}
|
|
583
|
+
engine.setSelection(null);
|
|
601
584
|
if (id === null) {
|
|
602
585
|
followId = null;
|
|
603
586
|
cancelFlight();
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Deliberately a BORDERLESS world: the map carries continent silhouettes
|
|
7
7
|
* and TECTONIC PLATE boundary lines only — never national borders, never
|
|
8
|
-
* country labels (city names in the picker's
|
|
8
|
+
* country labels (city names in the picker's readout are the only named
|
|
9
9
|
* places, and names of cities carry no border disputes). The 15°
|
|
10
10
|
* meridian graticule doubles as the 24 time-sector edges the picker
|
|
11
11
|
* selects between.
|