@woosh/meep-engine 2.48.23 → 2.49.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/editor/tools/GridPaintTool.js +1 -1
- package/editor/tools/paint/TerrainPaintTool.js +1 -1
- package/editor/view/GridPickCoordinateView.js +1 -1
- package/package.json +1 -1
- package/src/core/UUID.js +2 -0
- package/src/core/assert.js +4 -1
- package/src/core/binary/ctz32.js +1 -1
- package/src/core/binary/operations/bitCount.spec.js +19 -0
- package/src/core/binary/uint82float.spec.js +7 -0
- package/src/core/bvh2/bvh3/EBBVHLeafProxy.js +3 -0
- package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js +5 -4
- package/src/core/bvh2/transform/RotationOptimizer.spec.js +161 -155
- package/src/core/codegen/LineBuilder.js +12 -3
- package/src/core/codegen/LineBuilder.spec.js +7 -0
- package/src/core/collection/HashMap.js +486 -237
- package/src/core/collection/HashMap.spec.js +110 -1
- package/src/core/collection/array/{typedArrayToDataType.js → typed/typedArrayToDataType.js} +1 -1
- package/src/core/collection/array/weightedRandomFromArray.spec.js +20 -0
- package/src/core/debug/matchers/AnyOf.js +1 -2
- package/src/core/geom/2d/aabb/AABB2.spec.js +1 -1
- package/src/core/geom/2d/aabb/aabb2_compute_center_from_multiple.js +19 -0
- package/src/core/geom/2d/quad-tree/qt_collect_by_circle.js +3 -3
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.js +7 -9
- package/src/core/geom/3d/aabb/aabb3_compute_plane_side.js +17 -15
- package/src/core/geom/3d/aabb/aabb3_compute_plane_side.spec.js +25 -0
- package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.js +1 -1
- package/src/core/geom/3d/aabb/aabb3_from_v3_array.js +3 -0
- package/src/core/geom/3d/aabb/aabb3_from_v3_array.spec.js +32 -0
- package/src/core/geom/3d/aabb/aabb3_intersects_aabb3.spec.js +115 -0
- package/src/core/geom/3d/aabb/aabb3_raycast.js +6 -1
- package/src/core/geom/3d/aabb/serializeAABB3Encoded_v0.js +6 -6
- package/src/core/geom/3d/{CircleMath.js → compute_circle_bounding_box.js} +1 -1
- package/src/core/geom/3d/decompose_matrix_4_array.js +18 -19
- package/src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +1 -1
- package/src/{engine/graphics/ecs/mesh-v2 → core/geom/3d/matrix}/allocate_transform_m4.js +1 -1
- package/src/core/geom/3d/normal/hemioct/decode_hemioct_to_unit.js +26 -0
- package/src/core/geom/3d/normal/hemioct/encode_unit3_hemioct.js +0 -26
- package/src/core/geom/3d/normal/hemioct/unit_hemioct.spec.js +2 -1
- package/src/core/geom/3d/plane/computePlaneLineIntersection.js +51 -0
- package/src/core/geom/3d/plane/computePlanePlaneIntersection.js +77 -0
- package/src/core/geom/3d/plane/computePlaneRayIntersection.js +55 -0
- package/src/core/geom/3d/plane/plane3_computeLineSegmentIntersection.js +50 -0
- package/src/core/geom/3d/plane/planeRayIntersection.js +14 -0
- package/src/core/geom/3d/{tetrahedra/in_sphere_fast.js → sphere/in_sphere3d_fast.js} +1 -1
- package/src/core/geom/3d/{tetrahedra/in_sphere_robust.js → sphere/in_sphere3d_robust.js} +1 -1
- package/src/core/geom/3d/sphere/sphere_array_intersects_point.js +2 -2
- package/src/core/geom/3d/sphere/{sphereIntersectsPoint.js → sphere_intersects_point.js} +7 -4
- package/src/core/geom/3d/sphere/sphere_intersects_point.spec.js +134 -0
- package/src/core/geom/3d/sphere/sphere_intersects_ray.spec.js +49 -0
- package/src/core/geom/3d/sphere/sphere_radius_sqr_from_v3_array_transformed.js +11 -7
- package/src/core/geom/3d/tetrahedra/delaunay/{debug_validate_mesh.js → debug/debug_validate_mesh.js} +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/{push_boundary_with_validation.js → debug/push_boundary_with_validation.js} +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/{validate_cavity_boundary.js → debug/validate_cavity_boundary.js} +2 -2
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_cavity.js +2 -2
- package/src/core/geom/3d/triangle/computeTriangleRayIntersection.js +0 -164
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.js +87 -0
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.js +81 -0
- package/src/core/geom/{rayTriangleIntersection.js → 3d/triangle/rayTriangleIntersection.js} +2 -2
- package/src/core/geom/ConicRay.js +160 -152
- package/src/core/geom/Matrix4.js +2 -0
- package/src/core/geom/Quaternion.js +19 -1
- package/src/core/geom/packing/max-rect/MaxRectangles.js +4 -214
- package/src/core/geom/packing/max-rect/cost/costByBestShortSide.js +11 -0
- package/src/core/geom/packing/max-rect/cost/costByRemainingArea.js +14 -0
- package/src/core/geom/packing/max-rect/cutArea.js +79 -0
- package/src/core/geom/packing/max-rect/findBestContainer.js +58 -0
- package/src/core/geom/packing/max-rect/packOneBox.js +49 -0
- package/src/core/geom/v3_dot.js +1 -1
- package/src/core/graph/layout/CircleLayout.js +1 -1
- package/src/core/graph/layout/{BoxLayouter.js → box/BoxLayouter.js} +6 -50
- package/src/core/graph/layout/box/applyCentralGravityAABB2.js +29 -0
- package/src/core/json/resolvePath.spec.js +14 -0
- package/src/core/land/reactive/{compiler/ReactiveCompiler.spec.js → compileReactiveExpression.spec.js} +17 -17
- package/src/core/math/random/MersenneTwister.spec.js +19 -0
- package/src/core/math/random/randomGaussian.spec.js +9 -0
- package/src/core/math/statistics/computeStatisticalMean.js +2 -2
- package/src/core/model/reactive/model/arithmetic/ReactiveAdd.js +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveDivide.js +3 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveMultiply.js +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveNegate.js +3 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveSubtract.js +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveEquals.js +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveGreaterThan.js +3 -1
- package/src/core/model/reactive/model/comparative/ReactiveGreaterThanOrEqual.js +3 -1
- package/src/core/model/reactive/model/comparative/ReactiveLessThan.js +3 -1
- package/src/core/model/reactive/model/comparative/ReactiveLessThanOrEqual.js +3 -1
- package/src/core/model/reactive/model/comparative/ReactiveNotEquals.js +1 -1
- package/src/core/model/reactive/model/logic/ReactiveAnd.js +1 -1
- package/src/core/model/reactive/model/logic/ReactiveNot.js +3 -1
- package/src/core/model/reactive/model/logic/ReactiveOr.js +1 -1
- package/src/core/primitives/numbers/computeHashFloat.spec.js +7 -0
- package/src/core/process/task/util/iteratorTask.js +3 -1
- package/src/engine/animation/curve/AnimationCurve.js +34 -5
- package/src/engine/animation/curve/AnimationCurve.spec.js +100 -0
- package/src/engine/asset/AssetTransformer.js +1 -0
- package/src/engine/computeStridedIntegerArrayHash.js +4 -2
- package/src/engine/ecs/components/Renderable.d.ts +1 -1
- package/src/{ecs → engine/ecs}/grid/pick.js +4 -4
- package/src/engine/ecs/parent/entity_node_compute_bounding_box.js +1 -1
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +1 -18
- package/src/engine/ecs/systems/MotionSystem.js +7 -1
- package/src/engine/ecs/systems/SynchronizePositionSystem.js +8 -2
- package/src/engine/ecs/transform/Transform.js +1 -1
- package/src/engine/graphics/camera/makeScreenScissorFrustum.js +3 -3
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +13 -13
- package/src/engine/graphics/ecs/camera/Camera.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.js +9 -0
- package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +1 -1
- package/src/engine/graphics/geometry/MikkT/STSpace.js +1 -1
- package/src/engine/graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js +1 -1
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +1 -1
- package/src/engine/graphics/particles/particular/engine/MovingBoundingBox.js +1 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +1 -0
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -1
- package/src/engine/graphics/postprocess/threejs/postprocessing/TexturePass.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +2 -2
- package/src/engine/graphics/texture/sampler/Sampler2D.js +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_compute_texel_value_conversion_scale_to_uint8.js +1 -1
- package/src/engine/intelligence/behavior/Behavior.spec.js +15 -0
- package/src/engine/intelligence/mcts/MoveEdge.js +1 -1
- package/src/engine/reference/v1/ReferenceManager.js +3 -0
- package/src/engine/reference/v2/Reference.js +33 -37
- package/src/engine/sound/sopra/README.md +6 -0
- package/src/generation/automata/CaveGeneratorCellularAutomata.js +10 -7
- package/src/generation/automata/CaveGeneratorCellularAutomata.spec.js +12 -0
- package/src/generation/automata/CellularAutomata.js +5 -4
- package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +25 -9
- package/src/view/minimap/dom/MinimapCameraView.js +1 -1
- package/src/core/geom/Plane.js +0 -250
- package/src/core/land/reactive/ReactiveLexer.js +0 -158
- package/src/core/land/reactive/ReactiveLexer.ts +0 -181
- package/src/core/land/reactive/ReactiveListener.ts +0 -323
- package/src/core/land/reactive/ReactiveParser.js +0 -1573
- package/src/core/land/reactive/ReactiveParser.ts +0 -1776
- package/src/core/land/reactive/ReactiveVisitor.js +0 -1
- package/src/core/land/reactive/ReactiveVisitor.ts +0 -218
- package/src/core/land/reactive/compiler/ReactiveCompiler.js +0 -350
- package/src/core/land/reactive/compiler/ReactiveNearlyCompiler.js +0 -166
- package/src/core/land/reactive/compiler/ReactiveParser.js +0 -34
- package/src/core/land/reactive/nearley/ReactiveNearley.js +0 -187
- /package/src/{engine/graphics/ecs/mesh-v2 → core/geom/3d/vector}/allocate_v3.js +0 -0
|
@@ -2,6 +2,7 @@ import { inverseLerp } from "../../../core/math/inverseLerp.js";
|
|
|
2
2
|
import { lerp } from "../../../core/math/lerp.js";
|
|
3
3
|
import { invokeObjectToJSON } from "../../../core/model/object/invokeObjectToJSON.js";
|
|
4
4
|
import { Keyframe } from "./Keyframe.js";
|
|
5
|
+
import { binarySearchHighIndex } from "../../../core/collection/array/binarySearchHighIndex.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
@@ -28,6 +29,16 @@ function evaluate(t, keyframe0, keyframe1) {
|
|
|
28
29
|
return a * keyframe0.value + b * m0 + c * m1 + d * keyframe1.value;
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param {number} time
|
|
35
|
+
* @param {Keyframe} keyframe
|
|
36
|
+
* @return {number}
|
|
37
|
+
*/
|
|
38
|
+
function compareKeyframeToTime(time, keyframe) {
|
|
39
|
+
return time - keyframe.time;
|
|
40
|
+
}
|
|
41
|
+
|
|
31
42
|
/**
|
|
32
43
|
* Modelled on unity's AnimationCurve
|
|
33
44
|
* @see https://github.com/nothke/ThreadableCurve/blob/master/ThreadableCurve.cs
|
|
@@ -46,8 +57,26 @@ export class AnimationCurve {
|
|
|
46
57
|
* @param {Keyframe} key
|
|
47
58
|
*/
|
|
48
59
|
add(key) {
|
|
49
|
-
|
|
50
|
-
|
|
60
|
+
const keys = this.keys;
|
|
61
|
+
|
|
62
|
+
const last_key_index = keys.length - 1;
|
|
63
|
+
|
|
64
|
+
if (
|
|
65
|
+
last_key_index < 0
|
|
66
|
+
|| keys[last_key_index].time <= key.time
|
|
67
|
+
) {
|
|
68
|
+
|
|
69
|
+
// inserted key goes at the end
|
|
70
|
+
keys.push(key);
|
|
71
|
+
|
|
72
|
+
} else {
|
|
73
|
+
|
|
74
|
+
// figure out the right place to insert the key
|
|
75
|
+
const i = binarySearchHighIndex(keys, key.time, compareKeyframeToTime, 0, last_key_index);
|
|
76
|
+
|
|
77
|
+
// insert key at the right place
|
|
78
|
+
keys.splice(i, 0, key);
|
|
79
|
+
}
|
|
51
80
|
}
|
|
52
81
|
|
|
53
82
|
/**
|
|
@@ -144,7 +173,7 @@ export class AnimationCurve {
|
|
|
144
173
|
/**
|
|
145
174
|
*
|
|
146
175
|
* @param {number} index
|
|
147
|
-
* @param {number} weight
|
|
176
|
+
* @param {number} weight value between 0 and 1
|
|
148
177
|
*/
|
|
149
178
|
smoothTangents(index, weight) {
|
|
150
179
|
const keys = this.keys;
|
|
@@ -173,10 +202,10 @@ export class AnimationCurve {
|
|
|
173
202
|
|
|
174
203
|
}
|
|
175
204
|
|
|
176
|
-
smoothAllTangents(){
|
|
205
|
+
smoothAllTangents() {
|
|
177
206
|
const n = this.length;
|
|
178
207
|
for (let i = 0; i < n; i++) {
|
|
179
|
-
this.smoothTangents(i,0);
|
|
208
|
+
this.smoothTangents(i, 0);
|
|
180
209
|
}
|
|
181
210
|
}
|
|
182
211
|
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { AnimationCurve } from "./AnimationCurve.js";
|
|
2
|
+
import { Keyframe } from "./Keyframe.js";
|
|
3
|
+
|
|
4
|
+
test("constructor does not throw", () => {
|
|
5
|
+
expect(() => new AnimationCurve()).not.toThrow();
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
test("adding key increases length", () => {
|
|
9
|
+
const curve = new AnimationCurve();
|
|
10
|
+
|
|
11
|
+
curve.add(Keyframe.from(1, 7));
|
|
12
|
+
|
|
13
|
+
expect(curve.length).toBe(1);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test("removing non-existent key", () => {
|
|
17
|
+
const curve = new AnimationCurve();
|
|
18
|
+
|
|
19
|
+
expect(curve.remove(Keyframe.from(1, 7))).toBe(false);
|
|
20
|
+
|
|
21
|
+
expect(curve.length).toBe(0);
|
|
22
|
+
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("clear removes all keys", () => {
|
|
26
|
+
|
|
27
|
+
const curve = new AnimationCurve();
|
|
28
|
+
|
|
29
|
+
curve.add(Keyframe.from(0, 0));
|
|
30
|
+
curve.add(Keyframe.from(0, 0));
|
|
31
|
+
|
|
32
|
+
curve.clear();
|
|
33
|
+
|
|
34
|
+
expect(curve.length).toBe(0);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("removing exising key", () => {
|
|
38
|
+
const curve = new AnimationCurve();
|
|
39
|
+
|
|
40
|
+
const key = Keyframe.from(1, 7);
|
|
41
|
+
|
|
42
|
+
curve.add(key);
|
|
43
|
+
|
|
44
|
+
expect(curve.remove(key)).toBe(true);
|
|
45
|
+
|
|
46
|
+
expect(curve.length).toBe(0);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
test("sample linear curve with 2 points", () => {
|
|
51
|
+
const curve = new AnimationCurve();
|
|
52
|
+
curve.add(Keyframe.from(0, -3, 6, 6));
|
|
53
|
+
curve.add(Keyframe.from(1, 3, 6, 6));
|
|
54
|
+
|
|
55
|
+
expect(curve.evaluate(0)).toBeCloseTo(-3);
|
|
56
|
+
expect(curve.evaluate(1)).toBeCloseTo(3);
|
|
57
|
+
expect(curve.evaluate(0.5)).toBeCloseTo(0);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test("insert key out of order, should end up ordered", () => {
|
|
61
|
+
|
|
62
|
+
const curve = new AnimationCurve();
|
|
63
|
+
|
|
64
|
+
curve.add(Keyframe.from(0, 3));
|
|
65
|
+
curve.add(Keyframe.from(5, 7));
|
|
66
|
+
|
|
67
|
+
const out_of_order_key = Keyframe.from(1, 11);
|
|
68
|
+
curve.add(out_of_order_key);
|
|
69
|
+
|
|
70
|
+
expect(curve.keys[1]).toBe(out_of_order_key);
|
|
71
|
+
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test("smooth tangents with a single keyframe does not throw", () => {
|
|
75
|
+
const curve = new AnimationCurve();
|
|
76
|
+
|
|
77
|
+
curve.add(Keyframe.from(0, 7));
|
|
78
|
+
|
|
79
|
+
expect(() => curve.smoothTangents(0, 1)).not.toThrow()
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test("to/from JSON consistency", () => {
|
|
83
|
+
|
|
84
|
+
const curve = new AnimationCurve();
|
|
85
|
+
|
|
86
|
+
curve.add(Keyframe.from(3, -7, 13, -17));
|
|
87
|
+
|
|
88
|
+
const c2 = new AnimationCurve();
|
|
89
|
+
|
|
90
|
+
c2.fromJSON(curve.toJSON());
|
|
91
|
+
|
|
92
|
+
expect(c2.length).toBe(1);
|
|
93
|
+
|
|
94
|
+
const first_key = c2.keys[0];
|
|
95
|
+
|
|
96
|
+
expect(first_key.time).toBe(3);
|
|
97
|
+
expect(first_key.value).toBe(-7);
|
|
98
|
+
expect(first_key.inTangent).toBe(13);
|
|
99
|
+
expect(first_key.outTangent).toBe(-17);
|
|
100
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Applies a transformation to an asset. Such as performing mesh simplification for example.
|
|
3
3
|
* Transformation is executed by the {@link AssetManager}
|
|
4
|
+
* Useful for modifying/extending post-processing done on various asset types
|
|
4
5
|
* @template {Asset<T>} A
|
|
5
6
|
* @template T
|
|
6
7
|
*/
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Useful for computing hashes of large arrays, can pick a relevant stride and skip large chunks of memory while still capturing good amount of unique information from evenly-spaced areas of the array
|
|
3
3
|
* @param {number[]|Uint32Array|Uint16Array|Uint8Array} array
|
|
4
4
|
* @param {number} offset
|
|
5
5
|
* @param {number} length
|
|
6
6
|
* @param {number} stride
|
|
7
7
|
* @return {number}
|
|
8
8
|
*/
|
|
9
|
-
export function computeStridedIntegerArrayHash(
|
|
9
|
+
export function computeStridedIntegerArrayHash(
|
|
10
|
+
array, offset, length, stride
|
|
11
|
+
) {
|
|
10
12
|
let result = length;
|
|
11
13
|
|
|
12
14
|
for (let i = offset; i < length; i += stride) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { assert } from "
|
|
2
|
-
import Vector3 from "
|
|
3
|
-
import { SurfacePoint3 } from "
|
|
4
|
-
import Vector2 from "
|
|
1
|
+
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import Vector3 from "../../../core/geom/Vector3.js";
|
|
3
|
+
import { SurfacePoint3 } from "../../../core/geom/3d/SurfacePoint3.js";
|
|
4
|
+
import Vector2 from "../../../core/geom/Vector2.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
@@ -3,14 +3,6 @@ import { BinaryCollectionHeaderCodec, BinaryCollectionHeaderLayout } from "./Bin
|
|
|
3
3
|
import { HashMap } from "../../../../../core/collection/HashMap.js";
|
|
4
4
|
import { returnEmptyArray } from "../../../../../core/function/Functions.js";
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @returns {Array}
|
|
9
|
-
*/
|
|
10
|
-
function makeEmptyArray() {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
6
|
export class BinaryCollectionSerializer {
|
|
15
7
|
constructor() {
|
|
16
8
|
|
|
@@ -70,16 +62,7 @@ export class BinaryCollectionSerializer {
|
|
|
70
62
|
* @type {Map<any, number>}
|
|
71
63
|
*/
|
|
72
64
|
this.dictionary = new HashMap({
|
|
73
|
-
|
|
74
|
-
return key.hash();
|
|
75
|
-
},
|
|
76
|
-
keyEqualityFunction(k0, k1) {
|
|
77
|
-
if (k0 === k1) {
|
|
78
|
-
return true;
|
|
79
|
-
} else {
|
|
80
|
-
return k0.equals(k1);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
65
|
+
capacity: 1024, //pre-allocate larger size to avoid rehashing
|
|
83
66
|
});
|
|
84
67
|
}
|
|
85
68
|
|
|
@@ -17,7 +17,13 @@ class MotionSystem extends System {
|
|
|
17
17
|
|
|
18
18
|
update(timeDelta) {
|
|
19
19
|
const entityManager = this.entityManager;
|
|
20
|
-
|
|
20
|
+
const ecd = entityManager.dataset;
|
|
21
|
+
|
|
22
|
+
if (ecd === null) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ecd.traverseEntities([Motion, Transform], function (motion, transform) {
|
|
21
27
|
const positionDelta = motion.velocity.clone().multiplyScalar(timeDelta);
|
|
22
28
|
transform.position.add(positionDelta);
|
|
23
29
|
});
|
|
@@ -17,9 +17,15 @@ class SynchronizePositionSystem extends System {
|
|
|
17
17
|
|
|
18
18
|
update(timeDelta) {
|
|
19
19
|
const em = this.entityManager;
|
|
20
|
-
|
|
20
|
+
const ecd = em.dataset;
|
|
21
|
+
|
|
22
|
+
if (ecd === null) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ecd.traverseEntities([SynchronizePosition, Transform], function (sync, transform) {
|
|
21
27
|
const targetEntity = sync.targetEntity;
|
|
22
|
-
const targetTransform =
|
|
28
|
+
const targetTransform = ecd.getComponent(targetEntity, Transform);
|
|
23
29
|
if (sync.x) {
|
|
24
30
|
transform.position.x = targetTransform.position.x;
|
|
25
31
|
}
|
|
@@ -7,7 +7,7 @@ import Quaternion from "../../../core/geom/Quaternion.js";
|
|
|
7
7
|
import { decompose_matrix_4_array } from "../../../core/geom/3d/decompose_matrix_4_array.js";
|
|
8
8
|
import { compose_matrix4_array } from "../../../core/geom/3d/compose_matrix4_array.js";
|
|
9
9
|
import { TransformFlags } from "./TransformFlags.js";
|
|
10
|
-
import { allocate_transform_m4 } from "
|
|
10
|
+
import { allocate_transform_m4 } from "../../../core/geom/3d/matrix/allocate_transform_m4.js";
|
|
11
11
|
import { assert } from "../../../core/assert.js";
|
|
12
12
|
import { m4_multiply } from "../../../core/geom/3d/matrix/m4_multiply.js";
|
|
13
13
|
import { MATRIX_4_IDENTITY } from "../../../core/geom/3d/matrix/MATRIX_4_IDENTITY.js";
|
|
@@ -14,11 +14,11 @@ const nearBR = new ThreeVector3();
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
17
|
-
* @param {Frustum}
|
|
17
|
+
* @param {Frustum} output
|
|
18
18
|
* @param {AABB2} box screen-space 2d box in NDC (-1,+1)
|
|
19
19
|
* @param {THREE.Camera} camera
|
|
20
20
|
*/
|
|
21
|
-
export function makeScreenScissorFrustum(
|
|
21
|
+
export function makeScreenScissorFrustum(output, box, camera) {
|
|
22
22
|
|
|
23
23
|
camera.updateProjectionMatrix();
|
|
24
24
|
camera.updateMatrixWorld();
|
|
@@ -46,7 +46,7 @@ export function makeScreenScissorFrustum(frustum, box, camera) {
|
|
|
46
46
|
nearBR.unproject(camera);
|
|
47
47
|
|
|
48
48
|
//create frustum planes
|
|
49
|
-
const planes =
|
|
49
|
+
const planes = output.planes;
|
|
50
50
|
|
|
51
51
|
//set planes
|
|
52
52
|
planes[0].setFromCoplanarPoints(nearTL, farTL, farTR);
|
|
@@ -39,7 +39,7 @@ import { FogOfWarRevealerSystem } from "../../ecs/fow/FogOfWarRevealerSystem.js"
|
|
|
39
39
|
import { BehaviorSystem } from "../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
40
40
|
import { SerializationMetadataSystem } from "../../ecs/systems/SerializationMetadataSystem.js";
|
|
41
41
|
import { InverseKinematicsSystem } from "../../ecs/animation/InverseKinematicsSystem.js";
|
|
42
|
-
import { PathDisplaySystem } from "
|
|
42
|
+
import { PathDisplaySystem } from "../ecs/path/PathDisplaySystem.js";
|
|
43
43
|
import RenderSystem from "../../ecs/systems/RenderSystem.js";
|
|
44
44
|
import { makeEngineOptionsModel } from "../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
45
45
|
import { enableEditor } from "../../../../editor/enableEditor.js";
|
|
@@ -79,7 +79,7 @@ function makeConfig(engine) {
|
|
|
79
79
|
const guiSystem = new GUIElementSystem(engine.gui.view, engine);
|
|
80
80
|
const headsUpDisplaySystem = new HeadsUpDisplaySystem(graphics);
|
|
81
81
|
|
|
82
|
-
config.
|
|
82
|
+
config.addManySystems(
|
|
83
83
|
new ScriptSystem(),
|
|
84
84
|
new FacingDirectionSystem(),
|
|
85
85
|
new PathFollowingSystem(),
|
|
@@ -286,16 +286,16 @@ function makeCameraClippingDebug(engine) {
|
|
|
286
286
|
const special_hits_1 = [];
|
|
287
287
|
const special_hits_2 = [];
|
|
288
288
|
|
|
289
|
-
ThreeClippingPlaneComputingBVHVisitor.DEBUG_POINTS_0.add((x, y, z) => {
|
|
290
|
-
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
ThreeClippingPlaneComputingBVHVisitor.DEBUG_POINTS_1.add((x, y, z) => {
|
|
294
|
-
|
|
295
|
-
});
|
|
296
|
-
ThreeClippingPlaneComputingBVHVisitor.DEBUG_POINTS_2.add((x, y, z) => {
|
|
297
|
-
|
|
298
|
-
});
|
|
289
|
+
// ThreeClippingPlaneComputingBVHVisitor.DEBUG_POINTS_0.add((x, y, z) => {
|
|
290
|
+
// special_hits_0.push(new Vector3(x, y, z));
|
|
291
|
+
// });
|
|
292
|
+
//
|
|
293
|
+
// ThreeClippingPlaneComputingBVHVisitor.DEBUG_POINTS_1.add((x, y, z) => {
|
|
294
|
+
// special_hits_1.push(new Vector3(x, y, z));
|
|
295
|
+
// });
|
|
296
|
+
// ThreeClippingPlaneComputingBVHVisitor.DEBUG_POINTS_2.add((x, y, z) => {
|
|
297
|
+
// special_hits_2.push(new Vector3(x, y, z));
|
|
298
|
+
// });
|
|
299
299
|
|
|
300
300
|
const buffer = new RingBuffer(100);
|
|
301
301
|
|
|
@@ -381,7 +381,7 @@ function main(engine) {
|
|
|
381
381
|
enableTerrain: true,
|
|
382
382
|
terrainSize: new Vector2(100, 100),
|
|
383
383
|
focus: new Vector3(102, 0, 61),
|
|
384
|
-
pitch:
|
|
384
|
+
pitch: 0.5,
|
|
385
385
|
yaw: 2.2,
|
|
386
386
|
distance: 3
|
|
387
387
|
// pitch: -0.12,
|
|
@@ -14,7 +14,7 @@ import { frustum_from_camera } from "./frustum_from_camera.js";
|
|
|
14
14
|
import { invertQuaternionOrientation } from "./InvertQuaternionOrientation.js";
|
|
15
15
|
import { v3_distance_above_plane } from "../../../../core/geom/v3_distance_above_plane.js";
|
|
16
16
|
import { ProjectionType } from "./ProjectionType.js";
|
|
17
|
-
import { computePlaneRayIntersection } from "../../../../core/geom/
|
|
17
|
+
import { computePlaneRayIntersection } from "../../../../core/geom/3d/plane/computePlaneRayIntersection.js";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @class
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { entity_node_compute_bounding_box } from "../../../../ecs/parent/entity_node_compute_bounding_box.js";
|
|
2
|
-
import { AABB3 } from "../../../../../core/
|
|
2
|
+
import { AABB3 } from "../../../../../core/geom/3d/aabb/AABB3.js";
|
|
3
3
|
|
|
4
4
|
export const SGMeshFlags = {
|
|
5
5
|
CastShadow: 1,
|
|
@@ -10,6 +10,9 @@ import { ParentEntity } from "../../../../ecs/parent/ParentEntity.js";
|
|
|
10
10
|
import { EntityNode } from "../../../../ecs/parent/EntityNode.js";
|
|
11
11
|
import { min2 } from "../../../../../core/math/min2.js";
|
|
12
12
|
import { TransformAttachmentSystem } from "../../../../ecs/transform-attachment/TransformAttachmentSystem.js";
|
|
13
|
+
import { ResourceAccessSpecification } from "../../../../../core/model/ResourceAccessSpecification.js";
|
|
14
|
+
import { ResourceAccessKind } from "../../../../../core/model/ResourceAccessKind.js";
|
|
15
|
+
import { TransformAttachment } from "../../../../ecs/transform-attachment/TransformAttachment.js";
|
|
13
16
|
|
|
14
17
|
|
|
15
18
|
/**
|
|
@@ -48,6 +51,12 @@ export class SGMeshSystem extends System {
|
|
|
48
51
|
this.__assetManager = engine.assetManager;
|
|
49
52
|
|
|
50
53
|
this.dependencies = [SGMesh, Transform];
|
|
54
|
+
this.components_used = [
|
|
55
|
+
ResourceAccessSpecification.from(SGMesh, ResourceAccessKind.Read | ResourceAccessKind.Write),
|
|
56
|
+
ResourceAccessSpecification.from(Transform, ResourceAccessKind.Read),
|
|
57
|
+
ResourceAccessSpecification.from(ShadedGeometry, ResourceAccessKind.Create),
|
|
58
|
+
ResourceAccessSpecification.from(TransformAttachment, ResourceAccessKind.Create),
|
|
59
|
+
];
|
|
51
60
|
|
|
52
61
|
/**
|
|
53
62
|
*
|
|
@@ -8,7 +8,7 @@ import { InitTriInfo } from "./InitTriInfo.js";
|
|
|
8
8
|
import { GenerateTSpaces } from "./GenerateTSpaces.js";
|
|
9
9
|
import { DegenEpilogue } from "./DegenEpilogue.js";
|
|
10
10
|
import { Build4RuleGroups } from "./Build4RuleGroups.js";
|
|
11
|
-
import { allocate_v3 } from "
|
|
11
|
+
import { allocate_v3 } from "../../../../core/geom/3d/vector/allocate_v3.js";
|
|
12
12
|
import { m_getNumFaces } from "./m_getNumFaces.js";
|
|
13
13
|
import { GenerateInitialVerticesIndexList } from "./GenerateInitialVerticesIndexList.js";
|
|
14
14
|
import { DegenPrologue } from "./DegenPrologue.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
2
2
|
|
|
3
3
|
import { Vector3 as ThreeVector3 } from 'three';
|
|
4
|
-
import { rayTriangleIntersection } from "../../../../../core/geom/rayTriangleIntersection.js";
|
|
4
|
+
import { rayTriangleIntersection } from "../../../../../core/geom/3d/triangle/rayTriangleIntersection.js";
|
|
5
5
|
import { SurfacePoint3 } from "../../../../../core/geom/3d/SurfacePoint3.js";
|
|
6
6
|
import { assert } from "../../../../../core/assert.js";
|
|
7
7
|
import { v3_length } from "../../../../../core/geom/v3_length.js";
|
|
@@ -22,7 +22,7 @@ import { BUFFER_GEOMETRY_UVS } from "./BUFFER_GEOMETRY_UVS.js";
|
|
|
22
22
|
import { is_compliant_mesh } from "./is_compliant_mesh.js";
|
|
23
23
|
import { MaterialDescriptor } from "./MaterialDescriptor.js";
|
|
24
24
|
import { computeThreeTextureTypeFromDataType } from "../../texture/computeThreeTextureTypeFromDataType.js";
|
|
25
|
-
import { typedArrayToDataType } from "../../../../core/collection/array/typedArrayToDataType.js";
|
|
25
|
+
import { typedArrayToDataType } from "../../../../core/collection/array/typed/typedArrayToDataType.js";
|
|
26
26
|
import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
27
27
|
import {
|
|
28
28
|
compute_typed_array_constructor_from_data_type
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AABB3 } from "../../../../../core/
|
|
1
|
+
import { AABB3 } from "../../../../../core/geom/3d/aabb/AABB3.js";
|
|
2
2
|
import { RowFirstTable } from "../../../../../core/collection/table/RowFirstTable.js";
|
|
3
3
|
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
4
4
|
import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.js";
|
|
@@ -125,6 +125,7 @@ export class ParameterLookupTable {
|
|
|
125
125
|
*/
|
|
126
126
|
sample(position, result) {
|
|
127
127
|
assert.isNumber(position, 'position');
|
|
128
|
+
assert.notNaN(position, 'position');
|
|
128
129
|
// assert.greaterThanOrEqual(position, 0, 'position');
|
|
129
130
|
// assert.ok(position >= 0 && position <= 1, `position must be between 0 and 1, instead was ${position}`);
|
|
130
131
|
|
package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js
CHANGED
|
@@ -77,7 +77,7 @@ import TopDownCameraController from "../../../../../ecs/camera/topdown/TopDownCa
|
|
|
77
77
|
import { randomFloatBetween } from "../../../../../../../core/math/random/randomFloatBetween.js";
|
|
78
78
|
import { MicronRenderPlugin } from "../../../../../micron/plugin/MicronRenderPlugin.js";
|
|
79
79
|
import { obtainTerrain } from "../../../../../../ecs/terrain/util/obtainTerrain.js";
|
|
80
|
-
import { pick } from "
|
|
80
|
+
import { pick } from "../../../../../../ecs/grid/pick.js";
|
|
81
81
|
import { clamp01 } from "../../../../../../../core/math/clamp01.js";
|
|
82
82
|
import { randomFromArray } from "../../../../../../../core/math/random/randomFromArray.js";
|
|
83
83
|
import { SamplingFunctionKind } from "./SamplingFunctionKind.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @author alteredq / http://alteredqualia.com/
|
|
3
3
|
*/
|
|
4
|
-
import * as THREE from 'TRHEE
|
|
4
|
+
import * as THREE from 'TRHEE';
|
|
5
5
|
import CopyShader from "../shaders/CopyShader.js";
|
|
6
6
|
|
|
7
7
|
const TexturePass = function (texture, opacity) {
|
|
@@ -14,7 +14,7 @@ const TexturePass = function (texture, opacity) {
|
|
|
14
14
|
this.uniforms = THREE.UniformsUtils.clone(shader.uniforms);
|
|
15
15
|
|
|
16
16
|
this.uniforms["opacity"].value = (opacity !== undefined) ? opacity : 1.0;
|
|
17
|
-
this.uniforms["tDiffuse
|
|
17
|
+
this.uniforms["tDiffuse"].value = texture;
|
|
18
18
|
|
|
19
19
|
this.material = new THREE.ShaderMaterial({
|
|
20
20
|
|
|
@@ -5,10 +5,10 @@ import { bvh_query_leaves_ray } from "../../../../core/bvh2/bvh3/query/bvh_query
|
|
|
5
5
|
import {
|
|
6
6
|
aabb3_signed_distance_sqr_to_point
|
|
7
7
|
} from "../../../../core/geom/3d/aabb/aabb3_signed_distance_sqr_to_point.js";
|
|
8
|
+
import { ebvh_build_for_geometry_morton } from "../../../../core/bvh2/bvh3/ebvh_build_for_geometry_morton.js";
|
|
8
9
|
import {
|
|
9
10
|
computeTriangleRayIntersectionBarycentric
|
|
10
|
-
} from "../../../../core/geom/3d/triangle/
|
|
11
|
-
import { ebvh_build_for_geometry_morton } from "../../../../core/bvh2/bvh3/ebvh_build_for_geometry_morton.js";
|
|
11
|
+
} from "../../../../core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
*
|
|
@@ -10,7 +10,7 @@ import { mix } from "../../../../core/math/mix.js";
|
|
|
10
10
|
import { BlendingType } from "./BlendingType.js";
|
|
11
11
|
import { assert } from "../../../../core/assert.js";
|
|
12
12
|
import { typedArrayConstructorByInstance } from "./typedArrayConstructorByInstance.js";
|
|
13
|
-
import { typedArrayToDataType } from "../../../../core/collection/array/typedArrayToDataType.js";
|
|
13
|
+
import { typedArrayToDataType } from "../../../../core/collection/array/typed/typedArrayToDataType.js";
|
|
14
14
|
import {
|
|
15
15
|
compute_typed_array_constructor_from_data_type
|
|
16
16
|
} from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
@@ -2,7 +2,7 @@ import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
|
2
2
|
import { min2 } from "../../../../core/math/min2.js";
|
|
3
3
|
import { max2 } from "../../../../core/math/max2.js";
|
|
4
4
|
import { isTypedArray } from "../../../../core/collection/array/typed/isTypedArray.js";
|
|
5
|
-
import { typedArrayToDataType } from "../../../../core/collection/array/typedArrayToDataType.js";
|
|
5
|
+
import { typedArrayToDataType } from "../../../../core/collection/array/typed/typedArrayToDataType.js";
|
|
6
6
|
import { sampler2d_channel_compute_max } from "./sampler2d_channel_compute_max.js";
|
|
7
7
|
import { sampler2d_channel_compute_min } from "./sampler2d_channel_compute_min.js";
|
|
8
8
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Behavior } from "./Behavior.js";
|
|
2
|
+
|
|
3
|
+
test("constructor does not throw", () => {
|
|
4
|
+
expect(() => new Behavior()).not.toThrow();
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
test("context propagated from initialization method", () => {
|
|
8
|
+
const b = new Behavior();
|
|
9
|
+
|
|
10
|
+
const context = { test: "hello" };
|
|
11
|
+
|
|
12
|
+
b.initialize(context);
|
|
13
|
+
|
|
14
|
+
expect(b.context).toBe(context);
|
|
15
|
+
});
|