@fnndsc/orrery 0.1.0
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/README.md +12 -0
- package/dist/controls/cameraRig.d.ts +223 -0
- package/dist/controls/cameraRig.js +353 -0
- package/dist/controls/cameraRig.js.map +1 -0
- package/dist/controls/gestures.d.ts +133 -0
- package/dist/controls/gestures.js +282 -0
- package/dist/controls/gestures.js.map +1 -0
- package/dist/controls/index.d.ts +9 -0
- package/dist/controls/index.js +10 -0
- package/dist/controls/index.js.map +1 -0
- package/dist/controls/picker.d.ts +117 -0
- package/dist/controls/picker.js +167 -0
- package/dist/controls/picker.js.map +1 -0
- package/dist/controls/replay.d.ts +94 -0
- package/dist/controls/replay.js +147 -0
- package/dist/controls/replay.js.map +1 -0
- package/dist/draw/censusField.d.ts +113 -0
- package/dist/draw/censusField.js +241 -0
- package/dist/draw/censusField.js.map +1 -0
- package/dist/draw/constants.d.ts +13 -0
- package/dist/draw/constants.js +14 -0
- package/dist/draw/constants.js.map +1 -0
- package/dist/draw/geometry.d.ts +33 -0
- package/dist/draw/geometry.js +55 -0
- package/dist/draw/geometry.js.map +1 -0
- package/dist/draw/handoff.d.ts +11 -0
- package/dist/draw/handoff.js +12 -0
- package/dist/draw/handoff.js.map +1 -0
- package/dist/draw/handoffField.d.ts +74 -0
- package/dist/draw/handoffField.js +151 -0
- package/dist/draw/handoffField.js.map +1 -0
- package/dist/draw/index.d.ts +20 -0
- package/dist/draw/index.js +21 -0
- package/dist/draw/index.js.map +1 -0
- package/dist/draw/labelField.d.ts +63 -0
- package/dist/draw/labelField.js +149 -0
- package/dist/draw/labelField.js.map +1 -0
- package/dist/draw/lamps.d.ts +16 -0
- package/dist/draw/lamps.js +17 -0
- package/dist/draw/lamps.js.map +1 -0
- package/dist/draw/nebula.d.ts +8 -0
- package/dist/draw/nebula.js +28 -0
- package/dist/draw/nebula.js.map +1 -0
- package/dist/draw/palette.d.ts +41 -0
- package/dist/draw/palette.js +32 -0
- package/dist/draw/palette.js.map +1 -0
- package/dist/draw/sphereField.d.ts +98 -0
- package/dist/draw/sphereField.js +168 -0
- package/dist/draw/sphereField.js.map +1 -0
- package/dist/draw/starField.d.ts +127 -0
- package/dist/draw/starField.js +267 -0
- package/dist/draw/starField.js.map +1 -0
- package/dist/draw/stars.d.ts +65 -0
- package/dist/draw/stars.js +132 -0
- package/dist/draw/stars.js.map +1 -0
- package/dist/draw/timing.d.ts +11 -0
- package/dist/draw/timing.js +12 -0
- package/dist/draw/timing.js.map +1 -0
- package/dist/draw/tubeField.d.ts +131 -0
- package/dist/draw/tubeField.js +352 -0
- package/dist/draw/tubeField.js.map +1 -0
- package/dist/draw/tubes.d.ts +41 -0
- package/dist/draw/tubes.js +116 -0
- package/dist/draw/tubes.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/layout/accretion.d.ts +31 -0
- package/dist/layout/accretion.js +384 -0
- package/dist/layout/accretion.js.map +1 -0
- package/dist/layout/constellations.d.ts +25 -0
- package/dist/layout/constellations.js +197 -0
- package/dist/layout/constellations.js.map +1 -0
- package/dist/layout/galaxy.d.ts +12 -0
- package/dist/layout/galaxy.js +99 -0
- package/dist/layout/galaxy.js.map +1 -0
- package/dist/layout/hierarchy.d.ts +45 -0
- package/dist/layout/hierarchy.js +464 -0
- package/dist/layout/hierarchy.js.map +1 -0
- package/dist/layout/index.d.ts +20 -0
- package/dist/layout/index.js +21 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/layoutInput.d.ts +29 -0
- package/dist/layout/layoutInput.js +45 -0
- package/dist/layout/layoutInput.js.map +1 -0
- package/dist/layout/molecule.d.ts +64 -0
- package/dist/layout/molecule.js +155 -0
- package/dist/layout/molecule.js.map +1 -0
- package/dist/layout/pull.d.ts +94 -0
- package/dist/layout/pull.js +137 -0
- package/dist/layout/pull.js.map +1 -0
- package/dist/layout/ranked.d.ts +75 -0
- package/dist/layout/ranked.js +148 -0
- package/dist/layout/ranked.js.map +1 -0
- package/dist/layout/registry.d.ts +23 -0
- package/dist/layout/registry.js +165 -0
- package/dist/layout/registry.js.map +1 -0
- package/dist/layout/seeded.d.ts +32 -0
- package/dist/layout/seeded.js +48 -0
- package/dist/layout/seeded.js.map +1 -0
- package/dist/layout/types.d.ts +81 -0
- package/dist/layout/types.js +14 -0
- package/dist/layout/types.js.map +1 -0
- package/dist/scene/index.d.ts +6 -0
- package/dist/scene/index.js +7 -0
- package/dist/scene/index.js.map +1 -0
- package/dist/scene/orrery.d.ts +592 -0
- package/dist/scene/orrery.js +1555 -0
- package/dist/scene/orrery.js.map +1 -0
- package/dist/types/encoding.d.ts +43 -0
- package/dist/types/encoding.js +7 -0
- package/dist/types/encoding.js.map +1 -0
- package/dist/types/space.d.ts +12 -0
- package/dist/types/space.js +10 -0
- package/dist/types/space.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The solid spheres of a scene, the halos that mark a cluster, and
|
|
3
|
+
* the plain lines between spheres that do not wear tubes.
|
|
4
|
+
*
|
|
5
|
+
* A sphere is lit, coloured as it is handed; a dimmed one is faint scenery
|
|
6
|
+
* and takes no pointer; a selected one glows; flat, it is a disc facing the
|
|
7
|
+
* camera. Every sphere is found by its node's id.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import * as THREE from 'three';
|
|
12
|
+
import { DIM_OPACITY, HALO_OPACITY } from './constants.js';
|
|
13
|
+
import { SphereGeometries } from './geometry.js';
|
|
14
|
+
/** The solid spheres, halos and plain edges of one scene. */
|
|
15
|
+
export class SphereField {
|
|
16
|
+
parent;
|
|
17
|
+
geometries = new SphereGeometries();
|
|
18
|
+
byId = new Map();
|
|
19
|
+
edges = [];
|
|
20
|
+
/**
|
|
21
|
+
* @param parent - Where the spheres are drawn.
|
|
22
|
+
*/
|
|
23
|
+
constructor(parent) {
|
|
24
|
+
this.parent = parent;
|
|
25
|
+
}
|
|
26
|
+
/** Every drawn sphere and halo, by its node's id. */
|
|
27
|
+
get map() {
|
|
28
|
+
return this.byId;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Draws one sphere.
|
|
32
|
+
*
|
|
33
|
+
* @param id - Its node.
|
|
34
|
+
* @param position - Where it stands.
|
|
35
|
+
* @param radius - Its radius.
|
|
36
|
+
* @param look - How it looks.
|
|
37
|
+
* @returns The mesh.
|
|
38
|
+
*/
|
|
39
|
+
sphere_add(id, position, radius, look) {
|
|
40
|
+
const geometry = look.flat === true ? new THREE.CircleGeometry(radius, 36) : this.geometries.of(radius);
|
|
41
|
+
const material = new THREE.MeshStandardMaterial({
|
|
42
|
+
color: look.color,
|
|
43
|
+
roughness: 0.35,
|
|
44
|
+
metalness: 0.15,
|
|
45
|
+
emissive: look.selected === true ? new THREE.Color('#ffffff') : new THREE.Color('#000000'),
|
|
46
|
+
emissiveIntensity: look.selected === true ? 0.35 : 0,
|
|
47
|
+
...(look.dim === true ? { transparent: true, opacity: DIM_OPACITY } : {}),
|
|
48
|
+
...(look.fade !== undefined ? { transparent: true, opacity: look.fade } : {}),
|
|
49
|
+
});
|
|
50
|
+
const mesh = new THREE.Mesh(geometry, material);
|
|
51
|
+
mesh.position.copy(position);
|
|
52
|
+
mesh.userData['nodeId'] = id;
|
|
53
|
+
// A dimmed node is scenery: drawn behind the graph in hand, it takes no
|
|
54
|
+
// pointer, so a hover or a click never lands on the field behind.
|
|
55
|
+
mesh.userData['dim'] = look.dim === true;
|
|
56
|
+
this.parent.add(mesh);
|
|
57
|
+
this.byId.set(id, mesh);
|
|
58
|
+
return mesh;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Draws a cluster's halo: translucent, unlit, written last so the spheres
|
|
62
|
+
* inside it show through; picked only when nothing solid is.
|
|
63
|
+
*
|
|
64
|
+
* @param id - The cluster's anchor.
|
|
65
|
+
* @param position - Where it stands.
|
|
66
|
+
* @param radius - How far it reaches.
|
|
67
|
+
* @param color - Its hue.
|
|
68
|
+
* @param dim - Faint scenery that takes no pointer.
|
|
69
|
+
*/
|
|
70
|
+
halo_add(id, position, radius, color, dim) {
|
|
71
|
+
const halo = new THREE.Mesh(new THREE.SphereGeometry(radius, 24, 18), new THREE.MeshBasicMaterial({ color, transparent: true, opacity: dim ? HALO_OPACITY * 0.4 : HALO_OPACITY, depthWrite: false }));
|
|
72
|
+
halo.position.copy(position);
|
|
73
|
+
halo.renderOrder = 1;
|
|
74
|
+
halo.userData['nodeId'] = id;
|
|
75
|
+
halo.userData['halo'] = true;
|
|
76
|
+
halo.userData['dim'] = dim;
|
|
77
|
+
this.parent.add(halo);
|
|
78
|
+
this.byId.set(id, halo);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Draws a plain line between two spheres; a join is dashed.
|
|
82
|
+
*
|
|
83
|
+
* @param fromId - The parent.
|
|
84
|
+
* @param toId - The child.
|
|
85
|
+
* @param from - Where the parent stands.
|
|
86
|
+
* @param to - Where the child stands.
|
|
87
|
+
* @param color - Its hue.
|
|
88
|
+
* @param dashed - A join across branches.
|
|
89
|
+
* @param dim - Faint scenery.
|
|
90
|
+
*/
|
|
91
|
+
edge_add(fromId, toId, from, to, color, dashed, dim = false) {
|
|
92
|
+
const geometry = new THREE.BufferGeometry().setFromPoints([from, to]);
|
|
93
|
+
let line;
|
|
94
|
+
if (dashed) {
|
|
95
|
+
line = new THREE.Line(geometry, new THREE.LineDashedMaterial({
|
|
96
|
+
color, dashSize: 0.25, gapSize: 0.18, transparent: true, opacity: dim ? DIM_OPACITY : 0.9,
|
|
97
|
+
}));
|
|
98
|
+
line.computeLineDistances();
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
line = new THREE.Line(geometry, new THREE.LineBasicMaterial({ color, transparent: true, opacity: dim ? DIM_OPACITY : 0.75 }));
|
|
102
|
+
}
|
|
103
|
+
this.parent.add(line);
|
|
104
|
+
this.edges.push({ line, fromId, toId, dashed });
|
|
105
|
+
}
|
|
106
|
+
/** Brings every plain edge to its spheres, where they stand now. */
|
|
107
|
+
edges_follow() {
|
|
108
|
+
for (const edge of this.edges) {
|
|
109
|
+
const from = this.byId.get(edge.fromId);
|
|
110
|
+
const to = this.byId.get(edge.toId);
|
|
111
|
+
if (from === undefined || to === undefined)
|
|
112
|
+
continue;
|
|
113
|
+
edge.line.geometry.setFromPoints([from.position, to.position]);
|
|
114
|
+
if (edge.dashed)
|
|
115
|
+
edge.line.computeLineDistances();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Gives a sphere a new hue (its state changed); a lamp re-reads it.
|
|
120
|
+
*
|
|
121
|
+
* @param id - The node.
|
|
122
|
+
* @param color - Its hue now.
|
|
123
|
+
*/
|
|
124
|
+
recolor(id, color) {
|
|
125
|
+
const mesh = this.byId.get(id);
|
|
126
|
+
if (mesh === undefined || !(mesh.material instanceof THREE.MeshStandardMaterial))
|
|
127
|
+
return;
|
|
128
|
+
mesh.material.color = color;
|
|
129
|
+
delete mesh.userData['lampBase'];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Lights the node in hand from within and every other not at all.
|
|
133
|
+
*
|
|
134
|
+
* @param selectedId - The node in hand, or null.
|
|
135
|
+
*/
|
|
136
|
+
select(selectedId) {
|
|
137
|
+
for (const [id, mesh] of this.byId) {
|
|
138
|
+
if (!(mesh.material instanceof THREE.MeshStandardMaterial))
|
|
139
|
+
continue;
|
|
140
|
+
const on = id === selectedId;
|
|
141
|
+
mesh.material.emissive.set(on ? '#ffffff' : '#000000');
|
|
142
|
+
mesh.material.emissiveIntensity = on ? 0.35 : 0;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Lets one sphere go: its molecule is stars again.
|
|
147
|
+
*
|
|
148
|
+
* @param mesh - The sphere.
|
|
149
|
+
*/
|
|
150
|
+
remove(mesh) {
|
|
151
|
+
this.parent.remove(mesh);
|
|
152
|
+
if (mesh.material instanceof THREE.Material)
|
|
153
|
+
mesh.material.dispose();
|
|
154
|
+
const id = mesh.userData['nodeId'];
|
|
155
|
+
if (typeof id === 'string' && this.byId.get(id) === mesh)
|
|
156
|
+
this.byId.delete(id);
|
|
157
|
+
}
|
|
158
|
+
/** Forgets everything: the scene is being redrawn (its parent already cleared). */
|
|
159
|
+
clear() {
|
|
160
|
+
this.byId = new Map();
|
|
161
|
+
this.edges = [];
|
|
162
|
+
}
|
|
163
|
+
/** Lets the shared geometries go: the scene is done. */
|
|
164
|
+
dispose() {
|
|
165
|
+
this.geometries.dispose();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=sphereField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sphereField.js","sourceRoot":"","sources":["../../src/draw/sphereField.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AA2BjD,6DAA6D;AAC7D,MAAM,OAAO,WAAW;IACL,MAAM,CAAiB;IACvB,UAAU,GAAqB,IAAI,gBAAgB,EAAE,CAAC;IAC/D,IAAI,GAA4B,IAAI,GAAG,EAAE,CAAC;IAC1C,KAAK,GAAW,EAAE,CAAC;IAE3B;;OAEG;IACH,YAAY,MAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,qDAAqD;IACrD,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;;;;;OAQG;IACI,UAAU,CAAC,EAAU,EAAE,QAAuB,EAAE,MAAc,EAAE,IAAgB;QACrF,MAAM,QAAQ,GAAyB,IAAI,CAAC,IAAI,KAAK,IAA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CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrE,MAAM,EAAE,GAAY,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,mFAAmF;IAC5E,KAAK;QACV,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,wDAAwD;IACjD,OAAO;QACZ,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The stars of a scene: every node a point of light, the threads that
|
|
3
|
+
* join them, and the nebulae that mark a cluster.
|
|
4
|
+
*
|
|
5
|
+
* A scene draws its field as stars from afar; the field holds the two
|
|
6
|
+
* layers (glow and embers), the thread lines, and the nebulae, keeps each
|
|
7
|
+
* star's slot, and lets a molecule's stars and threads fade out as the
|
|
8
|
+
* molecule turns solid and back in as it turns to stars again.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import * as THREE from 'three';
|
|
13
|
+
import { type StarEntry } from './stars.js';
|
|
14
|
+
/** A cluster's nebula: whose it is, where, how far it reaches. */
|
|
15
|
+
export interface Nebula {
|
|
16
|
+
id: string;
|
|
17
|
+
position: THREE.Vector3;
|
|
18
|
+
radius: number;
|
|
19
|
+
}
|
|
20
|
+
/** The stars, threads and nebulae of one scene. */
|
|
21
|
+
export declare class StarField {
|
|
22
|
+
private readonly parent;
|
|
23
|
+
private stars;
|
|
24
|
+
private index;
|
|
25
|
+
private nebulaList;
|
|
26
|
+
private materials;
|
|
27
|
+
private layers;
|
|
28
|
+
private threads;
|
|
29
|
+
/** Each nebula's sprite and resting opacity, by its cluster's id. */
|
|
30
|
+
private nebulaSprites;
|
|
31
|
+
/** Every star of a node, by id; built when first asked. */
|
|
32
|
+
private starsById;
|
|
33
|
+
private starsTouched;
|
|
34
|
+
private threadsTouched;
|
|
35
|
+
/**
|
|
36
|
+
* @param parent - Where the field is drawn.
|
|
37
|
+
*/
|
|
38
|
+
constructor(parent: THREE.Object3D);
|
|
39
|
+
/** How many stars are drawn. */
|
|
40
|
+
count(): number;
|
|
41
|
+
/** Every star, in the order drawn. */
|
|
42
|
+
list(): ReadonlyArray<StarEntry>;
|
|
43
|
+
/** The first star drawn for a node, if any. */
|
|
44
|
+
entry(id: string): StarEntry | undefined;
|
|
45
|
+
/** Every node drawn as a star. */
|
|
46
|
+
ids(): IterableIterator<string>;
|
|
47
|
+
/** Every nebula. */
|
|
48
|
+
nebulae(): ReadonlyArray<Nebula>;
|
|
49
|
+
/**
|
|
50
|
+
* Draws stars as two layers — the glow, and the embers over it.
|
|
51
|
+
*
|
|
52
|
+
* @param entries - The stars.
|
|
53
|
+
* @param pixelRatio - The display's pixel ratio.
|
|
54
|
+
* @param heightPx - The canvas's height, in device pixels.
|
|
55
|
+
* @param fovDeg - The camera's vertical field of view.
|
|
56
|
+
*/
|
|
57
|
+
draw(entries: StarEntry[], pixelRatio: number, heightPx: number, fovDeg: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* Keeps the stars' pixel scale true to the canvas and the camera.
|
|
60
|
+
*
|
|
61
|
+
* @param heightPx - The canvas's height, in device pixels.
|
|
62
|
+
* @param fovDeg - The camera's vertical field of view.
|
|
63
|
+
*/
|
|
64
|
+
scale_update(heightPx: number, fovDeg: number): void;
|
|
65
|
+
/**
|
|
66
|
+
* Draws the faint threads between stars, as one line batch.
|
|
67
|
+
*
|
|
68
|
+
* @param positions - Segment ends, six numbers a segment.
|
|
69
|
+
* @param colors - Their colours, six numbers a segment.
|
|
70
|
+
* @param ends - The nodes each segment joins, two ids a segment: a thread
|
|
71
|
+
* shows in a replay only once both have arrived. Optional.
|
|
72
|
+
*/
|
|
73
|
+
threads_draw(positions: ReadonlyArray<number>, colors: ReadonlyArray<number>, ends?: ReadonlyArray<string>): void;
|
|
74
|
+
/**
|
|
75
|
+
* A cluster's handle while the scene draws stars: a soft glow facing the
|
|
76
|
+
* camera.
|
|
77
|
+
*
|
|
78
|
+
* @param id - The cluster's anchor.
|
|
79
|
+
* @param position - Where it stands.
|
|
80
|
+
* @param radius - How far it reaches.
|
|
81
|
+
* @param color - Its hue.
|
|
82
|
+
* @param dim - Drawn at a third of its light.
|
|
83
|
+
*/
|
|
84
|
+
nebula_add(id: string, position: THREE.Vector3, radius: number, color: THREE.Color, dim: boolean): void;
|
|
85
|
+
/**
|
|
86
|
+
* Fades stars to a share of their resting light (0 gone, 1 as drawn).
|
|
87
|
+
*
|
|
88
|
+
* @param entries - The stars.
|
|
89
|
+
* @param share - How much of their light they keep.
|
|
90
|
+
*/
|
|
91
|
+
stars_fade(entries: ReadonlyArray<StarEntry>, share: number): void;
|
|
92
|
+
/**
|
|
93
|
+
* Fades thread segments to a share of their resting colour.
|
|
94
|
+
*
|
|
95
|
+
* @param segments - The segments, by index.
|
|
96
|
+
* @param share - How much of their colour they keep.
|
|
97
|
+
*/
|
|
98
|
+
threads_fade(segments: ReadonlyArray<number>, share: number): void;
|
|
99
|
+
/** Sends this frame's fades to the screen. */
|
|
100
|
+
flush(): void;
|
|
101
|
+
/** Forgets everything: the scene is being redrawn (its parent already cleared). */
|
|
102
|
+
clear(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Shows or hides nodes' stars and nebulae (a replay: 0 not yet arrived,
|
|
105
|
+
* 1 as drawn). Threads follow with {@link threads_present}.
|
|
106
|
+
*
|
|
107
|
+
* @param ids - The nodes.
|
|
108
|
+
* @param presence - How much of their resting light they keep.
|
|
109
|
+
*/
|
|
110
|
+
presence_set(ids: Iterable<string>, presence: number): void;
|
|
111
|
+
/**
|
|
112
|
+
* Sets how brightly a node's stars flash (an arrival), 0 at rest.
|
|
113
|
+
*
|
|
114
|
+
* @param id - The node.
|
|
115
|
+
* @param strength - 0..1.
|
|
116
|
+
*/
|
|
117
|
+
flash_set(id: string, strength: number): void;
|
|
118
|
+
/**
|
|
119
|
+
* Shows each thread whose two ends are both present, hides the rest.
|
|
120
|
+
* Threads drawn without their ends are left as they are.
|
|
121
|
+
*
|
|
122
|
+
* @param present - Whether a node is present.
|
|
123
|
+
*/
|
|
124
|
+
threads_present(present: (id: string) => boolean): void;
|
|
125
|
+
/** Every star drawn for a node. */
|
|
126
|
+
private stars_of;
|
|
127
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The stars of a scene: every node a point of light, the threads that
|
|
3
|
+
* join them, and the nebulae that mark a cluster.
|
|
4
|
+
*
|
|
5
|
+
* A scene draws its field as stars from afar; the field holds the two
|
|
6
|
+
* layers (glow and embers), the thread lines, and the nebulae, keeps each
|
|
7
|
+
* star's slot, and lets a molecule's stars and threads fade out as the
|
|
8
|
+
* molecule turns solid and back in as it turns to stars again.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import * as THREE from 'three';
|
|
13
|
+
import { NEBULA_OPACITY, THREAD_OPACITY } from './constants.js';
|
|
14
|
+
import { nebulaTexture_get } from './nebula.js';
|
|
15
|
+
import { starLayer_make, starScale_of } from './stars.js';
|
|
16
|
+
/** The stars, threads and nebulae of one scene. */
|
|
17
|
+
export class StarField {
|
|
18
|
+
parent;
|
|
19
|
+
stars = [];
|
|
20
|
+
index = new Map();
|
|
21
|
+
nebulaList = [];
|
|
22
|
+
materials = [];
|
|
23
|
+
layers = [];
|
|
24
|
+
threads = null;
|
|
25
|
+
/** Each nebula's sprite and resting opacity, by its cluster's id. */
|
|
26
|
+
nebulaSprites = new Map();
|
|
27
|
+
/** Every star of a node, by id; built when first asked. */
|
|
28
|
+
starsById = null;
|
|
29
|
+
starsTouched = false;
|
|
30
|
+
threadsTouched = false;
|
|
31
|
+
/**
|
|
32
|
+
* @param parent - Where the field is drawn.
|
|
33
|
+
*/
|
|
34
|
+
constructor(parent) {
|
|
35
|
+
this.parent = parent;
|
|
36
|
+
}
|
|
37
|
+
/** How many stars are drawn. */
|
|
38
|
+
count() {
|
|
39
|
+
return this.stars.length;
|
|
40
|
+
}
|
|
41
|
+
/** Every star, in the order drawn. */
|
|
42
|
+
list() {
|
|
43
|
+
return this.stars;
|
|
44
|
+
}
|
|
45
|
+
/** The first star drawn for a node, if any. */
|
|
46
|
+
entry(id) {
|
|
47
|
+
const at = this.index.get(id);
|
|
48
|
+
return at === undefined ? undefined : this.stars[at];
|
|
49
|
+
}
|
|
50
|
+
/** Every node drawn as a star. */
|
|
51
|
+
ids() {
|
|
52
|
+
return this.index.keys();
|
|
53
|
+
}
|
|
54
|
+
/** Every nebula. */
|
|
55
|
+
nebulae() {
|
|
56
|
+
return this.nebulaList;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Draws stars as two layers — the glow, and the embers over it.
|
|
60
|
+
*
|
|
61
|
+
* @param entries - The stars.
|
|
62
|
+
* @param pixelRatio - The display's pixel ratio.
|
|
63
|
+
* @param heightPx - The canvas's height, in device pixels.
|
|
64
|
+
* @param fovDeg - The camera's vertical field of view.
|
|
65
|
+
*/
|
|
66
|
+
draw(entries, pixelRatio, heightPx, fovDeg) {
|
|
67
|
+
for (const entry of entries) {
|
|
68
|
+
if (!this.index.has(entry.id))
|
|
69
|
+
this.index.set(entry.id, this.stars.length);
|
|
70
|
+
this.stars.push(entry);
|
|
71
|
+
}
|
|
72
|
+
this.starsById = null;
|
|
73
|
+
// The glow, the embers over it, and rings (stars of another kind) over both.
|
|
74
|
+
for (const [ember, ring] of [[false, false], [true, false], [false, true]]) {
|
|
75
|
+
const layer = entries.filter((entry) => (entry.ring === true) === ring && (ring || entry.ember === ember));
|
|
76
|
+
if (layer.length === 0)
|
|
77
|
+
continue;
|
|
78
|
+
const drawn = starLayer_make(layer, ember, this.layers.length, pixelRatio, ring);
|
|
79
|
+
this.layers.push({ alpha: drawn.alpha, base: drawn.base, flash: drawn.flash });
|
|
80
|
+
this.parent.add(drawn.points);
|
|
81
|
+
this.materials.push(drawn.material);
|
|
82
|
+
}
|
|
83
|
+
this.scale_update(heightPx, fovDeg);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Keeps the stars' pixel scale true to the canvas and the camera.
|
|
87
|
+
*
|
|
88
|
+
* @param heightPx - The canvas's height, in device pixels.
|
|
89
|
+
* @param fovDeg - The camera's vertical field of view.
|
|
90
|
+
*/
|
|
91
|
+
scale_update(heightPx, fovDeg) {
|
|
92
|
+
if (this.materials.length === 0)
|
|
93
|
+
return;
|
|
94
|
+
const scale = starScale_of(heightPx, fovDeg);
|
|
95
|
+
for (const material of this.materials) {
|
|
96
|
+
const uniform = material.uniforms['scale'];
|
|
97
|
+
if (uniform !== undefined)
|
|
98
|
+
uniform.value = scale;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Draws the faint threads between stars, as one line batch.
|
|
103
|
+
*
|
|
104
|
+
* @param positions - Segment ends, six numbers a segment.
|
|
105
|
+
* @param colors - Their colours, six numbers a segment.
|
|
106
|
+
* @param ends - The nodes each segment joins, two ids a segment: a thread
|
|
107
|
+
* shows in a replay only once both have arrived. Optional.
|
|
108
|
+
*/
|
|
109
|
+
threads_draw(positions, colors, ends = []) {
|
|
110
|
+
if (positions.length === 0)
|
|
111
|
+
return;
|
|
112
|
+
const geometry = new THREE.BufferGeometry();
|
|
113
|
+
geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3));
|
|
114
|
+
const attribute = new THREE.Float32BufferAttribute(colors, 3);
|
|
115
|
+
geometry.setAttribute('color', attribute);
|
|
116
|
+
this.threads = { attribute, base: Float32Array.from(colors), ends };
|
|
117
|
+
this.parent.add(new THREE.LineSegments(geometry, new THREE.LineBasicMaterial({
|
|
118
|
+
vertexColors: true, transparent: true, opacity: THREAD_OPACITY, blending: THREE.AdditiveBlending, depthWrite: false,
|
|
119
|
+
})));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A cluster's handle while the scene draws stars: a soft glow facing the
|
|
123
|
+
* camera.
|
|
124
|
+
*
|
|
125
|
+
* @param id - The cluster's anchor.
|
|
126
|
+
* @param position - Where it stands.
|
|
127
|
+
* @param radius - How far it reaches.
|
|
128
|
+
* @param color - Its hue.
|
|
129
|
+
* @param dim - Drawn at a third of its light.
|
|
130
|
+
*/
|
|
131
|
+
nebula_add(id, position, radius, color, dim) {
|
|
132
|
+
const sprite = new THREE.Sprite(new THREE.SpriteMaterial({
|
|
133
|
+
map: nebulaTexture_get(),
|
|
134
|
+
color,
|
|
135
|
+
transparent: true,
|
|
136
|
+
opacity: dim ? NEBULA_OPACITY / 3 : NEBULA_OPACITY,
|
|
137
|
+
blending: THREE.AdditiveBlending,
|
|
138
|
+
depthWrite: false,
|
|
139
|
+
}));
|
|
140
|
+
sprite.position.copy(position);
|
|
141
|
+
sprite.scale.setScalar(radius * 2);
|
|
142
|
+
sprite.renderOrder = 0;
|
|
143
|
+
this.parent.add(sprite);
|
|
144
|
+
this.nebulaList.push({ id, position: position.clone(), radius });
|
|
145
|
+
this.nebulaSprites.set(id, { material: sprite.material, base: sprite.material.opacity });
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Fades stars to a share of their resting light (0 gone, 1 as drawn).
|
|
149
|
+
*
|
|
150
|
+
* @param entries - The stars.
|
|
151
|
+
* @param share - How much of their light they keep.
|
|
152
|
+
*/
|
|
153
|
+
stars_fade(entries, share) {
|
|
154
|
+
for (const entry of entries) {
|
|
155
|
+
const layer = entry.layer === undefined ? undefined : this.layers[entry.layer];
|
|
156
|
+
if (layer === undefined || entry.slot === undefined)
|
|
157
|
+
continue;
|
|
158
|
+
layer.alpha.setX(entry.slot, (layer.base[entry.slot] ?? 1) * share);
|
|
159
|
+
this.starsTouched = true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Fades thread segments to a share of their resting colour.
|
|
164
|
+
*
|
|
165
|
+
* @param segments - The segments, by index.
|
|
166
|
+
* @param share - How much of their colour they keep.
|
|
167
|
+
*/
|
|
168
|
+
threads_fade(segments, share) {
|
|
169
|
+
if (this.threads === null || segments.length === 0)
|
|
170
|
+
return;
|
|
171
|
+
const colors = this.threads.attribute.array;
|
|
172
|
+
const base = this.threads.base;
|
|
173
|
+
for (const segment of segments) {
|
|
174
|
+
for (let k = segment * 6; k < segment * 6 + 6; k++)
|
|
175
|
+
colors[k] = (base[k] ?? 0) * share;
|
|
176
|
+
}
|
|
177
|
+
this.threadsTouched = true;
|
|
178
|
+
}
|
|
179
|
+
/** Sends this frame's fades to the screen. */
|
|
180
|
+
flush() {
|
|
181
|
+
if (this.starsTouched)
|
|
182
|
+
for (const layer of this.layers)
|
|
183
|
+
layer.alpha.needsUpdate = true;
|
|
184
|
+
if (this.threadsTouched && this.threads !== null)
|
|
185
|
+
this.threads.attribute.needsUpdate = true;
|
|
186
|
+
this.starsTouched = false;
|
|
187
|
+
this.threadsTouched = false;
|
|
188
|
+
}
|
|
189
|
+
/** Forgets everything: the scene is being redrawn (its parent already cleared). */
|
|
190
|
+
clear() {
|
|
191
|
+
this.stars = [];
|
|
192
|
+
this.index = new Map();
|
|
193
|
+
this.nebulaList = [];
|
|
194
|
+
this.materials = [];
|
|
195
|
+
this.layers = [];
|
|
196
|
+
this.threads = null;
|
|
197
|
+
this.nebulaSprites = new Map();
|
|
198
|
+
this.starsById = null;
|
|
199
|
+
this.starsTouched = false;
|
|
200
|
+
this.threadsTouched = false;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Shows or hides nodes' stars and nebulae (a replay: 0 not yet arrived,
|
|
204
|
+
* 1 as drawn). Threads follow with {@link threads_present}.
|
|
205
|
+
*
|
|
206
|
+
* @param ids - The nodes.
|
|
207
|
+
* @param presence - How much of their resting light they keep.
|
|
208
|
+
*/
|
|
209
|
+
presence_set(ids, presence) {
|
|
210
|
+
for (const id of ids) {
|
|
211
|
+
for (const entry of this.stars_of(id)) {
|
|
212
|
+
const layer = entry.layer === undefined ? undefined : this.layers[entry.layer];
|
|
213
|
+
if (layer === undefined || entry.slot === undefined)
|
|
214
|
+
continue;
|
|
215
|
+
layer.alpha.setX(entry.slot, (layer.base[entry.slot] ?? 1) * presence);
|
|
216
|
+
this.starsTouched = true;
|
|
217
|
+
}
|
|
218
|
+
const nebula = this.nebulaSprites.get(id);
|
|
219
|
+
if (nebula !== undefined)
|
|
220
|
+
nebula.material.opacity = nebula.base * presence;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Sets how brightly a node's stars flash (an arrival), 0 at rest.
|
|
225
|
+
*
|
|
226
|
+
* @param id - The node.
|
|
227
|
+
* @param strength - 0..1.
|
|
228
|
+
*/
|
|
229
|
+
flash_set(id, strength) {
|
|
230
|
+
for (const entry of this.stars_of(id)) {
|
|
231
|
+
const layer = entry.layer === undefined ? undefined : this.layers[entry.layer];
|
|
232
|
+
if (layer === undefined || entry.slot === undefined)
|
|
233
|
+
continue;
|
|
234
|
+
layer.flash.setX(entry.slot, strength);
|
|
235
|
+
layer.flash.needsUpdate = true;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Shows each thread whose two ends are both present, hides the rest.
|
|
240
|
+
* Threads drawn without their ends are left as they are.
|
|
241
|
+
*
|
|
242
|
+
* @param present - Whether a node is present.
|
|
243
|
+
*/
|
|
244
|
+
threads_present(present) {
|
|
245
|
+
const threads = this.threads;
|
|
246
|
+
if (threads === null || threads.ends.length === 0)
|
|
247
|
+
return;
|
|
248
|
+
const colors = threads.attribute.array;
|
|
249
|
+
const segments = threads.ends.length / 2;
|
|
250
|
+
for (let segment = 0; segment < segments; segment++) {
|
|
251
|
+
const shown = present(threads.ends[segment * 2] ?? '') && present(threads.ends[segment * 2 + 1] ?? '') ? 1 : 0;
|
|
252
|
+
for (let k = segment * 6; k < segment * 6 + 6; k++)
|
|
253
|
+
colors[k] = (threads.base[k] ?? 0) * shown;
|
|
254
|
+
}
|
|
255
|
+
this.threadsTouched = true;
|
|
256
|
+
}
|
|
257
|
+
/** Every star drawn for a node. */
|
|
258
|
+
stars_of(id) {
|
|
259
|
+
if (this.starsById === null) {
|
|
260
|
+
this.starsById = new Map();
|
|
261
|
+
for (const entry of this.stars)
|
|
262
|
+
this.starsById.set(entry.id, [...(this.starsById.get(entry.id) ?? []), entry]);
|
|
263
|
+
}
|
|
264
|
+
return this.starsById.get(id) ?? [];
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=starField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"starField.js","sourceRoot":"","sources":["../../src/draw/starField.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAkC,MAAM,YAAY,CAAC;AAS1F,mDAAmD;AACnD,MAAM,OAAO,SAAS;IACH,MAAM,CAAiB;IAChC,KAAK,GAAgB,EAAE,CAAC;IACxB,KAAK,GAAwB,IAAI,GAAG,EAAE,CAAC;IACvC,UAAU,GAAa,EAAE,CAAC;IAC1B,SAAS,GAA2B,EAAE,CAAC;IACvC,MAAM,GAA8F,EAAE,CAAC;IACvG,OAAO,GAAiG,IAAI,CAAC;IACrH,qEAAqE;IAC7D,aAAa,GAAkE,IAAI,GAAG,EAAE,CAAC;IACjG,2DAA2D;IACnD,SAAS,GAAoC,IAAI,CAAC;IAClD,YAAY,GAAY,KAAK,CA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CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC;QACjG,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED,mCAAmC;IAC3B,QAAQ,CAAC,EAAU;QACzB,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;YAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;YAC3B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK;gBAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QACjH,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Stars: every node a point of light, sized true to the sphere it stands for. Error-free stars glow additively; a star with any errored share is drawn solid over the glow, so failure always shows through.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import * as THREE from 'three';
|
|
7
|
+
/** A star's smallest size on screen, in CSS pixels: no node ever vanishes. */
|
|
8
|
+
export declare const STAR_FLOOR_PX: number;
|
|
9
|
+
/** A star never swells past this many CSS pixels: near the camera a feed is spheres, not a glow. */
|
|
10
|
+
export declare const STAR_CAP_PX: number;
|
|
11
|
+
/** A star's sprite spans this many times its sphere's diameter: core plus glow. */
|
|
12
|
+
export declare const STAR_GLOW: number;
|
|
13
|
+
export declare const STAR_VERTEX: string;
|
|
14
|
+
/** The glow: a bright core falling off to nothing at the sprite's edge. */
|
|
15
|
+
export declare const STAR_FRAGMENT_GLOW: string;
|
|
16
|
+
/**
|
|
17
|
+
* The ring: a star of another kind — a thin bright circle round a small
|
|
18
|
+
* core, so a plugin reads apart from the feeds around it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const STAR_FRAGMENT_RING: string;
|
|
21
|
+
/** The ember: an errored star drawn solid over the glow, so red stays red. */
|
|
22
|
+
export declare const STAR_FRAGMENT_EMBER: string;
|
|
23
|
+
/** One star as drawn: whose it is, where, how big, its hue, whether dim, whether errored. */
|
|
24
|
+
export interface StarEntry {
|
|
25
|
+
id: string;
|
|
26
|
+
position: THREE.Vector3;
|
|
27
|
+
radius: number;
|
|
28
|
+
color: THREE.Color;
|
|
29
|
+
dim: boolean;
|
|
30
|
+
ember: boolean;
|
|
31
|
+
/** Drawn as a ring: a star of another kind. */
|
|
32
|
+
ring?: boolean;
|
|
33
|
+
/** Which layer draws it (0 glow, 1 ember) and its slot there, once drawn. */
|
|
34
|
+
layer?: number;
|
|
35
|
+
slot?: number;
|
|
36
|
+
}
|
|
37
|
+
/** One drawn layer of stars: its points, its material, and its alphas as drawn and as they rest. */
|
|
38
|
+
export interface StarLayer {
|
|
39
|
+
points: THREE.Points;
|
|
40
|
+
material: THREE.ShaderMaterial;
|
|
41
|
+
alpha: THREE.BufferAttribute;
|
|
42
|
+
base: Float32Array;
|
|
43
|
+
/** How brightly each star flashes, 0 at rest. */
|
|
44
|
+
flash: THREE.BufferAttribute;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Builds one layer of stars — the glow or the embers — as one draw call.
|
|
48
|
+
* Each entry learns its slot in the layer.
|
|
49
|
+
*
|
|
50
|
+
* @param entries - The layer's stars.
|
|
51
|
+
* @param ember - Whether this is the ember layer (drawn solid, over the glow).
|
|
52
|
+
* @param layerIndex - The layer's index, recorded on each entry.
|
|
53
|
+
* @param pixelRatio - The display's pixel ratio, for the size floor and cap.
|
|
54
|
+
* @returns The layer, not yet added to anything.
|
|
55
|
+
*/
|
|
56
|
+
export declare function starLayer_make(entries: ReadonlyArray<StarEntry>, ember: boolean, layerIndex: number, pixelRatio: number, ring?: boolean): StarLayer;
|
|
57
|
+
/**
|
|
58
|
+
* The stars' pixel scale for a canvas and a camera: pixels per unit of size
|
|
59
|
+
* at unit depth.
|
|
60
|
+
*
|
|
61
|
+
* @param heightPx - The canvas's height in device pixels.
|
|
62
|
+
* @param fovDeg - The camera's vertical field of view, in degrees.
|
|
63
|
+
* @returns The scale the star shader multiplies by.
|
|
64
|
+
*/
|
|
65
|
+
export declare function starScale_of(heightPx: number, fovDeg: number): number;
|