@woosh/meep-engine 2.69.0 → 2.71.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/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +498 -429
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +498 -429
- package/package.json +1 -1
- package/src/core/__module.js +1 -0
- package/src/core/binary/BinaryBuffer.js +37 -31
- package/src/core/bvh2/binary/2/BinaryUint32BVH.js +21 -24
- package/src/core/bvh2/binary/2/BinaryUint32BVH.spec.js +2 -4
- package/src/core/geom/3d/cone/compute_bounding_cone_of_2_cones.js +3 -2
- package/src/core/geom/3d/morton/v3_morton_encode_bounded.js +34 -0
- package/src/core/geom/3d/morton/v3_morton_encode_transformed.js +2 -1
- package/src/core/geom/3d/quaternion/quat3_createFromAxisAngle.js +11 -0
- package/src/core/geom/3d/quaternion/quat_decode_from_uint32.js +53 -0
- package/src/core/geom/3d/quaternion/quat_encode_to_uint32.js +105 -0
- package/src/core/geom/Quaternion.js +8 -142
- package/src/core/geom/Vector2.js +6 -7
- package/src/core/geom/Vector3.js +15 -82
- package/src/core/geom/vec3/v3_binary_equality_decode.js +44 -0
- package/src/core/geom/vec3/v3_binary_equality_encode.js +47 -0
- package/src/core/math/remap.js +5 -1
- package/src/core/math/statistics/computeStatisticalPartialMedian.js +1 -1
- package/src/core/primitives/numbers/computeHashFloat.js +2 -2
- package/src/core/process/task/Task.js +53 -34
- package/src/engine/achievements/AchievementManager.js +19 -19
- package/src/engine/animation/curve/compression/prototypeCurveCompression.js +6 -6
- package/src/engine/animation/curve/draw/build_plot_entity_from_array.js +11 -6
- package/src/engine/ecs/dynamic_actions/DynamicActor.js +5 -10
- package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +82 -89
- package/src/engine/ecs/dynamic_actions/RuleExecution.js +10 -12
- package/src/engine/ecs/gui/GUIElement.js +44 -61
- package/src/engine/ecs/gui/GUIElementSystem.js +26 -24
- package/src/engine/ecs/gui/hud/HeadsUpDisplay.js +12 -15
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +15 -15
- package/src/engine/ecs/gui/parallax/GuiElementParallax.js +3 -3
- package/src/engine/ecs/gui/parallax/GuiElementParallaxSystem.js +2 -2
- package/src/engine/ecs/gui/position/ViewportPosition.js +5 -50
- package/src/engine/ecs/gui/position/ViewportPositionSerializationAdapter.js +42 -0
- package/src/engine/ecs/transform/Transform.js +8 -9
- package/src/engine/ecs/transform/TransformSerializationAdapter.js +20 -14
- package/src/engine/graphics/ecs/mesh/Mesh.js +11 -11
- package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +20 -20
- package/src/engine/graphics/texture/sprite/prototypeSpriteCutoutGeometry.js +12 -12
- package/src/engine/navigation/ecs/components/PathSerializationAdapter.js +1 -4
- package/src/core/binary/ValidatingBitSetWrapper.js +0 -81
- package/src/core/binary/jsonToStringToByteArray.js +0 -27
- package/src/engine/ecs/components/AreaOfEffect.js +0 -12
- package/src/engine/ecs/components/Mortality.js +0 -27
- package/src/engine/ecs/systems/AreaOfEffectSystem.js +0 -48
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../../storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import ViewportPosition from "./ViewportPosition.js";
|
|
3
|
+
|
|
4
|
+
export class ViewportPositionSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
+
|
|
6
|
+
version = 0;
|
|
7
|
+
klass = ViewportPosition;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {BinaryBuffer} buffer
|
|
12
|
+
* @param {ViewportPosition} value
|
|
13
|
+
*/
|
|
14
|
+
serialize(buffer, value) {
|
|
15
|
+
value.position.toBinaryBufferFloat32(buffer);
|
|
16
|
+
value.offset.toBinaryBufferFloat32(buffer);
|
|
17
|
+
value.anchor.toBinaryBufferFloat32(buffer);
|
|
18
|
+
|
|
19
|
+
buffer.writeFloat32(value.screenEdgeWidth);
|
|
20
|
+
|
|
21
|
+
buffer.writeUint8(value.resolveGuiCollisions ? 1 : 0);
|
|
22
|
+
buffer.writeUint8(value.stickToScreenEdge ? 1 : 0);
|
|
23
|
+
buffer.writeUint8(value.enabled.getValue() ? 1 : 0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param {BinaryBuffer} buffer
|
|
29
|
+
* @param {ViewportPosition} value
|
|
30
|
+
*/
|
|
31
|
+
deserialize(buffer, value) {
|
|
32
|
+
value.position.fromBinaryBufferFloat32(buffer);
|
|
33
|
+
value.offset.fromBinaryBufferFloat32(buffer);
|
|
34
|
+
value.anchor.fromBinaryBufferFloat32(buffer);
|
|
35
|
+
|
|
36
|
+
value.screenEdgeWidth = buffer.readFloat32();
|
|
37
|
+
|
|
38
|
+
value.resolveGuiCollisions = buffer.readUint8() !== 0;
|
|
39
|
+
value.stickToScreenEdge = buffer.readUint8() !== 0;
|
|
40
|
+
value.enabled.set(buffer.readUint8() !== 0);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Created by Alex on 02/04/2014.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {assert} from "../../../core/assert.js";
|
|
6
|
-
import {compose_matrix4_array} from "../../../core/geom/3d/compose_matrix4_array.js";
|
|
7
|
-
import {decompose_matrix_4_array} from "../../../core/geom/3d/decompose_matrix_4_array.js";
|
|
8
|
-
import {allocate_transform_m4} from "../../../core/geom/3d/matrix/allocate_transform_m4.js";
|
|
9
|
-
import {m4_multiply} from "../../../core/geom/3d/matrix/m4_multiply.js";
|
|
10
|
-
import {MATRIX_4_IDENTITY} from "../../../core/geom/3d/matrix/MATRIX_4_IDENTITY.js";
|
|
5
|
+
import { assert } from "../../../core/assert.js";
|
|
6
|
+
import { compose_matrix4_array } from "../../../core/geom/3d/compose_matrix4_array.js";
|
|
7
|
+
import { decompose_matrix_4_array } from "../../../core/geom/3d/decompose_matrix_4_array.js";
|
|
8
|
+
import { allocate_transform_m4 } from "../../../core/geom/3d/matrix/allocate_transform_m4.js";
|
|
9
|
+
import { m4_multiply } from "../../../core/geom/3d/matrix/m4_multiply.js";
|
|
10
|
+
import { MATRIX_4_IDENTITY } from "../../../core/geom/3d/matrix/MATRIX_4_IDENTITY.js";
|
|
11
11
|
import Quaternion from "../../../core/geom/Quaternion.js";
|
|
12
12
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
13
|
-
import {TransformFlags} from "./TransformFlags.js";
|
|
13
|
+
import { TransformFlags } from "./TransformFlags.js";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
@@ -261,8 +261,7 @@ export class Transform {
|
|
|
261
261
|
* @returns {boolean}
|
|
262
262
|
*/
|
|
263
263
|
equals(other) {
|
|
264
|
-
return other.
|
|
265
|
-
&& this.position.equals(other.position)
|
|
264
|
+
return this.position.equals(other.position)
|
|
266
265
|
&& this.rotation.equals(other.rotation)
|
|
267
266
|
&& this.scale.equals(other.scale);
|
|
268
267
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { quat_decode_from_uint32 } from "../../../core/geom/3d/quaternion/quat_decode_from_uint32.js";
|
|
2
|
+
import { quat_encode_to_uint32 } from "../../../core/geom/3d/quaternion/quat_encode_to_uint32.js";
|
|
3
|
+
import { v3_binary_equality_decode } from "../../../core/geom/vec3/v3_binary_equality_decode.js";
|
|
4
|
+
import { v3_binary_equality_encode } from "../../../core/geom/vec3/v3_binary_equality_encode.js";
|
|
1
5
|
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
6
|
import { Transform } from "./Transform.js";
|
|
3
7
|
|
|
@@ -14,20 +18,23 @@ export class TransformSerializationAdapter extends BinaryClassSerializationAdapt
|
|
|
14
18
|
serialize(buffer, value) {
|
|
15
19
|
|
|
16
20
|
const position = value.position;
|
|
21
|
+
const rotation = value.rotation;
|
|
22
|
+
const scale = value.scale;
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
buffer.writeFloat64(position.x);
|
|
25
|
+
buffer.writeFloat64(position.y);
|
|
26
|
+
buffer.writeFloat64(position.z);
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
const encoded_rotation = quat_encode_to_uint32(
|
|
29
|
+
rotation.x,
|
|
30
|
+
rotation.y,
|
|
31
|
+
rotation.z,
|
|
32
|
+
rotation.w
|
|
33
|
+
);
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
buffer.writeUint32(encoded_rotation);
|
|
27
36
|
|
|
28
|
-
buffer.
|
|
29
|
-
|
|
30
|
-
value.scale.toBinaryBufferFloat32_EqualityEncoded(buffer);
|
|
37
|
+
v3_binary_equality_encode(buffer, scale.x, scale.y, scale.z);
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
/**
|
|
@@ -40,12 +47,11 @@ export class TransformSerializationAdapter extends BinaryClassSerializationAdapt
|
|
|
40
47
|
const positionY = buffer.readFloat64();
|
|
41
48
|
const positionZ = buffer.readFloat64();
|
|
42
49
|
|
|
43
|
-
const
|
|
50
|
+
const encoded_rotation = buffer.readUint32();
|
|
44
51
|
|
|
45
|
-
value.scale
|
|
52
|
+
v3_binary_equality_decode(buffer, value.scale, 0);
|
|
46
53
|
|
|
54
|
+
quat_decode_from_uint32(value.rotation, 0, encoded_rotation);
|
|
47
55
|
value.position.set(positionX, positionY, positionZ);
|
|
48
|
-
|
|
49
|
-
value.rotation.decodeFromUint32(encodedRotation);
|
|
50
56
|
}
|
|
51
57
|
}
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { assert } from "../../../../core/assert.js";
|
|
5
5
|
import { BvhClient } from "../../../../core/bvh2/bvh3/BvhClient.js";
|
|
6
|
-
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
7
6
|
import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
|
|
8
7
|
import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
|
|
9
|
-
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
10
8
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
11
9
|
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
12
10
|
import { applyTransformToThreeObject } from "./applyTransformToThreeObject.js";
|
|
@@ -25,6 +23,15 @@ export const MeshFlags = {
|
|
|
25
23
|
|
|
26
24
|
const DEFAULT_FLAGS = 0;
|
|
27
25
|
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @type {number}
|
|
29
|
+
*/
|
|
30
|
+
const EQUALITY_FLAGS =
|
|
31
|
+
MeshFlags.CastShadow
|
|
32
|
+
| MeshFlags.ReceiveShadow
|
|
33
|
+
;
|
|
34
|
+
|
|
28
35
|
/**
|
|
29
36
|
* Traversal stack
|
|
30
37
|
* @type {Object3D[]}
|
|
@@ -255,13 +262,7 @@ class Mesh {
|
|
|
255
262
|
}
|
|
256
263
|
|
|
257
264
|
hash() {
|
|
258
|
-
|
|
259
|
-
return computeHashIntegerArray(
|
|
260
|
-
urlHash,
|
|
261
|
-
this.castShadow ? 1 : 0,
|
|
262
|
-
this.receiveShadow ? 1 : 0,
|
|
263
|
-
computeHashFloat(this.opacity)
|
|
264
|
-
);
|
|
265
|
+
return computeStringHash(this.url) ^ this.flags;
|
|
265
266
|
}
|
|
266
267
|
|
|
267
268
|
/**
|
|
@@ -271,9 +272,8 @@ class Mesh {
|
|
|
271
272
|
*/
|
|
272
273
|
equals(other) {
|
|
273
274
|
return this.url === other.url
|
|
275
|
+
&& (this.flags & EQUALITY_FLAGS) === (other.flags & EQUALITY_FLAGS)
|
|
274
276
|
&& this.opacity === other.opacity
|
|
275
|
-
&& this.castShadow === other.castShadow
|
|
276
|
-
&& this.receiveShadow === other.receiveShadow
|
|
277
277
|
;
|
|
278
278
|
}
|
|
279
279
|
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import Quaternion from "../../../../core/geom/Quaternion.js";
|
|
2
|
+
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
3
|
+
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
4
|
+
import { DEG_TO_RAD } from "../../../../core/math/DEG_TO_RAD.js";
|
|
5
|
+
import { GameAssetType } from "../../../asset/GameAssetType.js";
|
|
6
|
+
import { GLTFAssetLoader } from "../../../asset/loaders/GLTFAssetLoader.js";
|
|
4
7
|
import Entity from "../../../ecs/Entity.js";
|
|
5
|
-
import ViewportPosition from "../../../ecs/gui/position/ViewportPosition.js";
|
|
6
8
|
import GUIElement from "../../../ecs/gui/GUIElement.js";
|
|
7
9
|
import GUIElementSystem from "../../../ecs/gui/GUIElementSystem.js";
|
|
10
|
+
import ViewportPosition from "../../../ecs/gui/position/ViewportPosition.js";
|
|
8
11
|
import ViewportPositionSystem from "../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
9
|
-
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
10
|
-
import { GameAssetType } from "../../../asset/GameAssetType.js";
|
|
11
|
-
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
12
|
-
import { GLTFAssetLoader } from "../../../asset/loaders/GLTFAssetLoader.js";
|
|
13
|
-
import { ImpostorCaptureType } from "./ImpostorCaptureType.js";
|
|
14
|
-
import { ShadedGeometrySystem } from "../../ecs/mesh-v2/ShadedGeometrySystem.js";
|
|
15
|
-
import { ImpostorShaderV0 } from "./shader/ImpostorShaderV0.js";
|
|
16
|
-
import Quaternion from "../../../../core/geom/Quaternion.js";
|
|
17
|
-
import { SGMesh } from "../../ecs/mesh-v2/aggregate/SGMesh.js";
|
|
18
|
-
import { SGMeshSystem } from "../../ecs/mesh-v2/aggregate/SGMeshSystem.js";
|
|
19
|
-
import { ShadedGeometryFlags } from "../../ecs/mesh-v2/ShadedGeometryFlags.js";
|
|
20
12
|
import { TransformAttachmentSystem } from "../../../ecs/transform-attachment/TransformAttachmentSystem.js";
|
|
13
|
+
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
14
|
+
import { EngineHarness } from "../../../EngineHarness.js";
|
|
21
15
|
import { BehaviorComponent } from "../../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
22
|
-
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
23
16
|
import { BehaviorSystem } from "../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
24
17
|
import { RotationBehavior } from "../../../intelligence/behavior/util/RotationBehavior.js";
|
|
25
|
-
import {
|
|
18
|
+
import { SGMesh } from "../../ecs/mesh-v2/aggregate/SGMesh.js";
|
|
19
|
+
import { SGMeshSystem } from "../../ecs/mesh-v2/aggregate/SGMeshSystem.js";
|
|
20
|
+
import { ShadedGeometry } from "../../ecs/mesh-v2/ShadedGeometry.js";
|
|
21
|
+
import { ShadedGeometryFlags } from "../../ecs/mesh-v2/ShadedGeometryFlags.js";
|
|
22
|
+
import { ShadedGeometrySystem } from "../../ecs/mesh-v2/ShadedGeometrySystem.js";
|
|
23
|
+
import { ImpostorBaker } from "./ImpostorBaker.js";
|
|
24
|
+
import { ImpostorCaptureType } from "./ImpostorCaptureType.js";
|
|
25
|
+
import { ImpostorShaderV0 } from "./shader/ImpostorShaderV0.js";
|
|
26
26
|
import { ImpostorShaderWireframeV0 } from "./shader/ImpostorShaderWireframeV0.js";
|
|
27
|
-
import { makeImpostorAtlasPreview } from "./util/makeImpostorAtlasPreview.js";
|
|
28
|
-
import { load_mesh_for_bake } from "./util/load_mesh_for_bake.js";
|
|
29
27
|
import { build_geometry_from_cutout_shape } from "./util/build_geometry_from_cutout_shape.js";
|
|
28
|
+
import { load_mesh_for_bake } from "./util/load_mesh_for_bake.js";
|
|
29
|
+
import { makeImpostorAtlasPreview } from "./util/makeImpostorAtlasPreview.js";
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
@@ -80,7 +80,7 @@ async function main(engine) {
|
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
new Entity()
|
|
83
|
-
.add(
|
|
83
|
+
.add(ViewportPosition.fromJSON({
|
|
84
84
|
offset: new Vector2(0, 0)
|
|
85
85
|
}))
|
|
86
86
|
.add(GUIElement.fromView(ctrl))
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { compute_polygon_area_2d } from "../../../../core/geom/2d/compute_polygon_area_2d.js";
|
|
2
|
+
import { convex_hull_jarvis_2d } from "../../../../core/geom/2d/convex-hull/convex_hull_jarvis_2d.js";
|
|
3
|
+
import { fixed_convex_hull_humus } from "../../../../core/geom/2d/convex-hull/fixed_convex_hull_humus.js";
|
|
4
|
+
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
5
|
+
import { CanvasView } from "../../../../view/elements/CanvasView.js";
|
|
4
6
|
import EmptyView from "../../../../view/elements/EmptyView.js";
|
|
7
|
+
import { ImageRGBADataLoader } from "../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
5
8
|
import Entity from "../../../ecs/Entity.js";
|
|
6
9
|
import GUIElement from "../../../ecs/gui/GUIElement.js";
|
|
7
|
-
import
|
|
8
|
-
import { CanvasView } from "../../../../view/elements/CanvasView.js";
|
|
9
|
-
import sampler2D2Canvas from "../sampler/Sampler2D2Canvas.js";
|
|
10
|
+
import GUIElementSystem from "../../../ecs/gui/GUIElementSystem.js";
|
|
10
11
|
import ViewportPosition from "../../../ecs/gui/position/ViewportPosition.js";
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
12
|
+
import ViewportPositionSystem from "../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
13
|
+
import { EngineHarness } from "../../../EngineHarness.js";
|
|
13
14
|
import { Sampler2D } from "../sampler/Sampler2D.js";
|
|
14
|
-
import
|
|
15
|
-
import { sampler2d_find_pixels } from "../sampler/search/sampler2d_find_pixels.js";
|
|
15
|
+
import sampler2D2Canvas from "../sampler/Sampler2D2Canvas.js";
|
|
16
16
|
import { make_edge_condition_channel_threshold } from "../sampler/search/make_edge_condition_channel_threshold.js";
|
|
17
|
-
import {
|
|
17
|
+
import { sampler2d_find_pixels } from "../sampler/search/sampler2d_find_pixels.js";
|
|
18
18
|
|
|
19
19
|
const edge_condition_alpha0 = make_edge_condition_channel_threshold(3, 0);
|
|
20
20
|
|
|
@@ -195,7 +195,7 @@ async function main(engine) {
|
|
|
195
195
|
|
|
196
196
|
new Entity()
|
|
197
197
|
.add(GUIElement.fromView(vContainer))
|
|
198
|
-
.add(
|
|
198
|
+
.add(ViewportPosition.fromJSON({
|
|
199
199
|
offset: new Vector2(100, 100)
|
|
200
200
|
}))
|
|
201
201
|
.build(engine.entityManager.dataset);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
1
|
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
2
|
+
import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
3
3
|
import Path from "./Path.js";
|
|
4
4
|
|
|
5
5
|
|
|
@@ -54,8 +54,5 @@ export class PathSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
|
54
54
|
|
|
55
55
|
value.setPosition(i, x, y, z);
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
// mark length for update
|
|
59
|
-
value.__length = -1;
|
|
60
57
|
}
|
|
61
58
|
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Debug tool to verify correct behavior of a BitSet
|
|
5
|
-
*/
|
|
6
|
-
export class ValidatingBitSetWrapper {
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @param {BitSet} source
|
|
10
|
-
*/
|
|
11
|
-
constructor(source) {
|
|
12
|
-
this.__source = source;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
preventShrink() {
|
|
16
|
-
this.__source.preventShrink();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
setShrinkFactor(x) {
|
|
20
|
-
this.__source.setShrinkFactor(x);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
setCapacity(x) {
|
|
24
|
-
this.__source.setCapacity(x);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
size() {
|
|
28
|
-
return this.__source.size();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
capacity() {
|
|
32
|
-
return this.__source.capacity();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
previousSetBit(i) {
|
|
36
|
-
const bit = this.__source.previousSetBit(i);
|
|
37
|
-
|
|
38
|
-
if (bit !== -1 && (this.__source.get(bit) !== true || bit > i)) {
|
|
39
|
-
debugger;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return bit;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
nextSetBit(i) {
|
|
46
|
-
const bit = this.__source.nextSetBit(i);
|
|
47
|
-
|
|
48
|
-
if (bit !== -1 && (this.__source.get(bit) !== true || bit < i)) {
|
|
49
|
-
debugger;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return bit;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
nextClearBit(i) {
|
|
56
|
-
const bit = this.__source.nextClearBit(i);
|
|
57
|
-
|
|
58
|
-
if (bit !== -1 && (this.__source.get(bit) !== false || bit < i)) {
|
|
59
|
-
debugger;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return bit;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
set(x, y) {
|
|
66
|
-
this.__source.set(x, y);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
clear(i) {
|
|
70
|
-
this.__source.clear(i);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
get(i) {
|
|
74
|
-
return this.__source.get(i);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
reset() {
|
|
79
|
-
this.__source.reset();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {stringifyStream} from "../json/JsonUtils.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @param {Object} json
|
|
6
|
-
* @returns {number[]}
|
|
7
|
-
*/
|
|
8
|
-
function jsonToStringToByteArray(json) {
|
|
9
|
-
const output = [];
|
|
10
|
-
let p = 0;
|
|
11
|
-
|
|
12
|
-
function addToOutput(str) {
|
|
13
|
-
for (let i = 0; i < str.length; i++) {
|
|
14
|
-
let c = str.charCodeAt(i);
|
|
15
|
-
while (c > 0xff) {
|
|
16
|
-
output[p++] = c & 0xff;
|
|
17
|
-
c >>= 8;
|
|
18
|
-
}
|
|
19
|
-
output[p++] = c;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
stringifyStream(json, addToOutput);
|
|
24
|
-
return output;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export {jsonToStringToByteArray};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Alex on 11/08/2014.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function AreaOfEffect(options) {
|
|
7
|
-
this.tags = options.tags.slice();
|
|
8
|
-
this.radius = options.radius || new THREE.Vector3(1, 1, 1);
|
|
9
|
-
this.action = options.action || void 0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default AreaOfEffect;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User: Alex Goldring
|
|
3
|
-
* Date: 17/6/2014
|
|
4
|
-
* Time: 21:26
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated entirely superseded by the {@link BehaviorSystem}
|
|
10
|
-
* @param actions
|
|
11
|
-
* @constructor
|
|
12
|
-
*/
|
|
13
|
-
function Mortality(actions) {
|
|
14
|
-
if (actions === void 0) {
|
|
15
|
-
actions = []
|
|
16
|
-
} else if (typeof actions === "function") {
|
|
17
|
-
actions = [actions];
|
|
18
|
-
}
|
|
19
|
-
this.actions = actions;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
Mortality.typeName = "Mortality";
|
|
23
|
-
|
|
24
|
-
Mortality.serializable = false;
|
|
25
|
-
|
|
26
|
-
export default Mortality;
|
|
27
|
-
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Alex on 11/08/2014.
|
|
3
|
-
*/
|
|
4
|
-
import { System } from '../System.js';
|
|
5
|
-
import Tag from '../components/Tag.js';
|
|
6
|
-
import { Transform } from '../transform/Transform.js';
|
|
7
|
-
import AreaOfEffect from '../components/AreaOfEffect.js';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class AreaOfEffectSystem extends System {
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
|
|
14
|
-
this.dependencies = [AreaOfEffect];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
add(component, entity) {
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
remove(component) {
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
update(timeDelta) {
|
|
24
|
-
const entityManager = this.entityManager;
|
|
25
|
-
entityManager.traverseEntities([AreaOfEffect, Transform], function (aoe, transform) {
|
|
26
|
-
const position = transform.position;
|
|
27
|
-
const tags = aoe.tags;
|
|
28
|
-
const radius = aoe.radius;
|
|
29
|
-
entityManager.traverseEntities([Tag, Transform], function (tag, transform2, entity) {
|
|
30
|
-
if (tags.indexOf(tag.name) === -1) {
|
|
31
|
-
return; //not a tag we care about
|
|
32
|
-
}
|
|
33
|
-
const position2 = transform2.position;
|
|
34
|
-
//check range, doing one component at a time makes evaluation lazy, giving us a bit of speed
|
|
35
|
-
if (
|
|
36
|
-
Math.abs(position2.x - position.x) < radius.x
|
|
37
|
-
&& Math.abs(position2.y - position.y) < radius.y
|
|
38
|
-
&& Math.abs(position2.z - position.z) < radius.z
|
|
39
|
-
) {
|
|
40
|
-
//within box
|
|
41
|
-
aoe.action(entityManager, timeDelta, entity);
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export default AreaOfEffectSystem;
|