@n3rdw1z4rd/core 0.23.0 → 0.23.1
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/dist/astar.d.ts +1 -3
- package/dist/astar.js +1 -2
- package/dist/canvas-renderer.d.ts +1 -3
- package/dist/canvas-renderer.js +1 -2
- package/dist/clock.d.ts +1 -3
- package/dist/clock.js +1 -2
- package/dist/color-palette.d.ts +1 -3
- package/dist/color-palette.js +1 -2
- package/dist/color.d.ts +1 -3
- package/dist/color.js +1 -2
- package/dist/disposable.d.ts +1 -3
- package/dist/disposable.js +1 -2
- package/dist/dungeon-generator.d.ts +2 -4
- package/dist/dungeon-generator.js +3 -4
- package/dist/ecs.d.ts +1 -3
- package/dist/ecs.js +1 -2
- package/dist/emitter.d.ts +1 -3
- package/dist/emitter.js +1 -2
- package/dist/event-queue.d.ts +1 -3
- package/dist/event-queue.js +1 -2
- package/dist/graph/doc.d.ts +2 -4
- package/dist/graph/doc.js +1 -2
- package/dist/graph/evaluate.d.ts +1 -3
- package/dist/graph/evaluate.js +1 -2
- package/dist/graph/index.d.ts +2 -2
- package/dist/graph/index.js +2 -2
- package/dist/graph/node.d.ts +1 -3
- package/dist/graph/node.js +1 -2
- package/dist/graph/nodes.d.ts +1 -3
- package/dist/graph/nodes.js +1 -2
- package/dist/graph/script.d.ts +1 -3
- package/dist/graph/script.js +1 -2
- package/dist/graph/sources.d.ts +1 -3
- package/dist/graph/sources.js +1 -2
- package/dist/graph/subgraph.d.ts +2 -4
- package/dist/graph/subgraph.js +1 -2
- package/dist/graph/types.d.ts +1 -3
- package/dist/graph/types.js +1 -2
- package/dist/graph.cjs +9 -17
- package/dist/graph.d.cts +1 -17
- package/dist/index.cjs +27 -52
- package/dist/index.d.cts +1 -63
- package/dist/index.d.ts +10 -10
- package/dist/index.js +14 -14
- package/dist/input/_input.d.ts +1 -3
- package/dist/input/_input.js +1 -2
- package/dist/input/action-map.d.ts +1 -3
- package/dist/input/action-map.js +1 -2
- package/dist/input/bindings.d.ts +1 -3
- package/dist/input/bindings.js +1 -2
- package/dist/input/gestures.d.ts +1 -3
- package/dist/input/gestures.js +1 -2
- package/dist/input/index.d.ts +1 -1
- package/dist/input/index.js +1 -1
- package/dist/input/input-action-map.d.ts +3 -5
- package/dist/input/input-action-map.js +3 -4
- package/dist/input/input.d.ts +2 -4
- package/dist/input/input.js +2 -3
- package/dist/log.d.ts +1 -3
- package/dist/log.js +1 -2
- package/dist/map2d.d.ts +1 -3
- package/dist/map2d.js +1 -2
- package/dist/{map3d-CHDJiq5T.d.cts → map3d-DRHhbrFn.d.cts} +0 -8
- package/dist/map3d.d.ts +1 -3
- package/dist/map3d.js +1 -2
- package/dist/math.d.ts +1 -3
- package/dist/math.js +1 -2
- package/dist/misc.d.ts +1 -3
- package/dist/misc.js +1 -2
- package/dist/observable.d.ts +1 -3
- package/dist/observable.js +1 -2
- package/dist/particle-renderer.d.ts +1 -3
- package/dist/particle-renderer.js +1 -2
- package/dist/particle-system-2d.d.ts +1 -3
- package/dist/particle-system-2d.js +3 -4
- package/dist/random.d.ts +1 -3
- package/dist/random.js +1 -2
- package/dist/rectangle.d.ts +1 -3
- package/dist/rectangle.js +1 -2
- package/dist/{rng-Dhqq7owV.cjs → rng-edL6atS3.cjs} +3 -6
- package/dist/rng.d.ts +1 -3
- package/dist/rng.js +2 -3
- package/dist/signal.d.ts +1 -3
- package/dist/signal.js +1 -2
- package/dist/spatial-partition-2d.d.ts +1 -3
- package/dist/spatial-partition-2d.js +1 -2
- package/dist/{spatial-partition-3d-CmSCL87Z.cjs → spatial-partition-3d-D1uyJVhM.cjs} +7 -13
- package/dist/spatial-partition-3d.d.ts +1 -3
- package/dist/spatial-partition-3d.js +1 -2
- package/dist/three/adaptive-grid.d.ts +1 -3
- package/dist/three/adaptive-grid.js +1 -2
- package/dist/three/asteroid-mesh.d.ts +1 -3
- package/dist/three/asteroid-mesh.js +1 -2
- package/dist/three/camera-rig.d.ts +1 -3
- package/dist/three/camera-rig.js +1 -2
- package/dist/three/cube-sphere-geometry.d.ts +1 -3
- package/dist/three/cube-sphere-geometry.js +1 -2
- package/dist/three/ecs.d.ts +1 -3
- package/dist/three/ecs.js +1 -2
- package/dist/three/editor-camera.d.ts +1 -3
- package/dist/three/editor-camera.js +1 -2
- package/dist/three/index.d.ts +4 -4
- package/dist/three/index.js +1 -1
- package/dist/three/particle-system-3d.d.ts +1 -3
- package/dist/three/particle-system-3d.js +3 -4
- package/dist/three/picking.d.ts +2 -4
- package/dist/three/picking.js +1 -2
- package/dist/three/renderer.d.ts +1 -3
- package/dist/three/renderer.js +1 -2
- package/dist/three/schema.d.ts +0 -2
- package/dist/three/schema.js +1 -2
- package/dist/three/starfield.d.ts +1 -3
- package/dist/three/starfield.js +1 -2
- package/dist/three/texture-atlas.d.ts +1 -3
- package/dist/three/texture-atlas.js +1 -2
- package/dist/three/texture-utils.d.ts +1 -3
- package/dist/three/texture-utils.js +1 -2
- package/dist/three/voxel-geometry.d.ts +2 -4
- package/dist/three/voxel-geometry.js +2 -3
- package/dist/three/voxel-mesh.d.ts +1 -3
- package/dist/three/voxel-mesh.js +1 -2
- package/dist/three/world.d.ts +0 -2
- package/dist/three/world.js +1 -2
- package/dist/three.cjs +18 -34
- package/dist/three.d.cts +1 -33
- package/dist/tilemap.d.ts +1 -3
- package/dist/tilemap.js +1 -2
- package/dist/types.d.ts +1 -3
- package/dist/vector.d.ts +1 -3
- package/dist/vector.js +1 -2
- package/dist/vite.cjs +1 -2
- package/dist/vite.d.cts +1 -3
- package/dist/vite.d.ts +1 -3
- package/dist/vite.js +1 -2
- package/dist/webgl-renderer.d.ts +1 -3
- package/dist/webgl-renderer.js +1 -2
- package/dist/webgl.d.ts +1 -3
- package/dist/webgl.js +1 -2
- package/dist/worker-interface.d.ts +1 -3
- package/dist/worker-interface.js +1 -2
- package/package.json +6 -6
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/spatial-partition-2d.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Anything with a position that a {@link SpatialPartition2d} can bucket.
|
|
4
3
|
*
|
|
@@ -38,5 +37,4 @@ export declare class SpatialPartition2d {
|
|
|
38
37
|
* axis the block has fewer than 9 cells.
|
|
39
38
|
*/
|
|
40
39
|
getCellNeighbors(x: number, y: number): SpatialPartitionEntity2d[][];
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
40
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mod } from "./math.js";
|
|
2
|
-
|
|
2
|
+
// src/spatial-partition-2d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Uniform grid over the wrapping unit square [0, 1)², for finding nearby entities without
|
|
5
5
|
* comparing every pair. The grid has `ceil(1 / cellSize)` cells per axis.
|
|
@@ -48,5 +48,4 @@ var SpatialPartition2d = class {
|
|
|
48
48
|
return [...neighbors];
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
//#endregion
|
|
52
51
|
export { SpatialPartition2d };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
const require_rng = require("./rng-
|
|
2
|
-
|
|
1
|
+
const require_rng = require("./rng-edL6atS3.cjs");
|
|
2
|
+
// src/log.ts
|
|
3
3
|
/**
|
|
4
4
|
* `console.debug` with a bold gray `[dev]` prefix; takes the same arguments. Visible only when the
|
|
5
5
|
* console shows verbose/debug messages.
|
|
6
6
|
* @category Utilities
|
|
7
7
|
*/
|
|
8
8
|
const log = console.debug.bind(console, "%c[dev]", "font-weight: bold; color: #888;");
|
|
9
|
-
|
|
10
|
-
//#region src/color.ts
|
|
9
|
+
// src/color.ts
|
|
11
10
|
/**
|
|
12
11
|
* RGBA color with 8-bit channels (integers 0-255), kept in sync with an 8-digit hex string.
|
|
13
12
|
* Setting a channel rounds and clamps it to 0-255.
|
|
@@ -227,8 +226,7 @@ var Color = class Color {
|
|
|
227
226
|
return new Color(0, 0, 0, 0);
|
|
228
227
|
}
|
|
229
228
|
};
|
|
230
|
-
|
|
231
|
-
//#region src/map3d.ts
|
|
229
|
+
// src/map3d.ts
|
|
232
230
|
/**
|
|
233
231
|
* Default "empty" value of a {@link Map3D}: cells holding it are not stored.
|
|
234
232
|
*
|
|
@@ -374,8 +372,7 @@ var Map3D = class Map3D {
|
|
|
374
372
|
return map3d;
|
|
375
373
|
}
|
|
376
374
|
};
|
|
377
|
-
|
|
378
|
-
//#region src/spatial-partition-2d.ts
|
|
375
|
+
// src/spatial-partition-2d.ts
|
|
379
376
|
/**
|
|
380
377
|
* Uniform grid over the wrapping unit square [0, 1)², for finding nearby entities without
|
|
381
378
|
* comparing every pair. The grid has `ceil(1 / cellSize)` cells per axis.
|
|
@@ -424,8 +421,7 @@ var SpatialPartition2d = class {
|
|
|
424
421
|
return [...neighbors];
|
|
425
422
|
}
|
|
426
423
|
};
|
|
427
|
-
|
|
428
|
-
//#region src/particle-system-2d.ts
|
|
424
|
+
// src/particle-system-2d.ts
|
|
429
425
|
/**
|
|
430
426
|
* A `size` x `size` attraction matrix with values in [-1, 1). Deterministic: the same `size` and
|
|
431
427
|
* `seed` always give the same matrix.
|
|
@@ -565,8 +561,7 @@ var ParticleSystem2d = class {
|
|
|
565
561
|
this._updatePositions(dt, renderer);
|
|
566
562
|
}
|
|
567
563
|
};
|
|
568
|
-
|
|
569
|
-
//#region src/spatial-partition-3d.ts
|
|
564
|
+
// src/spatial-partition-3d.ts
|
|
570
565
|
/**
|
|
571
566
|
* Uniform grid over the wrapping unit cube [0, 1)³, for finding nearby entities without comparing
|
|
572
567
|
* every pair. The grid has `ceil(1 / cellSize)` cells per axis.
|
|
@@ -620,7 +615,6 @@ var SpatialPartition3d = class {
|
|
|
620
615
|
this.getCell(entity.x, entity.y, entity.z).push(entity);
|
|
621
616
|
}
|
|
622
617
|
};
|
|
623
|
-
//#endregion
|
|
624
618
|
Object.defineProperty(exports, "Color", {
|
|
625
619
|
enumerable: true,
|
|
626
620
|
get: function() {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/spatial-partition-3d.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Anything with a position that a {@link SpatialPartition3d} can bucket.
|
|
4
3
|
*
|
|
@@ -40,5 +39,4 @@ export declare class SpatialPartition3d {
|
|
|
40
39
|
getCellNeighbors(cx: number, cy: number, cz: number): SpatialPartitionEntity3d[][];
|
|
41
40
|
/** Puts `entity` in the cell its current position falls in. */
|
|
42
41
|
addEntity(entity: SpatialPartitionEntity3d): void;
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
42
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mod } from "./math.js";
|
|
2
|
-
|
|
2
|
+
// src/spatial-partition-3d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Uniform grid over the wrapping unit cube [0, 1)³, for finding nearby entities without comparing
|
|
5
5
|
* every pair. The grid has `ceil(1 / cellSize)` cells per axis.
|
|
@@ -53,5 +53,4 @@ var SpatialPartition3d = class {
|
|
|
53
53
|
this.getCell(entity.x, entity.y, entity.z).push(entity);
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
//#endregion
|
|
57
56
|
export { SpatialPartition3d };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EditorCamera } from "./editor-camera.js";
|
|
2
2
|
import { BufferGeometry, ColorRepresentation, LineBasicMaterial, LineSegments } from "three";
|
|
3
|
-
//#region src/three/adaptive-grid.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* An infinite-looking grid on the XY plane for editor views: each {@link AdaptiveGrid.update}
|
|
6
5
|
* rebuilds just the lines in view, doubling the spacing when zoomed out so lines never get
|
|
@@ -39,5 +38,4 @@ export declare class AdaptiveGrid extends LineSegments<BufferGeometry, LineBasic
|
|
|
39
38
|
update(view: EditorCamera, cell: number, z?: number): void;
|
|
40
39
|
private ensure;
|
|
41
40
|
dispose(): void;
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
41
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BufferAttribute, BufferGeometry, Color, LineBasicMaterial, LineSegments } from "three";
|
|
2
|
-
|
|
2
|
+
// src/three/adaptive-grid.ts
|
|
3
3
|
/**
|
|
4
4
|
* An infinite-looking grid on the XY plane for editor views: each {@link AdaptiveGrid.update}
|
|
5
5
|
* rebuilds just the lines in view, doubling the spacing when zoomed out so lines never get
|
|
@@ -123,5 +123,4 @@ var AdaptiveGrid = class extends LineSegments {
|
|
|
123
123
|
this.material.dispose();
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
|
-
//#endregion
|
|
127
126
|
export { AdaptiveGrid };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NoiseFunction3D } from "../types.js";
|
|
2
2
|
import { Mesh } from "three";
|
|
3
|
-
//#region src/three/asteroid-mesh.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Options for the {@link AsteroidMesh} constructor.
|
|
6
5
|
*
|
|
@@ -37,5 +36,4 @@ export interface AsteroidOptions {
|
|
|
37
36
|
*/
|
|
38
37
|
export declare class AsteroidMesh extends Mesh {
|
|
39
38
|
constructor(options: AsteroidOptions);
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
39
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IcosahedronGeometry, Mesh, MeshStandardMaterial } from "three";
|
|
2
|
-
|
|
2
|
+
// src/three/asteroid-mesh.ts
|
|
3
3
|
/**
|
|
4
4
|
* Lumpy rock: an icosphere whose vertices are pushed in and out by 3D noise, with a
|
|
5
5
|
* `MeshStandardMaterial`. The geometry is non-indexed, so normals are per face (a faceted look).
|
|
@@ -40,5 +40,4 @@ var AsteroidMesh = class extends Mesh {
|
|
|
40
40
|
this.geometry.computeVertexNormals();
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
//#endregion
|
|
44
43
|
export { AsteroidMesh };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Group, Object3D, PerspectiveCamera, Vector3 } from "three";
|
|
2
|
-
//#region src/three/camera-rig.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Options for the {@link CameraRig} constructor.
|
|
5
4
|
*
|
|
@@ -136,5 +135,4 @@ export declare class CameraRig extends Group {
|
|
|
136
135
|
private _clampDistance;
|
|
137
136
|
private _clampPitch;
|
|
138
137
|
private _setFirstPerson;
|
|
139
|
-
}
|
|
140
|
-
//#endregion
|
|
138
|
+
}
|
package/dist/three/camera-rig.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { clamp, lerp, radians, saturate } from "../math.js";
|
|
2
2
|
import { Group, PerspectiveCamera, Raycaster, Vector3 } from "three";
|
|
3
|
-
|
|
3
|
+
// src/three/camera-rig.ts
|
|
4
4
|
const DEFAULT_DISTANCE = 5;
|
|
5
5
|
const damp = (current, target, damping, deltaTime) => damping > 0 ? lerp(current, target, 1 - Math.exp(-damping * deltaTime)) : target;
|
|
6
6
|
/**
|
|
@@ -193,5 +193,4 @@ var CameraRig = class extends Group {
|
|
|
193
193
|
this.onModeChange?.(firstPerson);
|
|
194
194
|
}
|
|
195
195
|
};
|
|
196
|
-
//#endregion
|
|
197
196
|
export { CameraRig };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NoiseFunction3D } from "../types.js";
|
|
2
2
|
import { BufferGeometry } from "three";
|
|
3
|
-
//#region src/three/cube-sphere-geometry.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* A sphere built from a subdivided cube, for planets and other displaced spheres.
|
|
6
5
|
*
|
|
@@ -51,5 +50,4 @@ export declare class CubeSphereGeometry extends BufferGeometry {
|
|
|
51
50
|
* (https://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html)
|
|
52
51
|
*/
|
|
53
52
|
static spherify(x: number, y: number, z: number): [number, number, number];
|
|
54
|
-
}
|
|
55
|
-
//#endregion
|
|
53
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BufferAttribute, BufferGeometry } from "three";
|
|
2
|
-
|
|
2
|
+
// src/three/cube-sphere-geometry.ts
|
|
3
3
|
const FACES = [
|
|
4
4
|
{
|
|
5
5
|
n: [
|
|
@@ -235,5 +235,4 @@ var CubeSphereGeometry = class CubeSphereGeometry extends BufferGeometry {
|
|
|
235
235
|
];
|
|
236
236
|
}
|
|
237
237
|
};
|
|
238
|
-
//#endregion
|
|
239
238
|
export { CubeSphereGeometry };
|
package/dist/three/ecs.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Object3D } from "three";
|
|
2
|
-
//#region src/three/ecs.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* A component: any plain object of data, stored by name on a {@link ThreeEntity}.
|
|
5
4
|
*
|
|
@@ -73,5 +72,4 @@ export declare function IsThreeEntity(obj: Object3D): boolean;
|
|
|
73
72
|
*
|
|
74
73
|
* @category ECS
|
|
75
74
|
*/
|
|
76
|
-
export type ThreeSystem = (entities: Map<string, ThreeEntity>, delta: number, ...args: any) => void;
|
|
77
|
-
//#endregion
|
|
75
|
+
export type ThreeSystem = (entities: Map<string, ThreeEntity>, delta: number, ...args: any) => void;
|
package/dist/three/ecs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Group } from "three";
|
|
2
|
-
|
|
2
|
+
// src/three/ecs.ts
|
|
3
3
|
let entityCounter = 0;
|
|
4
4
|
/**
|
|
5
5
|
* Returns a new id `"entity_<n>"` from a module-level counter (unique per page load, not random).
|
|
@@ -62,5 +62,4 @@ function RemoveThreeComponent(entity, name) {
|
|
|
62
62
|
function IsThreeEntity(obj) {
|
|
63
63
|
return obj.userData.entityId !== void 0;
|
|
64
64
|
}
|
|
65
|
-
//#endregion
|
|
66
65
|
export { AddThreeComponent, CreateThreeEntity, GenerateEntityId, GetThreeComponent, IsThreeEntity, RemoveThreeComponent };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OrthographicCamera, PerspectiveCamera, Raycaster, Vector3 } from "three";
|
|
2
|
-
//#region src/three/editor-camera.d.ts
|
|
3
2
|
/** Screen edges covered by UI, CSS px. */
|
|
4
3
|
export interface ViewInsets {
|
|
5
4
|
l: number;
|
|
@@ -89,5 +88,4 @@ export declare class EditorCamera {
|
|
|
89
88
|
* clear of `insets` (screen edges covered by UI). Keeps yaw/pitch.
|
|
90
89
|
*/
|
|
91
90
|
fit(minX: number, minY: number, maxX: number, maxY: number, insets?: ViewInsets, margin?: number, maxZoom?: number): void;
|
|
92
|
-
}
|
|
93
|
-
//#endregion
|
|
91
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MathUtils, OrthographicCamera, PerspectiveCamera, Plane, Raycaster, Vector2, Vector3 } from "three";
|
|
2
|
-
|
|
2
|
+
// src/three/editor-camera.ts
|
|
3
3
|
/**
|
|
4
4
|
* An editor viewport camera: orthographic or perspective, with pan, zoom-at-cursor, orbit
|
|
5
5
|
* and fit-to-bounds, and conversions between screen (CSS px, relative to the canvas) and
|
|
@@ -170,5 +170,4 @@ var EditorCamera = class {
|
|
|
170
170
|
this.pan((insets.l - insets.r) / 2, (insets.t - insets.b) / 2);
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
//#endregion
|
|
174
173
|
export { EditorCamera };
|
package/dist/three/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { EditorCamera, ViewInsets } from "./editor-camera.js";
|
|
2
1
|
import { AdaptiveGrid } from "./adaptive-grid.js";
|
|
3
2
|
import { AsteroidMesh, AsteroidOptions } from "./asteroid-mesh.js";
|
|
4
3
|
import { CameraRig, CameraRigParams, PitchLimits } from "./camera-rig.js";
|
|
5
4
|
import { CubeSphereGeometry } from "./cube-sphere-geometry.js";
|
|
6
5
|
import { AddThreeComponent, CreateThreeEntity, GenerateEntityId, GetThreeComponent, IsThreeEntity, RemoveThreeComponent, ThreeComponent, ThreeEntity, ThreeSystem } from "./ecs.js";
|
|
6
|
+
import { EditorCamera, ViewInsets } from "./editor-camera.js";
|
|
7
7
|
import { ParticleSystem3d } from "./particle-system-3d.js";
|
|
8
|
-
import { ComponentRegistry, ComponentSchema, ComponentType, FieldDef, FieldType, applyFieldValue, component, componentToJson, componentType, components, defineComponent, field, fieldToJson, inferFieldType } from "./schema.js";
|
|
9
|
-
import { ComponentRef, EntityDoc, SCENE_FORMAT, SCENE_VERSION, SceneDoc, World, WorldEvents, WorldSystem } from "./world.js";
|
|
10
8
|
import { EntityHit, PickOptions, entityOf, pickEntity } from "./picking.js";
|
|
11
9
|
import { Renderer } from "./renderer.js";
|
|
10
|
+
import { ComponentRegistry, ComponentSchema, ComponentType, FieldDef, FieldType, applyFieldValue, component, componentToJson, componentType, components, defineComponent, field, fieldToJson, inferFieldType } from "./schema.js";
|
|
12
11
|
import { CreateStarfield, CreateSystemStar } from "./starfield.js";
|
|
13
|
-
import { CreateSubTexture, LoadTexture, TextureData } from "./texture-utils.js";
|
|
14
12
|
import { AtlasParams, TextureAtlas, UV } from "./texture-atlas.js";
|
|
13
|
+
import { CreateSubTexture, LoadTexture, TextureData } from "./texture-utils.js";
|
|
15
14
|
import { BuildVoxelGeometryOptions, VoxelGeometry, buildVoxelGeometry } from "./voxel-geometry.js";
|
|
16
15
|
import { VoxelBounds, VoxelMesh, VoxelMeshOptions } from "./voxel-mesh.js";
|
|
16
|
+
import { ComponentRef, EntityDoc, SCENE_FORMAT, SCENE_VERSION, SceneDoc, World, WorldEvents, WorldSystem } from "./world.js";
|
|
17
17
|
export { AdaptiveGrid, AddThreeComponent, AsteroidMesh, AsteroidOptions, AtlasParams, BuildVoxelGeometryOptions, CameraRig, CameraRigParams, ComponentRef, ComponentRegistry, ComponentSchema, ComponentType, CreateStarfield, CreateSubTexture, CreateSystemStar, CreateThreeEntity, CubeSphereGeometry, EditorCamera, EntityDoc, EntityHit, FieldDef, FieldType, GenerateEntityId, GetThreeComponent, IsThreeEntity, LoadTexture, ParticleSystem3d, PickOptions, PitchLimits, RemoveThreeComponent, Renderer, SCENE_FORMAT, SCENE_VERSION, SceneDoc, TextureAtlas, TextureData, ThreeComponent, ThreeEntity, ThreeSystem, UV, ViewInsets, VoxelBounds, VoxelGeometry, VoxelMesh, VoxelMeshOptions, World, WorldEvents, WorldSystem, applyFieldValue, buildVoxelGeometry, component, componentToJson, componentType, components, defineComponent, entityOf, field, fieldToJson, inferFieldType, pickEntity };
|
package/dist/three/index.js
CHANGED
|
@@ -9,8 +9,8 @@ import { entityOf, pickEntity } from "./picking.js";
|
|
|
9
9
|
import { Renderer } from "./renderer.js";
|
|
10
10
|
import { ComponentRegistry, applyFieldValue, component, componentToJson, componentType, components, defineComponent, field, fieldToJson, inferFieldType } from "./schema.js";
|
|
11
11
|
import { CreateStarfield, CreateSystemStar } from "./starfield.js";
|
|
12
|
-
import { CreateSubTexture, LoadTexture } from "./texture-utils.js";
|
|
13
12
|
import { TextureAtlas } from "./texture-atlas.js";
|
|
13
|
+
import { CreateSubTexture, LoadTexture } from "./texture-utils.js";
|
|
14
14
|
import { VoxelGeometry, buildVoxelGeometry } from "./voxel-geometry.js";
|
|
15
15
|
import { VoxelMesh } from "./voxel-mesh.js";
|
|
16
16
|
import { SCENE_FORMAT, SCENE_VERSION, World } from "./world.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Group, PerspectiveCamera } from "three";
|
|
2
|
-
//#region src/three/particle-system-3d.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* "Particle life" simulation in 3D: 1000 colored points in five species that attract or repel each
|
|
5
4
|
* other according to a random species-by-species matrix, forming moving clusters. Particles live in
|
|
@@ -49,5 +48,4 @@ export declare class ParticleSystem3d extends Group {
|
|
|
49
48
|
* seen from `camera`. `dt` is capped to {@link ParticleSystem3d.maxDeltaTime}.
|
|
50
49
|
*/
|
|
51
50
|
update(camera: PerspectiveCamera, dt: number): void;
|
|
52
|
-
}
|
|
53
|
-
//#endregion
|
|
51
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { fract } from "../math.js";
|
|
2
1
|
import { Random } from "../random.js";
|
|
2
|
+
import { fract } from "../math.js";
|
|
3
|
+
import { SpatialPartition3d } from "../spatial-partition-3d.js";
|
|
3
4
|
import { rng } from "../rng.js";
|
|
4
5
|
import { randomMatrix } from "../particle-system-2d.js";
|
|
5
|
-
import { SpatialPartition3d } from "../spatial-partition-3d.js";
|
|
6
6
|
import { BufferAttribute, BufferGeometry, DynamicDrawUsage, Group, Points, ShaderMaterial, Sphere, Vector3 } from "three";
|
|
7
|
-
|
|
7
|
+
// src/three/particle-system-3d.ts
|
|
8
8
|
const vertexShader = `
|
|
9
9
|
uniform float pointSize;
|
|
10
10
|
|
|
@@ -220,5 +220,4 @@ var ParticleSystem3d = class extends Group {
|
|
|
220
220
|
this._updateGeometry();
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
|
-
//#endregion
|
|
224
223
|
export { ParticleSystem3d };
|
package/dist/three/picking.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { EditorCamera } from "./editor-camera.js";
|
|
2
1
|
import { ThreeEntity } from "./ecs.js";
|
|
2
|
+
import { EditorCamera } from "./editor-camera.js";
|
|
3
3
|
import { World } from "./world.js";
|
|
4
4
|
import { Object3D, Vector3 } from "three";
|
|
5
|
-
//#region src/three/picking.d.ts
|
|
6
5
|
/** @category Three.js */
|
|
7
6
|
export interface EntityHit {
|
|
8
7
|
entity: ThreeEntity;
|
|
@@ -30,5 +29,4 @@ export interface PickOptions {
|
|
|
30
29
|
*/
|
|
31
30
|
export declare function pickEntity(world: World, view: EditorCamera, sx: number, sy: number, options?: PickOptions): EntityHit | null;
|
|
32
31
|
/** The closest entity of `world` at or above `object`, or null. */
|
|
33
|
-
export declare function entityOf(world: World, object: Object3D): ThreeEntity | null;
|
|
34
|
-
//#endregion
|
|
32
|
+
export declare function entityOf(world: World, object: Object3D): ThreeEntity | null;
|
package/dist/three/picking.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/three/picking.ts
|
|
2
2
|
/**
|
|
3
3
|
* The entity under a screen point (CSS px): raycasts the world's scene and walks up from
|
|
4
4
|
* whatever was hit to the closest entity of `world`. Invisible objects are skipped.
|
|
@@ -55,5 +55,4 @@ function visible(object) {
|
|
|
55
55
|
}
|
|
56
56
|
return true;
|
|
57
57
|
}
|
|
58
|
-
//#endregion
|
|
59
58
|
export { entityOf, pickEntity };
|
package/dist/three/renderer.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { WebGLRenderer, WebGLRendererParameters } from "three";
|
|
2
|
-
//#region src/three/renderer.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* `WebGLRenderer` that uses the device pixel ratio and can size itself to its parent element.
|
|
5
4
|
*
|
|
@@ -34,5 +33,4 @@ export declare class Renderer extends WebGLRenderer {
|
|
|
34
33
|
* @returns whether the size changed
|
|
35
34
|
*/
|
|
36
35
|
resize(width?: number, height?: number): boolean;
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
36
|
+
}
|
package/dist/three/renderer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Vector2, WebGLRenderer } from "three";
|
|
2
|
-
|
|
2
|
+
// src/three/renderer.ts
|
|
3
3
|
/**
|
|
4
4
|
* `WebGLRenderer` that uses the device pixel ratio and can size itself to its parent element.
|
|
5
5
|
*
|
|
@@ -53,5 +53,4 @@ var Renderer = class extends WebGLRenderer {
|
|
|
53
53
|
return resized;
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
//#endregion
|
|
57
56
|
export { Renderer };
|
package/dist/three/schema.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/three/schema.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Component schemas: what fields a component type has, their types, defaults and ranges.
|
|
4
3
|
*
|
|
@@ -135,5 +134,4 @@ export declare class ComponentRegistry {
|
|
|
135
134
|
* @category ECS
|
|
136
135
|
*/
|
|
137
136
|
export declare const components: ComponentRegistry;
|
|
138
|
-
//#endregion
|
|
139
137
|
export {};
|
package/dist/three/schema.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/three/schema.ts
|
|
2
2
|
const isObj = (v) => typeof v === "object" && v !== null;
|
|
3
3
|
/** Works out a field's type from a value, e.g. a class field's initial value. */
|
|
4
4
|
function inferFieldType(value) {
|
|
@@ -210,5 +210,4 @@ var ComponentRegistry = class {
|
|
|
210
210
|
* @category ECS
|
|
211
211
|
*/
|
|
212
212
|
const components = new ComponentRegistry();
|
|
213
|
-
//#endregion
|
|
214
213
|
export { ComponentRegistry, applyFieldValue, component, componentToJson, componentType, components, defineComponent, field, fieldToJson, inferFieldType };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Group, Points, Vector3 } from "three";
|
|
2
|
-
//#region src/three/starfield.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Points spread uniformly over a sphere's surface, for a distant star backdrop (point size 5 with
|
|
5
4
|
* size attenuation, 0.9 opacity). The same `seed` always gives the same stars; without one,
|
|
@@ -19,5 +18,4 @@ export declare function CreateStarfield(radius?: number, count?: number, color?:
|
|
|
19
18
|
* @param position where to put both, in the group's space; default the origin
|
|
20
19
|
* @category Geometry & Meshes
|
|
21
20
|
*/
|
|
22
|
-
export declare function CreateSystemStar(position?: Vector3): Group;
|
|
23
|
-
//#endregion
|
|
21
|
+
export declare function CreateSystemStar(position?: Vector3): Group;
|
package/dist/three/starfield.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Rng, rng } from "../rng.js";
|
|
2
2
|
import { BufferAttribute, BufferGeometry, Group, Mesh, MeshBasicMaterial, PointLight, Points, PointsMaterial, SphereGeometry, Vector3 } from "three";
|
|
3
|
-
|
|
3
|
+
// src/three/starfield.ts
|
|
4
4
|
/**
|
|
5
5
|
* Points spread uniformly over a sphere's surface, for a distant star backdrop (point size 5 with
|
|
6
6
|
* size attenuation, 0.9 opacity). The same `seed` always gives the same stars; without one,
|
|
@@ -60,5 +60,4 @@ function CreateSystemStar(position) {
|
|
|
60
60
|
star.add(starLight);
|
|
61
61
|
return star;
|
|
62
62
|
}
|
|
63
|
-
//#endregion
|
|
64
63
|
export { CreateStarfield, CreateSystemStar };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TextureData } from "./texture-utils.js";
|
|
2
2
|
import { MeshLambertMaterial, MeshLambertMaterialParameters, Texture } from "three";
|
|
3
|
-
//#region src/three/texture-atlas.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Texture coordinate `[u, v]`, each 0..1, with v = 1 at the image's top (three.js convention).
|
|
6
5
|
*
|
|
@@ -72,5 +71,4 @@ export declare class TextureAtlas {
|
|
|
72
71
|
getUV(tile: number, u: number, v: number): UV;
|
|
73
72
|
/** a Lambert material using this atlas, set up for pixel-art tiles with transparency */
|
|
74
73
|
createMaterial(params?: MeshLambertMaterialParameters): MeshLambertMaterial;
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
74
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LoadTexture } from "./texture-utils.js";
|
|
2
2
|
import { MeshLambertMaterial, NearestFilter } from "three";
|
|
3
|
-
|
|
3
|
+
// src/three/texture-atlas.ts
|
|
4
4
|
/**
|
|
5
5
|
* Tile layout and UV lookup for a texture atlas (tile sheet). Tiles are numbered left to
|
|
6
6
|
* right, top to bottom, starting at 0.
|
|
@@ -80,5 +80,4 @@ var TextureAtlas = class TextureAtlas {
|
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
//#endregion
|
|
84
83
|
export { TextureAtlas };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Texture } from "three";
|
|
2
|
-
//#region src/three/texture-utils.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* A loaded texture with its image size, as returned by {@link LoadTexture}.
|
|
5
4
|
*
|
|
@@ -27,5 +26,4 @@ export declare function LoadTexture(url: string): Promise<TextureData>;
|
|
|
27
26
|
*
|
|
28
27
|
* @category Textures
|
|
29
28
|
*/
|
|
30
|
-
export declare function CreateSubTexture(texture: Texture, x: number, y: number, w: number, h: number): Texture;
|
|
31
|
-
//#endregion
|
|
29
|
+
export declare function CreateSubTexture(texture: Texture, x: number, y: number, w: number, h: number): Texture;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NearestFilter, RepeatWrapping, TextureLoader } from "three";
|
|
2
|
-
|
|
2
|
+
// src/three/texture-utils.ts
|
|
3
3
|
/**
|
|
4
4
|
* Loads an image into a `Texture` with three's `TextureLoader`.
|
|
5
5
|
*
|
|
@@ -40,5 +40,4 @@ function CreateSubTexture(texture, x, y, w, h) {
|
|
|
40
40
|
subTexture.needsUpdate = true;
|
|
41
41
|
return subTexture;
|
|
42
42
|
}
|
|
43
|
-
//#endregion
|
|
44
43
|
export { CreateSubTexture, LoadTexture };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ColorPalette } from "../color-palette.js";
|
|
2
1
|
import { Map3D } from "../map3d.js";
|
|
2
|
+
import { ColorPalette } from "../color-palette.js";
|
|
3
3
|
import { BufferGeometry } from "three";
|
|
4
|
-
//#region src/three/voxel-geometry.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Options for {@link buildVoxelGeometry} and {@link VoxelGeometry}.
|
|
7
6
|
*
|
|
@@ -68,5 +67,4 @@ export declare class VoxelGeometry extends BufferGeometry {
|
|
|
68
67
|
constructor(voxels?: Map3D, options?: Omit<BuildVoxelGeometryOptions, 'target'>);
|
|
69
68
|
/** Rebuilds the geometry from `voxels` and `options`. */
|
|
70
69
|
update(): this;
|
|
71
|
-
}
|
|
72
|
-
//#endregion
|
|
70
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Random } from "../random.js";
|
|
2
1
|
import { Map3D } from "../map3d.js";
|
|
2
|
+
import { Random } from "../random.js";
|
|
3
3
|
import { BufferGeometry, Color, Float32BufferAttribute } from "three";
|
|
4
|
-
|
|
4
|
+
// src/three/voxel-geometry.ts
|
|
5
5
|
const cellKey = (u, v) => (u + 33554432) * 67108864 + (v + 33554432);
|
|
6
6
|
const planeKey = (d, side, slice) => (slice + 33554432) * 8 + d * 2 + (side > 0 ? 1 : 0);
|
|
7
7
|
/**
|
|
@@ -227,5 +227,4 @@ var VoxelGeometry = class extends BufferGeometry {
|
|
|
227
227
|
return this;
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
|
-
//#endregion
|
|
231
230
|
export { VoxelGeometry, buildVoxelGeometry };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Map3D } from "../map3d.js";
|
|
2
2
|
import { BuildVoxelGeometryOptions, VoxelGeometry } from "./voxel-geometry.js";
|
|
3
3
|
import { Material, Mesh } from "three";
|
|
4
|
-
//#region src/three/voxel-mesh.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Box of voxel cells a {@link VoxelMesh} accepts, from the origin.
|
|
7
6
|
*
|
|
@@ -63,5 +62,4 @@ export declare class VoxelMesh extends Mesh<VoxelGeometry, Material | Material[]
|
|
|
63
62
|
invalidate(): void;
|
|
64
63
|
/** Rebuilds the geometry if the voxels changed; returns whether it did. */
|
|
65
64
|
update(): boolean;
|
|
66
|
-
}
|
|
67
|
-
//#endregion
|
|
65
|
+
}
|
package/dist/three/voxel-mesh.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Map3D } from "../map3d.js";
|
|
2
2
|
import { VoxelGeometry } from "./voxel-geometry.js";
|
|
3
3
|
import { Mesh, MeshLambertMaterial } from "three";
|
|
4
|
-
|
|
4
|
+
// src/three/voxel-mesh.ts
|
|
5
5
|
/**
|
|
6
6
|
* Editable voxel model: `set()` voxels, then `update()` rebuilds the geometry if anything changed.
|
|
7
7
|
* Voxel values are palette indices; `Map3D`'s default value (-1) means empty.
|
|
@@ -67,5 +67,4 @@ var VoxelMesh = class extends Mesh {
|
|
|
67
67
|
return true;
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
|
-
//#endregion
|
|
71
70
|
export { VoxelMesh };
|
package/dist/three/world.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ThreeEntity } from "./ecs.js";
|
|
2
2
|
import { ComponentRegistry, ComponentType } from "./schema.js";
|
|
3
3
|
import { Object3D } from "three";
|
|
4
|
-
//#region src/three/world.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* A scene of entities: three.js objects with components (see {@link CreateThreeEntity}),
|
|
7
6
|
* tracked by their `Object3D.uuid`.
|
|
@@ -188,5 +187,4 @@ export interface EntityDoc {
|
|
|
188
187
|
/** component JSON by type name */
|
|
189
188
|
components: Record<string, Record<string, unknown>>;
|
|
190
189
|
}
|
|
191
|
-
//#endregion
|
|
192
190
|
export {};
|
package/dist/three/world.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateThreeEntity, IsThreeEntity } from "./ecs.js";
|
|
2
2
|
import { componentToJson, components } from "./schema.js";
|
|
3
3
|
import { MathUtils, Scene } from "three";
|
|
4
|
-
|
|
4
|
+
// src/three/world.ts
|
|
5
5
|
/**
|
|
6
6
|
* A scene of entities: three.js objects with components (see {@link CreateThreeEntity}),
|
|
7
7
|
* tracked by their `Object3D.uuid`.
|
|
@@ -359,5 +359,4 @@ var World = class {
|
|
|
359
359
|
};
|
|
360
360
|
const SCENE_FORMAT = "n3rdw1z4rd.scene";
|
|
361
361
|
const SCENE_VERSION = 1;
|
|
362
|
-
//#endregion
|
|
363
362
|
export { SCENE_FORMAT, SCENE_VERSION, World };
|