@woosh/meep-engine 2.78.1 → 2.80.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/build/meep.cjs +235 -233
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +235 -233
- package/package.json +1 -1
- package/src/core/geom/2d/aabb/AABB2.js +6 -18
- package/src/core/geom/3d/SurfacePoint3.spec.js +1 -1
- package/src/core/geom/3d/{matrix → mat4}/m4_multiply.spec.js +3 -4
- package/src/core/geom/3d/{matrix → mat4}/m4_multiply_alphatensor.spec.js +3 -3
- package/src/core/geom/3d/morton/v3_morton_encode_transformed.spec.js +1 -1
- package/src/core/geom/3d/sphere/sphere_radius_sqr_from_v3_array_transformed.spec.js +1 -1
- package/src/core/geom/Quaternion.js +1 -1
- package/src/core/geom/Vector3.js +2 -2
- package/src/core/geom/Vector3.spec.js +2 -2
- package/src/core/geom/packing/max-rect/{MaxRectangles.js → MaxRectanglesPacker.js} +25 -32
- package/src/core/geom/packing/max-rect/MaxRectanglesPacker.spec.js +60 -0
- package/src/core/geom/packing/max-rect/packMaxRectangles.js +19 -0
- package/src/core/geom/vec3/v3_angle_between.js +15 -4
- package/src/core/geom/vec3/{v3_computeOffsetVector.js → v3_displace_in_direction.js} +11 -2
- package/src/core/graph/cluster_mesh_metis.js +3 -3
- package/src/core/graph/metis/metis.js +16 -1
- package/src/core/graph/metis/metis_options.js +32 -29
- package/src/core/math/interval/overlap1D.js +7 -0
- package/src/core/math/noise/create_simplex_noise_2d.js +4 -0
- package/src/core/math/spline/computeCatmullRomSplineUniformDistance.js +3 -3
- package/src/core/math/spline/v3_computeCatmullRomSplineUniformDistance.js +42 -0
- package/src/core/model/node-graph/node/NodeDescription.js +12 -10
- package/src/core/model/node-graph/node/NodeDescription.spec.js +14 -1
- package/src/core/model/object/objectKeyByValue.js +3 -2
- package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +2 -2
- package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +2 -2
- package/src/engine/ecs/renderable/Renderable.js +1 -1
- package/src/engine/ecs/terrain/ecs/TerrainSystem.js +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTile.spec.js +2 -2
- package/src/engine/ecs/transform/Transform.js +3 -3
- package/src/engine/ecs/transform/Transform.spec.js +3 -3
- package/src/engine/ecs/transform-attachment/TransformAttachment.js +2 -1
- package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.js +45 -33
- package/src/engine/graphics/ecs/path/entity/testEntityPath.js +16 -10
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +1 -1
- package/src/engine/graphics/texture/atlas/TextureAtlas.js +1 -1
- package/src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.js +3 -3
- package/src/engine/graphics/three/expand_aabb_by_transformed_three_object.js +1 -1
- package/src/engine/graphics/three/expand_aabb_by_transformed_three_object.spec.js +2 -2
- package/src/engine/navigation/ecs/components/Path.js +5 -12
- package/src/engine/simulation/Ticker.js +40 -61
- package/src/core/geom/LineSegment.js +0 -207
- package/src/core/primitives/strings/prefixTree/PrefixTree.js +0 -225
- package/src/core/primitives/strings/prefixTree/PrefixTree.spec.js +0 -39
- package/src/core/primitives/strings/prefixTree/PrefixTreeLeaf.js +0 -25
- package/src/core/primitives/strings/prefixTree/PrefixTreeNode.js +0 -16
- /package/src/core/geom/3d/{matrix → mat4}/MATRIX_4_IDENTITY.js +0 -0
- /package/src/core/geom/3d/{matrix → mat4}/MATRIX_4_IDENTITY.spec.js +0 -0
- /package/src/core/geom/3d/{matrix → mat4}/allocate_transform_m4.js +0 -0
- /package/src/core/geom/3d/{matrix → mat4}/m4_make_translation.js +0 -0
- /package/src/core/geom/3d/{matrix → mat4}/m4_multiply.js +0 -0
- /package/src/core/geom/3d/{matrix → mat4}/m4_multiply_alphatensor.js +0 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {assert} from "../../../assert.js";
|
|
2
|
-
import {isArrayEqual} from "../../../collection/array/isArrayEqual.js";
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
2
|
+
import { isArrayEqual } from "../../../collection/array/isArrayEqual.js";
|
|
3
3
|
import Signal from "../../../events/signal/Signal.js";
|
|
4
|
-
import {invokeObjectToJSON} from "../../object/invokeObjectToJSON.js";
|
|
5
|
-
import {NodeParameterDataType} from "./parameter/NodeParameterDataType.js";
|
|
6
|
-
import {NodeParameterDescription} from "./parameter/NodeParameterDescription.js";
|
|
7
|
-
import {Port} from "./Port.js";
|
|
8
|
-
import {PortDirection} from "./PortDirection.js";
|
|
4
|
+
import { invokeObjectToJSON } from "../../object/invokeObjectToJSON.js";
|
|
5
|
+
import { NodeParameterDataType } from "./parameter/NodeParameterDataType.js";
|
|
6
|
+
import { NodeParameterDescription } from "./parameter/NodeParameterDescription.js";
|
|
7
|
+
import { Port } from "./Port.js";
|
|
8
|
+
import { PortDirection } from "./PortDirection.js";
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
+
* @template T
|
|
12
13
|
* @private
|
|
13
|
-
* @param {
|
|
14
|
+
* @param {T[]} things
|
|
14
15
|
* @returns {number}
|
|
15
16
|
*/
|
|
16
17
|
function pickNewSetId(things) {
|
|
@@ -181,7 +182,7 @@ export class NodeDescription {
|
|
|
181
182
|
|
|
182
183
|
/**
|
|
183
184
|
*
|
|
184
|
-
* @param {
|
|
185
|
+
* @param {DataType} type
|
|
185
186
|
* @param {String} name
|
|
186
187
|
* @param {PortDirection} direction
|
|
187
188
|
*/
|
|
@@ -338,6 +339,7 @@ export class NodeDescription {
|
|
|
338
339
|
}
|
|
339
340
|
}
|
|
340
341
|
|
|
342
|
+
// port not found
|
|
341
343
|
return undefined;
|
|
342
344
|
}
|
|
343
345
|
|
|
@@ -380,7 +382,7 @@ export class NodeDescription {
|
|
|
380
382
|
* @param name
|
|
381
383
|
* @param {NodeRegistry} registry
|
|
382
384
|
*/
|
|
383
|
-
fromJSON({ports, id, name}, registry) {
|
|
385
|
+
fromJSON({ ports, id, name }, registry) {
|
|
384
386
|
this.id = id;
|
|
385
387
|
this.name = name;
|
|
386
388
|
this.ports = ports.map(p => Port.fromJSON(p, registry));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NodeDescription } from "./NodeDescription.js";
|
|
2
1
|
import { DataType } from "../DataType.js";
|
|
2
|
+
import { NodeDescription } from "./NodeDescription.js";
|
|
3
3
|
import { PortDirection } from "./PortDirection.js";
|
|
4
4
|
|
|
5
5
|
const DUMMY_TYPE = DataType.from(0, 'dummy');
|
|
@@ -12,3 +12,16 @@ test('ports are assigned unique IDs', () => {
|
|
|
12
12
|
|
|
13
13
|
expect(id_a).not.toEqual(id_b);
|
|
14
14
|
});
|
|
15
|
+
|
|
16
|
+
test("get port by ID", () => {
|
|
17
|
+
const node = new NodeDescription();
|
|
18
|
+
|
|
19
|
+
expect(node.getPortById(1)).toBeNull();
|
|
20
|
+
|
|
21
|
+
const id = node.createPort(DUMMY_TYPE, "a", PortDirection.In);
|
|
22
|
+
|
|
23
|
+
const port = node.getPortById(id);
|
|
24
|
+
|
|
25
|
+
expect(port).not.toBeNull();
|
|
26
|
+
expect(port.name).toBe("a");
|
|
27
|
+
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Given an object and a value, find the first property with matching value and returns name of that property
|
|
3
|
+
* Useful for working with ENUM-like objects
|
|
3
4
|
* @param {Object<T>} object
|
|
4
5
|
* @param {T} value
|
|
5
|
-
* @returns {string|undefined}
|
|
6
|
+
* @returns {string|undefined} name of the property, or undefined if property not found
|
|
6
7
|
*/
|
|
7
8
|
export function objectKeyByValue(object, value) {
|
|
8
9
|
for (let i in object) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SurfacePoint3 } from "../../../core/geom/3d/SurfacePoint3.js";
|
|
2
2
|
import Quaternion from "../../../core/geom/Quaternion.js";
|
|
3
|
-
import {
|
|
3
|
+
import { v3_displace_in_direction } from "../../../core/geom/vec3/v3_displace_in_direction.js";
|
|
4
4
|
import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
|
|
5
5
|
import { v3_length } from "../../../core/geom/vec3/v3_length.js";
|
|
6
6
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
@@ -116,7 +116,7 @@ export class OneBoneSurfaceAlignmentSolver extends IKSolver {
|
|
|
116
116
|
|
|
117
117
|
const targetOffsetDistance = constraint.offset * bone_scale;
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
v3_displace_in_direction(
|
|
120
120
|
targetPosition,
|
|
121
121
|
targetOffsetDistance,
|
|
122
122
|
contactPosition.x, contactPosition.y, contactPosition.z,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assert } from "../../../core/assert.js";
|
|
2
2
|
import { SurfacePoint3 } from "../../../core/geom/3d/SurfacePoint3.js";
|
|
3
3
|
import Quaternion from "../../../core/geom/Quaternion.js";
|
|
4
|
-
import {
|
|
4
|
+
import { v3_displace_in_direction } from "../../../core/geom/vec3/v3_displace_in_direction.js";
|
|
5
5
|
import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
|
|
6
6
|
import { v3_length } from "../../../core/geom/vec3/v3_length.js";
|
|
7
7
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
@@ -255,7 +255,7 @@ export class TwoBoneInverseKinematicsSolver extends IKSolver {
|
|
|
255
255
|
|
|
256
256
|
const targetOffsetDistance = constraint.offset * limbLength;
|
|
257
257
|
|
|
258
|
-
|
|
258
|
+
v3_displace_in_direction(
|
|
259
259
|
targetPosition,
|
|
260
260
|
targetOffsetDistance,
|
|
261
261
|
contactPosition.x, contactPosition.y, contactPosition.z,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { BvhClient } from "../../../core/bvh2/bvh3/BvhClient.js";
|
|
7
7
|
import { AABB3 } from "../../../core/geom/3d/aabb/AABB3.js";
|
|
8
|
-
import { MATRIX_4_IDENTITY } from "../../../core/geom/3d/
|
|
8
|
+
import { MATRIX_4_IDENTITY } from "../../../core/geom/3d/mat4/MATRIX_4_IDENTITY.js";
|
|
9
9
|
import {
|
|
10
10
|
expand_aabb_by_transformed_three_object
|
|
11
11
|
} from "../../graphics/three/expand_aabb_by_transformed_three_object.js";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
|
|
6
6
|
import { noop } from "../../../../core/function/Functions.js";
|
|
7
7
|
import { read_three_planes_to_array } from "../../../../core/geom/3d/frustum/read_three_planes_to_array.js";
|
|
8
|
-
import { MATRIX_4_IDENTITY } from "../../../../core/geom/3d/
|
|
8
|
+
import { MATRIX_4_IDENTITY } from "../../../../core/geom/3d/mat4/MATRIX_4_IDENTITY.js";
|
|
9
9
|
import { ImageRGBADataLoader } from "../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
10
10
|
import { CameraSystem } from '../../../graphics/ecs/camera/CameraSystem.js';
|
|
11
11
|
import { System } from '../../System.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { MATRIX_4_IDENTITY } from "../../../../core/geom/3d/mat4/MATRIX_4_IDENTITY.js";
|
|
1
2
|
import TerrainTile from "./TerrainTile.js";
|
|
2
|
-
import { MATRIX_4_IDENTITY } from "../../../../core/geom/3d/matrix/MATRIX_4_IDENTITY.js";
|
|
3
3
|
|
|
4
4
|
test("constructor does not throw", () => {
|
|
5
5
|
new TerrainTile();
|
|
@@ -21,5 +21,5 @@ test("using 'dispose' method on newly created tile", () => {
|
|
|
21
21
|
const tile = new TerrainTile();
|
|
22
22
|
|
|
23
23
|
expect(() => tile.dispose()).not.toThrow();
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
});
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import { assert } from "../../../core/assert.js";
|
|
6
6
|
import { compose_matrix4_array } from "../../../core/geom/3d/compose_matrix4_array.js";
|
|
7
7
|
import { decompose_matrix_4_array } from "../../../core/geom/3d/decompose_matrix_4_array.js";
|
|
8
|
-
import { allocate_transform_m4 } from "../../../core/geom/3d/
|
|
9
|
-
import { m4_multiply } from "../../../core/geom/3d/
|
|
10
|
-
import { MATRIX_4_IDENTITY } from "../../../core/geom/3d/
|
|
8
|
+
import { allocate_transform_m4 } from "../../../core/geom/3d/mat4/allocate_transform_m4.js";
|
|
9
|
+
import { m4_multiply } from "../../../core/geom/3d/mat4/m4_multiply.js";
|
|
10
|
+
import { MATRIX_4_IDENTITY } from "../../../core/geom/3d/mat4/MATRIX_4_IDENTITY.js";
|
|
11
11
|
import Quaternion from "../../../core/geom/Quaternion.js";
|
|
12
12
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
13
13
|
import { TransformFlags } from "./TransformFlags.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import Vector3 from "../../../core/geom/Vector3.js";
|
|
1
|
+
import { MATRIX_4_IDENTITY } from "../../../core/geom/3d/mat4/MATRIX_4_IDENTITY.js";
|
|
3
2
|
import Quaternion from "../../../core/geom/Quaternion.js";
|
|
4
|
-
import
|
|
3
|
+
import Vector3 from "../../../core/geom/Vector3.js";
|
|
4
|
+
import { Transform } from "./Transform.js";
|
|
5
5
|
import { TransformFlags } from "./TransformFlags.js";
|
|
6
6
|
|
|
7
7
|
test("constructor does not throw", () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Transform } from "../transform/Transform.js";
|
|
2
1
|
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import { Transform } from "../transform/Transform.js";
|
|
3
3
|
|
|
4
4
|
export const TransformAttachmentFlags = {
|
|
5
5
|
/**
|
|
@@ -15,6 +15,7 @@ export class TransformAttachment {
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* transform relative to the attachment target
|
|
18
|
+
* Think of it as "local transform"
|
|
18
19
|
* @type {Transform}
|
|
19
20
|
*/
|
|
20
21
|
transform = new Transform();
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { min2 } from "../../../core/math/min2.js";
|
|
2
|
+
import { ResourceAccessKind } from "../../../core/model/ResourceAccessKind.js";
|
|
3
|
+
import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
|
|
1
4
|
import { System } from "../System.js";
|
|
2
|
-
import { TransformAttachment, TransformAttachmentFlags } from "./TransformAttachment.js";
|
|
3
5
|
import { Transform } from "../transform/Transform.js";
|
|
4
|
-
import {
|
|
6
|
+
import { TransformAttachment, TransformAttachmentFlags } from "./TransformAttachment.js";
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* @readonly
|
|
@@ -47,7 +49,10 @@ class UpdateContext {
|
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
update() {
|
|
50
|
-
this.transform.multiplyTransforms(
|
|
52
|
+
this.transform.multiplyTransforms(
|
|
53
|
+
this.parent_transform,
|
|
54
|
+
this.attachment.transform
|
|
55
|
+
);
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
/**
|
|
@@ -70,51 +75,51 @@ class UpdateContext {
|
|
|
70
75
|
link() {
|
|
71
76
|
const t_parent = this.parent_transform;
|
|
72
77
|
|
|
73
|
-
t_parent.
|
|
74
|
-
t_parent.rotation.onChanged.add(this.update, this);
|
|
75
|
-
t_parent.scale.onChanged.add(this.update, this);
|
|
78
|
+
t_parent.subscribe(this.update, this);
|
|
76
79
|
|
|
77
80
|
const t_attachment = this.attachment.transform;
|
|
78
|
-
|
|
79
|
-
t_attachment.
|
|
80
|
-
t_attachment.scale.onChanged.add(this.update,this);
|
|
81
|
+
|
|
82
|
+
t_attachment.subscribe(this.update, this);
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
unlink() {
|
|
84
86
|
const transform = this.parent_transform;
|
|
85
87
|
|
|
86
|
-
transform.
|
|
87
|
-
transform.rotation.onChanged.remove(this.update, this);
|
|
88
|
-
transform.scale.onChanged.remove(this.update, this);
|
|
88
|
+
transform.unsubscribe(this.update, this);
|
|
89
89
|
|
|
90
90
|
const t_attachment = this.attachment.transform;
|
|
91
|
-
|
|
92
|
-
t_attachment.
|
|
93
|
-
t_attachment.scale.onChanged.remove(this.update,this);
|
|
91
|
+
|
|
92
|
+
t_attachment.unsubscribe(this.update, this);
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
export class TransformAttachmentSystem extends System {
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
* @type {UpdateContext[]}
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
__contexts = [];
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
*
|
|
107
|
+
* @type {UpdateContext[]}
|
|
108
|
+
* @private
|
|
109
|
+
*/
|
|
110
|
+
__queue = [];
|
|
111
|
+
__queue_size = 0;
|
|
112
|
+
__queue_cursor = 0;
|
|
113
|
+
|
|
98
114
|
constructor() {
|
|
99
115
|
super();
|
|
100
116
|
|
|
101
117
|
this.dependencies = [TransformAttachment, Transform];
|
|
102
118
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
*/
|
|
108
|
-
this.__contexts = [];
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
*
|
|
112
|
-
* @type {UpdateContext[]}
|
|
113
|
-
* @private
|
|
114
|
-
*/
|
|
115
|
-
this.__queue = [];
|
|
116
|
-
this.__queue_size = 0;
|
|
117
|
-
this.__queue_cursor = 0;
|
|
119
|
+
this.components_used = [
|
|
120
|
+
ResourceAccessSpecification.from(TransformAttachment, ResourceAccessKind.Read),
|
|
121
|
+
ResourceAccessSpecification.from(Transform, ResourceAccessKind.Read | ResourceAccessKind.Write),
|
|
122
|
+
];
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
/**
|
|
@@ -142,6 +147,12 @@ export class TransformAttachmentSystem extends System {
|
|
|
142
147
|
this.__queue[this.__queue_size++] = ctx;
|
|
143
148
|
}
|
|
144
149
|
|
|
150
|
+
/**
|
|
151
|
+
*
|
|
152
|
+
* @param {number} entity
|
|
153
|
+
* @returns {boolean}
|
|
154
|
+
* @private
|
|
155
|
+
*/
|
|
145
156
|
__dequeue_entity(entity) {
|
|
146
157
|
for (let i = 0; i < this.__queue_size; i++) {
|
|
147
158
|
const ctx = this.__queue[i];
|
|
@@ -170,9 +181,7 @@ export class TransformAttachmentSystem extends System {
|
|
|
170
181
|
ctx.entity = entity;
|
|
171
182
|
|
|
172
183
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
ctx.ecd = ecd;
|
|
184
|
+
ctx.ecd = this.entityManager.dataset;
|
|
176
185
|
|
|
177
186
|
if (ctx.bind_parent()) {
|
|
178
187
|
this.__finalize_link(ctx);
|
|
@@ -207,12 +216,14 @@ export class TransformAttachmentSystem extends System {
|
|
|
207
216
|
|
|
208
217
|
update(timeDelta) {
|
|
209
218
|
const step_count = min2(this.__queue_size, QUEUE_ITERATION_COUNT);
|
|
219
|
+
|
|
210
220
|
for (let i = 0; i < step_count; i++) {
|
|
211
221
|
const index = this.__queue_cursor % this.__queue_size;
|
|
212
222
|
|
|
213
223
|
const ctx = this.__queue[index];
|
|
214
224
|
|
|
215
225
|
if (ctx.bind_parent()) {
|
|
226
|
+
// parent obtained
|
|
216
227
|
this.__finalize_link(ctx);
|
|
217
228
|
|
|
218
229
|
this.__queue.splice(index, 1);
|
|
@@ -222,5 +233,6 @@ export class TransformAttachmentSystem extends System {
|
|
|
222
233
|
this.__queue_cursor++;
|
|
223
234
|
}
|
|
224
235
|
}
|
|
236
|
+
|
|
225
237
|
}
|
|
226
238
|
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import RenderSystem from "../../../../ecs/systems/RenderSystem.js";
|
|
2
|
-
import { makeEngineOptionsModel } from "../../../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
3
1
|
import { makeMirEngineConfig } from "../../../../../../../model/game/makeMirEngineConfig.js";
|
|
4
|
-
import {
|
|
5
|
-
import { EntityPath } from "./EntityPath.js";
|
|
6
|
-
import Path from "../../../../navigation/ecs/components/Path.js";
|
|
2
|
+
import { makeEngineOptionsModel } from "../../../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
7
3
|
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
8
|
-
import {
|
|
9
|
-
|
|
4
|
+
import {
|
|
5
|
+
v3_computeCatmullRomSplineUniformDistance
|
|
6
|
+
} from "../../../../../core/math/spline/v3_computeCatmullRomSplineUniformDistance.js";
|
|
7
|
+
import { Animation } from "../../../../ecs/animation/Animation.js";
|
|
10
8
|
import { EntityBlueprint } from "../../../../ecs/EntityBlueprint.js";
|
|
9
|
+
import RenderSystem from "../../../../ecs/systems/RenderSystem.js";
|
|
11
10
|
import { Transform } from "../../../../ecs/transform/Transform.js";
|
|
11
|
+
import { EngineHarness } from "../../../../EngineHarness.js";
|
|
12
|
+
import Path from "../../../../navigation/ecs/components/Path.js";
|
|
12
13
|
import Mesh from "../../mesh/Mesh.js";
|
|
13
|
-
import {
|
|
14
|
+
import { EntityPath } from "./EntityPath.js";
|
|
15
|
+
import { EntityPathMarkerDefinition } from "./EntityPathMarkerDefinition.js";
|
|
16
|
+
import { EntityPathStyle } from "./EntityPathStyle.js";
|
|
14
17
|
|
|
15
18
|
const engineHarness = new EngineHarness();
|
|
16
19
|
|
|
@@ -38,12 +41,15 @@ function main(engine) {
|
|
|
38
41
|
|
|
39
42
|
const path = new EntityPath();
|
|
40
43
|
const _p = new Path();
|
|
41
|
-
|
|
44
|
+
|
|
45
|
+
const curve_points = v3_computeCatmullRomSplineUniformDistance([
|
|
42
46
|
new Vector3(3, 0, 3),
|
|
43
47
|
new Vector3(7, 0, 3),
|
|
44
48
|
new Vector3(7, 0, 7),
|
|
45
49
|
new Vector3(3, 0, 7)
|
|
46
|
-
], 50)
|
|
50
|
+
], 50);
|
|
51
|
+
|
|
52
|
+
_p.setPositionsFromVectorArray(curve_points);
|
|
47
53
|
|
|
48
54
|
const style = new EntityPathStyle();
|
|
49
55
|
style.spacing = 1;
|
|
@@ -16,7 +16,7 @@ import { typedArrayToDataType } from "../../../../core/collection/array/typed/ty
|
|
|
16
16
|
import { collectIteratorValueToArray } from "../../../../core/collection/collectIteratorValueToArray.js";
|
|
17
17
|
import { HashMap } from "../../../../core/collection/map/HashMap.js";
|
|
18
18
|
import AABB2 from "../../../../core/geom/AABB2.js";
|
|
19
|
-
import { MaxRectanglesPacker } from "../../../../core/geom/packing/max-rect/
|
|
19
|
+
import { MaxRectanglesPacker } from "../../../../core/geom/packing/max-rect/MaxRectanglesPacker.js";
|
|
20
20
|
import { computeMaterialEquality } from "../../../asset/loaders/material/computeMaterialEquality.js";
|
|
21
21
|
import { computeMaterialHash } from "../../../asset/loaders/material/computeMaterialHash.js";
|
|
22
22
|
import { TextureAttachmentsByMaterialType } from "../../../asset/loaders/material/TextureAttachmensByMaterialType.js";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
DataType2TypedArrayConstructorMapping
|
|
6
6
|
} from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
7
7
|
import Signal from "../../../../core/events/signal/Signal.js";
|
|
8
|
-
import { MaxRectanglesPacker } from "../../../../core/geom/packing/max-rect/
|
|
8
|
+
import { MaxRectanglesPacker } from "../../../../core/geom/packing/max-rect/MaxRectanglesPacker.js";
|
|
9
9
|
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
10
10
|
import IdPool from "../../../../core/IdPool.js";
|
|
11
11
|
import { max2 } from "../../../../core/math/max2.js";
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { AtlasPatch } from "../AtlasPatch.js";
|
|
2
|
-
import IdPool from "../../../../../core/IdPool.js";
|
|
3
|
-
import { MaxRectanglesPacker } from "../../../../../core/geom/packing/max-rect/MaxRectangles.js";
|
|
4
1
|
import {
|
|
5
2
|
ClampToEdgeWrapping,
|
|
6
3
|
DataTexture,
|
|
@@ -11,7 +8,10 @@ import {
|
|
|
11
8
|
UnsignedByteType,
|
|
12
9
|
UVMapping
|
|
13
10
|
} from "three";
|
|
11
|
+
import { MaxRectanglesPacker } from "../../../../../core/geom/packing/max-rect/MaxRectanglesPacker.js";
|
|
12
|
+
import IdPool from "../../../../../core/IdPool.js";
|
|
14
13
|
import { formatToChannelCount } from "../../formatToChannelCount.js";
|
|
14
|
+
import { AtlasPatch } from "../AtlasPatch.js";
|
|
15
15
|
|
|
16
16
|
export class WebGLTextureAtlas {
|
|
17
17
|
constructor({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { aabb3_array_combine } from "../../../core/geom/3d/aabb/aabb3_array_combine.js";
|
|
2
2
|
import { aabb3_from_threejs_geometry } from "../../../core/geom/3d/aabb/aabb3_from_threejs_geometry.js";
|
|
3
3
|
import { aabb3_matrix4_project } from "../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
|
|
4
|
-
import { m4_multiply } from "../../../core/geom/3d/
|
|
4
|
+
import { m4_multiply } from "../../../core/geom/3d/mat4/m4_multiply.js";
|
|
5
5
|
import { ensureGeometryBoundingBox } from "../util/ensureGeometryBoundingBox.js";
|
|
6
6
|
|
|
7
7
|
const scratch_aabb3_array_0 = new Float32Array(6);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { expand_aabb_by_transformed_three_object } from "./expand_aabb_by_transformed_three_object.js";
|
|
2
|
-
import { MATRIX_4_IDENTITY } from "../../../core/geom/3d/matrix/MATRIX_4_IDENTITY.js";
|
|
3
1
|
import { BufferAttribute, BufferGeometry, Group, Mesh } from "three";
|
|
2
|
+
import { MATRIX_4_IDENTITY } from "../../../core/geom/3d/mat4/MATRIX_4_IDENTITY.js";
|
|
3
|
+
import { expand_aabb_by_transformed_three_object } from "./expand_aabb_by_transformed_three_object.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
import { CatmullRomCurve3 } from "three";
|
|
7
6
|
import { assert } from "../../../../core/assert.js";
|
|
8
7
|
import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
9
8
|
import { RowFirstTable } from "../../../../core/collection/table/RowFirstTable.js";
|
|
@@ -18,6 +17,9 @@ import { min2 } from "../../../../core/math/min2.js";
|
|
|
18
17
|
import {
|
|
19
18
|
computeNonuniformCatmullRomSplineSample
|
|
20
19
|
} from "../../../../core/math/spline/computeNonuniformCatmullRomSplineSample.js";
|
|
20
|
+
import {
|
|
21
|
+
v3_computeCatmullRomSplineUniformDistance
|
|
22
|
+
} from "../../../../core/math/spline/v3_computeCatmullRomSplineUniformDistance.js";
|
|
21
23
|
import { AttributeSpec } from "../../../graphics/geometry/AttributeSpec.js";
|
|
22
24
|
import { VertexDataSpec } from "../../../graphics/geometry/VertexDataSpec.js";
|
|
23
25
|
import { InterpolationType } from "./InterpolationType.js";
|
|
@@ -701,22 +703,13 @@ class Path {
|
|
|
701
703
|
}
|
|
702
704
|
|
|
703
705
|
/**
|
|
704
|
-
*
|
|
706
|
+
* @deprecated use {@link v3_computeCatmullRomSplineUniformDistance} directly instead
|
|
705
707
|
* @param {Vector3[]} points
|
|
706
708
|
* @param {number} samples
|
|
707
709
|
* @returns {Vector3[]}
|
|
708
710
|
*/
|
|
709
711
|
static smoothPath(points, samples) {
|
|
710
|
-
|
|
711
|
-
const curve = new CatmullRomCurve3(points);
|
|
712
|
-
const points2 = curve.getPoints(samples);
|
|
713
|
-
|
|
714
|
-
//Convert to engine vector format
|
|
715
|
-
const result = points2.map(function (p) {
|
|
716
|
-
return new Vector3(p.x, p.y, p.z);
|
|
717
|
-
});
|
|
718
|
-
|
|
719
|
-
return result;
|
|
712
|
+
throw new Error('Deprecated, use v3_computeCatmullRomSplineUniformDistance directly instead. Please note, there is already a CatmullRom interpolation type as well');
|
|
720
713
|
}
|
|
721
714
|
}
|
|
722
715
|
|