@woosh/meep-engine 2.53.0 → 2.55.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/package.json +1 -1
- package/src/core/__module.js +1 -1
- package/src/core/cache/Cache.js +1 -1
- package/src/core/collection/Stack.js +11 -14
- package/src/core/collection/array/array_contains_duplicates.js +5 -2
- package/src/core/collection/array/array_contains_duplicates.spec.js +14 -0
- package/src/core/collection/array/array_copy_entire.js +6 -11
- package/src/core/collection/array/array_get_index_in_range.js +5 -0
- package/src/core/collection/array/array_get_index_in_range.spec.js +16 -0
- package/src/core/collection/array/groupArrayBy.js +1 -1
- package/src/core/collection/array/isArrayEqual.js +4 -1
- package/src/core/collection/array/randomizeArrayElementOrder.js +1 -0
- package/src/core/collection/array/randomizeArrayElementOrder.spec.js +27 -0
- package/src/core/collection/heap/Uin32Heap.spec.js +64 -0
- package/src/core/collection/heap/Uint32Heap.js +6 -2
- package/src/core/collection/list/List.js +1 -0
- package/src/core/collection/{HashMap.js → map/HashMap.js} +10 -10
- package/src/core/collection/{HashMap.spec.js → map/HashMap.spec.js} +1 -1
- package/src/core/collection/{ObservedMap.js → map/ObservedMap.js} +1 -1
- package/src/core/collection/{HashSet.js → set/HashSet.js} +4 -3
- package/src/core/collection/{Set.d.ts → set/Set.d.ts} +1 -1
- package/src/core/collection/{Set.js → set/Set.js} +17 -14
- package/src/core/geom/2d/aabb/AABB2.js +1 -1
- package/src/core/geom/3d/aabb/AABB3.js +3 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_calc_edges.js +1 -1
- package/src/core/model/ObservedInteger.js +12 -7
- package/src/core/model/ObservedString.js +10 -8
- package/src/core/model/node-graph/visual/NodeGraphVisualData.js +1 -1
- package/src/core/model/object/ImmutableObjectPool.js +1 -1
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.js +1 -1
- package/src/engine/EngineConfiguration.js +24 -25
- package/src/engine/asset/AssetManager.js +3 -3
- package/src/engine/asset/loaders/GLTFAssetLoader.js +1 -1
- package/src/engine/ecs/EntityBlueprint.js +10 -14
- package/src/engine/ecs/EntityComponentDataset.spec.js +77 -0
- package/src/engine/ecs/animation/AnimationSerializationAdapter.js +2 -5
- package/src/engine/ecs/components/Motion.js +0 -27
- package/src/engine/ecs/components/MotionSerializationAdapter.js +26 -0
- package/src/engine/ecs/components/PropertySet.js +0 -29
- package/src/engine/ecs/components/PropertySetSerializationAdapter.js +29 -0
- package/src/engine/ecs/components/SerializationMetadata.js +0 -28
- package/src/engine/ecs/components/SerializationMetadataSerializationAdapter.js +26 -0
- package/src/engine/ecs/components/Steering.js +0 -35
- package/src/engine/ecs/components/SteeringSerializationAdapter.js +34 -0
- package/src/engine/ecs/components/Tag.js +6 -102
- package/src/engine/ecs/components/TagSerializationAdapter.js +44 -0
- package/src/engine/ecs/components/TagSerializationUpgrader_0_1.js +18 -0
- package/src/engine/ecs/components/Timer.js +1 -1
- package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +1 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleCooldownDescription.js +10 -14
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js +31 -39
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescriptionTable.js +1 -1
- package/src/engine/ecs/dynamic_actions/{DynamicRuleDescriptionTable.spec.js → rules/DynamicRuleDescriptionTable.spec.js} +12 -12
- package/src/engine/ecs/foliage/ecs/InstancedMeshSerializationAdapter.js +2 -5
- package/src/engine/ecs/fow/serialization/FogOfWarRevealerSerializationAdapter.js +2 -5
- package/src/engine/ecs/fow/serialization/FogOfWarSerializationAdapter.js +5 -8
- package/src/engine/ecs/gui/GUIElementSerializationAdapter.js +2 -5
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySerializationAdapter.js +3 -6
- package/src/engine/ecs/gui/position/ViewportPosition.js +2 -5
- package/src/engine/ecs/ik/IKConstraint.js +95 -0
- package/src/engine/ecs/ik/InverseKinematics.js +10 -169
- package/src/engine/ecs/ik/InverseKinematicsSerializationAdapter.js +72 -0
- package/src/engine/ecs/speaker/Voice.js +5 -8
- package/src/engine/ecs/speaker/VoiceSystem.js +15 -19
- package/src/engine/ecs/speaker/lines/LineDescription.js +20 -25
- package/src/engine/ecs/speaker/lines/sets/LineSetDescription.js +15 -19
- package/src/engine/ecs/storage/binary/BinaryClassSerializationAdapter.js +7 -0
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +1 -1
- package/src/engine/ecs/storage/binary/object/ObjectBasedClassSerializationAdapter.js +6 -9
- package/src/engine/ecs/team/TeamSerializationAdapter.js +2 -5
- package/src/engine/ecs/terrain/ecs/Terrain.spec.js +5 -0
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js +23 -21
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSerializationAdapter.js +2 -5
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +2 -40
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.spec.js +6 -0
- package/src/engine/ecs/terrain/serialization/TerrainSerializationAdapter.js +7 -10
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +79 -76
- package/src/engine/ecs/terrain/tiles/TerrainTile.spec.js +25 -0
- package/src/engine/ecs/tooltip/TooltipComponent.spec.js +47 -0
- package/src/engine/ecs/tooltip/TooltipComponentSerializationAdapter.js +2 -5
- package/src/engine/ecs/transform/Transform.spec.js +52 -0
- package/src/engine/ecs/transform/TransformSerializationAdapter.js +2 -5
- package/src/engine/ecs/transform-attachment/TransformAttachment.js +18 -19
- package/src/engine/graphics/ecs/animation/AnimationController.js +20 -129
- package/src/engine/graphics/ecs/animation/AnimationControllerSerializationAdapter.js +27 -0
- package/src/engine/graphics/ecs/animation/AnimationRule.js +79 -0
- package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraphSerializationAdapter.js +9 -11
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/AnimationGraphDefinitionSerializationAdapter.js +3 -5
- package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.js +2 -5
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSerializationAdapter.js +2 -6
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLander.js +3 -15
- package/src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.js +2 -4
- package/src/engine/graphics/ecs/highlight/HighlightSerializationAdapter.js +2 -5
- package/src/engine/graphics/ecs/highlight/renderer/OutlineRenderer.js +1 -1
- package/src/engine/graphics/ecs/light/LightSerializationAdapter.js +2 -5
- package/src/engine/graphics/ecs/mesh/serialization/MeshSerializationAdapter.js +2 -5
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +3 -0
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/InstancedRendererAdapter.js +1 -1
- package/src/engine/graphics/ecs/water/WaterSerializationAdapter.js +2 -5
- package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +1 -1
- package/src/engine/graphics/material/manager/MaterialManager.js +1 -1
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +1 -1
- package/src/engine/graphics/particles/node-based/codegen/CodeContext.js +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +2 -5
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationAdapter.js +2 -5
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.js +1 -1
- package/src/engine/graphics/texture/atlas/ManagedTextureAtlas.js +1 -1
- package/src/engine/graphics/texture/sampler/serialization/Sampler2DSerializationAdapter.js +2 -5
- package/src/engine/grid/grid2transform/GridPosition2Transform.js +11 -13
- package/src/engine/grid/grid2transform/GridPosition2TransformSerializationAdapter.js +3 -5
- package/src/engine/grid/obstacle/GridObstacleSerializationAdapter.js +2 -5
- package/src/engine/grid/position/GridPositionSerializationAdapter.js +2 -5
- package/src/engine/grid/transform2grid/Transform2GridPosition.js +10 -13
- package/src/engine/input/devices/KeyboardDevice.js +5 -2
- package/src/engine/input/devices/KeyboardDevice.spec.js +12 -0
- package/src/engine/input/devices/PointerDevice.js +5 -1
- package/src/engine/input/ecs/components/Input.js +37 -11
- package/src/engine/input/ecs/ism/InputBinding.js +30 -12
- package/src/engine/intelligence/behavior/ecs/BehaviorComponentSerializationAdapter.js +7 -10
- package/src/engine/intelligence/behavior/ecs/WaitForEventBehaviorSerializationAdapter.js +2 -5
- package/src/engine/intelligence/behavior/primitive/FailingBehaviorSerializationAdapter.js +2 -6
- package/src/engine/intelligence/behavior/primitive/SucceedingBehaviorSerializationAdapter.js +2 -5
- package/src/engine/intelligence/blackboard/BlackboardSerializationAdapter.js +2 -5
- package/src/engine/knowledge/database/StaticKnowledgeDatabase.js +12 -13
- package/src/engine/knowledge/database/StaticKnowledgeDatabase.spec.js +23 -0
- package/src/engine/navigation/ecs/components/PathSerializationAdapter.js +2 -5
- package/src/engine/navigation/ecs/path_following/PathFollowerSerializationAdapter.js +2 -5
- package/src/engine/navigation/grid/find_path_on_grid_astar.spec.js +25 -0
- package/src/engine/options/OptionAbstract.js +6 -5
- package/src/engine/options/OptionGroup.js +13 -25
- package/src/engine/options/OptionGroup.spec.js +61 -0
- package/src/engine/platform/EnginePlatform.js +0 -4
- package/src/engine/save/storage/InMemoryStorage.js +3 -2
- package/src/engine/sound/ecs/SoundController.js +2 -6
- package/src/engine/sound/ecs/SoundListener.js +3 -21
- package/src/engine/sound/ecs/emitter/SoundEmitterSerializationAdapter.js +2 -6
- package/src/generation/theme/ThemeEngine.js +1 -1
- package/src/core/collection/LazyStream.js +0 -23
- package/src/core/collection/LazyStream.spec.js +0 -13
- package/src/core/collection/heap/BinaryHeap.js +0 -153
- package/src/engine/InputEngine.js +0 -94
- package/src/engine/PointerLock.js +0 -60
- package/src/engine/ecs/components/GeometryBVH.js +0 -44
- package/src/engine/ecs/systems/GeometryBVHSystem.js +0 -36
- package/src/engine/ecs/terrain/ecs/layers/loadLegacyTerrainLayers.js +0 -99
- package/src/engine/ecs/terrain/ecs/splat/loadLegacyTerrainSplats.js +0 -73
- /package/src/core/collection/{HashMap.d.ts → map/HashMap.d.ts} +0 -0
- /package/src/core/collection/{HashSet.d.ts → set/HashSet.d.ts} +0 -0
|
@@ -173,3 +173,55 @@ test("hash", () => {
|
|
|
173
173
|
expect(t.hash()).toEqual(hash);
|
|
174
174
|
|
|
175
175
|
});
|
|
176
|
+
|
|
177
|
+
test("multiplyTransforms with identities", () => {
|
|
178
|
+
|
|
179
|
+
const result = new Transform();
|
|
180
|
+
|
|
181
|
+
const a = new Transform();
|
|
182
|
+
a.makeIdentity();
|
|
183
|
+
|
|
184
|
+
const b = new Transform();
|
|
185
|
+
b.makeIdentity();
|
|
186
|
+
|
|
187
|
+
result.multiplyTransforms(a, b);
|
|
188
|
+
|
|
189
|
+
expect(result.position.equals(Vector3.zero)).toBe(true);
|
|
190
|
+
expect(result.scale.equals(Vector3.one)).toBe(true);
|
|
191
|
+
expect(result.rotation.equals(Quaternion.identity)).toBe(true);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
test("copy", () => {
|
|
195
|
+
const source = new Transform();
|
|
196
|
+
|
|
197
|
+
source.position.set(1, 3, 7);
|
|
198
|
+
source.scale.set(11, 13, 17);
|
|
199
|
+
source.rotation.set(23, 27, 31, 37);
|
|
200
|
+
|
|
201
|
+
const destination = new Transform();
|
|
202
|
+
|
|
203
|
+
destination.copy(source);
|
|
204
|
+
|
|
205
|
+
expect(destination.equals(source)).toBe(true);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
test("lookAt", () => {
|
|
209
|
+
const t = new Transform();
|
|
210
|
+
const original = t.clone();
|
|
211
|
+
|
|
212
|
+
const target = new Vector3(7, 13, -17);
|
|
213
|
+
|
|
214
|
+
t.lookAt(target);
|
|
215
|
+
|
|
216
|
+
expect(t.position.equals(original.position)).toBe(true);
|
|
217
|
+
expect(t.scale.equals(original.scale)).toBe(true);
|
|
218
|
+
|
|
219
|
+
const direction = new Vector3(0, 0, 1);
|
|
220
|
+
|
|
221
|
+
direction.applyQuaternion(t.rotation);
|
|
222
|
+
|
|
223
|
+
const expected_direction = target.clone();
|
|
224
|
+
expected_direction.normalize();
|
|
225
|
+
|
|
226
|
+
expect(direction.roughlyEquals(expected_direction)).toBe(true);
|
|
227
|
+
});
|
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSe
|
|
|
2
2
|
import { Transform } from "./Transform.js";
|
|
3
3
|
|
|
4
4
|
export class TransformSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
klass = Transform;
|
|
7
|
+
version = 1;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
@@ -12,25 +12,24 @@ export const TransformAttachmentFlags = {
|
|
|
12
12
|
const DEFAULT_FLAGS = TransformAttachmentFlags.Immediate;
|
|
13
13
|
|
|
14
14
|
export class TransformAttachment {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* transform relative to the attachment target
|
|
18
|
+
* @type {Transform}
|
|
19
|
+
*/
|
|
20
|
+
transform = new Transform();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Which entity to attach to
|
|
24
|
+
* @type {number}
|
|
25
|
+
*/
|
|
26
|
+
parent = -1;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @type {number}
|
|
31
|
+
*/
|
|
32
|
+
flags = DEFAULT_FLAGS;
|
|
34
33
|
|
|
35
34
|
toString() {
|
|
36
35
|
return JSON.stringify(this.toJSON());
|
|
@@ -4,149 +4,40 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
import List from '../../../../core/collection/list/List.js';
|
|
7
|
-
import {
|
|
7
|
+
import { AnimationRule } from "./AnimationRule.js";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
this.startEvent = startEvent;
|
|
11
|
-
this.stopEvent = null;
|
|
12
|
-
this.animation = animationName;
|
|
13
|
-
this.speed = speed;
|
|
14
|
-
this.transition = transitionTime;
|
|
15
|
-
this.weight = 1;
|
|
16
|
-
this.loop = loop;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
AnimationRule.prototype.toJSON = function () {
|
|
20
|
-
return {
|
|
21
|
-
startEvent: this.startEvent,
|
|
22
|
-
stopEvent: this.stopEvent,
|
|
23
|
-
animation: this.animation,
|
|
24
|
-
speed: this.speed,
|
|
25
|
-
transition: this.transition,
|
|
26
|
-
loop: this.loop,
|
|
27
|
-
weight: this.weight
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
AnimationRule.prototype.fromJSON = function (json) {
|
|
32
|
-
|
|
33
|
-
this.startEvent = json.startEvent;
|
|
34
|
-
this.stopEvent = json.stopEvent;
|
|
35
|
-
|
|
36
|
-
this.animation = json.animation;
|
|
37
|
-
|
|
38
|
-
if (typeof json.speed === "number") {
|
|
39
|
-
this.speed = json.speed;
|
|
40
|
-
} else {
|
|
41
|
-
this.speed = 1;
|
|
42
|
-
}
|
|
9
|
+
class AnimationController {
|
|
43
10
|
|
|
44
|
-
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @type {List<AnimationRule>}
|
|
14
|
+
*/
|
|
15
|
+
rules = new List();
|
|
45
16
|
|
|
46
|
-
|
|
47
|
-
this.
|
|
48
|
-
} else {
|
|
49
|
-
this.loop = false;
|
|
17
|
+
fromJSON(json) {
|
|
18
|
+
this.rules.fromJSON(json, AnimationRule);
|
|
50
19
|
}
|
|
51
20
|
|
|
52
|
-
|
|
53
|
-
this.
|
|
54
|
-
} else {
|
|
55
|
-
this.weight = 1;
|
|
21
|
+
toJSON() {
|
|
22
|
+
return this.rules.toJSON();
|
|
56
23
|
}
|
|
57
|
-
};
|
|
58
24
|
|
|
59
|
-
/**
|
|
60
|
-
*
|
|
61
|
-
* @param {BinaryBuffer} buffer
|
|
62
|
-
*/
|
|
63
|
-
AnimationRule.prototype.toBinaryBuffer = function (buffer) {
|
|
64
|
-
buffer.writeUTF8String(this.animation);
|
|
65
|
-
buffer.writeUTF8String(this.startEvent);
|
|
66
|
-
buffer.writeUTF8String(this.stopEvent);
|
|
67
|
-
|
|
68
|
-
buffer.writeUint8(this.loop ? 1 : 0);
|
|
69
|
-
buffer.writeFloat64(this.weight);
|
|
70
|
-
buffer.writeFloat64(this.transition);
|
|
71
|
-
buffer.writeFloat64(this.speed);
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* @param {BinaryBuffer} buffer
|
|
78
|
-
*/
|
|
79
|
-
AnimationRule.prototype.fromBinaryBuffer = function (buffer) {
|
|
80
|
-
this.animation = buffer.readUTF8String();
|
|
81
|
-
this.startEvent = buffer.readUTF8String();
|
|
82
|
-
this.stopEvent = buffer.readUTF8String();
|
|
83
|
-
|
|
84
|
-
this.loop = buffer.readUint8() !== 0;
|
|
85
|
-
this.weight = buffer.readFloat64();
|
|
86
|
-
this.transition = buffer.readFloat64();
|
|
87
|
-
this.speed = buffer.readFloat64();
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
*
|
|
92
|
-
* @constructor
|
|
93
|
-
*/
|
|
94
|
-
function AnimationController() {
|
|
95
25
|
/**
|
|
96
26
|
*
|
|
97
|
-
* @
|
|
27
|
+
* @param json
|
|
28
|
+
* @returns {AnimationController}
|
|
98
29
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
AnimationController.typeName = "AnimationController";
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
106
|
-
* @param json
|
|
107
|
-
* @returns {AnimationController}
|
|
108
|
-
*/
|
|
109
|
-
AnimationController.fromJSON = function (json) {
|
|
110
|
-
const r = new AnimationController();
|
|
30
|
+
static fromJSON(json) {
|
|
31
|
+
const r = new AnimationController();
|
|
111
32
|
|
|
112
|
-
|
|
33
|
+
r.fromJSON(json);
|
|
113
34
|
|
|
114
|
-
|
|
115
|
-
}
|
|
35
|
+
return r;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
116
38
|
|
|
117
|
-
AnimationController.
|
|
118
|
-
this.rules.fromJSON(json, AnimationRule);
|
|
119
|
-
};
|
|
120
|
-
AnimationController.prototype.toJSON = function () {
|
|
121
|
-
return this.rules.toJSON();
|
|
122
|
-
};
|
|
39
|
+
AnimationController.typeName = "AnimationController";
|
|
123
40
|
|
|
124
41
|
export default AnimationController;
|
|
125
42
|
|
|
126
43
|
|
|
127
|
-
export class AnimationControllerSerializationAdapter extends BinaryClassSerializationAdapter{
|
|
128
|
-
constructor(){
|
|
129
|
-
super();
|
|
130
|
-
|
|
131
|
-
this.klass = AnimationController;
|
|
132
|
-
this.version = 0;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
*
|
|
137
|
-
* @param {BinaryBuffer} buffer
|
|
138
|
-
* @param {AnimationController} value
|
|
139
|
-
*/
|
|
140
|
-
serialize(buffer, value) {
|
|
141
|
-
value.rules.toBinaryBuffer(buffer);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
*
|
|
146
|
-
* @param {BinaryBuffer} buffer
|
|
147
|
-
* @param {AnimationController} value
|
|
148
|
-
*/
|
|
149
|
-
deserialize(buffer, value) {
|
|
150
|
-
value.rules.fromBinaryBuffer(buffer, AnimationRule);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import { AnimationRule } from "./AnimationRule.js";
|
|
3
|
+
import AnimationController from "./AnimationController.js";
|
|
4
|
+
|
|
5
|
+
export class AnimationControllerSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
6
|
+
|
|
7
|
+
klass = AnimationController;
|
|
8
|
+
version = 0;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {BinaryBuffer} buffer
|
|
13
|
+
* @param {AnimationController} value
|
|
14
|
+
*/
|
|
15
|
+
serialize(buffer, value) {
|
|
16
|
+
value.rules.toBinaryBuffer(buffer);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param {BinaryBuffer} buffer
|
|
22
|
+
* @param {AnimationController} value
|
|
23
|
+
*/
|
|
24
|
+
deserialize(buffer, value) {
|
|
25
|
+
value.rules.fromBinaryBuffer(buffer, AnimationRule);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export function AnimationRule(startEvent, animationName, speed, transitionTime, loop = false) {
|
|
2
|
+
this.startEvent = startEvent;
|
|
3
|
+
this.stopEvent = null;
|
|
4
|
+
this.animation = animationName;
|
|
5
|
+
this.speed = speed;
|
|
6
|
+
this.transition = transitionTime;
|
|
7
|
+
this.weight = 1;
|
|
8
|
+
this.loop = loop;
|
|
9
|
+
}
|
|
10
|
+
AnimationRule.prototype.toJSON = function () {
|
|
11
|
+
return {
|
|
12
|
+
startEvent: this.startEvent,
|
|
13
|
+
stopEvent: this.stopEvent,
|
|
14
|
+
animation: this.animation,
|
|
15
|
+
speed: this.speed,
|
|
16
|
+
transition: this.transition,
|
|
17
|
+
loop: this.loop,
|
|
18
|
+
weight: this.weight
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
AnimationRule.prototype.fromJSON = function (json) {
|
|
23
|
+
|
|
24
|
+
this.startEvent = json.startEvent;
|
|
25
|
+
this.stopEvent = json.stopEvent;
|
|
26
|
+
|
|
27
|
+
this.animation = json.animation;
|
|
28
|
+
|
|
29
|
+
if (typeof json.speed === "number") {
|
|
30
|
+
this.speed = json.speed;
|
|
31
|
+
} else {
|
|
32
|
+
this.speed = 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
this.transition = json.transition;
|
|
36
|
+
|
|
37
|
+
if (typeof json.loop === "boolean") {
|
|
38
|
+
this.loop = json.loop;
|
|
39
|
+
} else {
|
|
40
|
+
this.loop = false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (typeof json.weight === "number") {
|
|
44
|
+
this.weight = json.weight;
|
|
45
|
+
} else {
|
|
46
|
+
this.weight = 1;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @param {BinaryBuffer} buffer
|
|
53
|
+
*/
|
|
54
|
+
AnimationRule.prototype.toBinaryBuffer = function (buffer) {
|
|
55
|
+
buffer.writeUTF8String(this.animation);
|
|
56
|
+
buffer.writeUTF8String(this.startEvent);
|
|
57
|
+
buffer.writeUTF8String(this.stopEvent);
|
|
58
|
+
|
|
59
|
+
buffer.writeUint8(this.loop ? 1 : 0);
|
|
60
|
+
buffer.writeFloat64(this.weight);
|
|
61
|
+
buffer.writeFloat64(this.transition);
|
|
62
|
+
buffer.writeFloat64(this.speed);
|
|
63
|
+
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param {BinaryBuffer} buffer
|
|
69
|
+
*/
|
|
70
|
+
AnimationRule.prototype.fromBinaryBuffer = function (buffer) {
|
|
71
|
+
this.animation = buffer.readUTF8String();
|
|
72
|
+
this.startEvent = buffer.readUTF8String();
|
|
73
|
+
this.stopEvent = buffer.readUTF8String();
|
|
74
|
+
|
|
75
|
+
this.loop = buffer.readUint8() !== 0;
|
|
76
|
+
this.weight = buffer.readFloat64();
|
|
77
|
+
this.transition = buffer.readFloat64();
|
|
78
|
+
this.speed = buffer.readFloat64();
|
|
79
|
+
};
|
package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraphSerializationAdapter.js
CHANGED
|
@@ -6,19 +6,17 @@ import {
|
|
|
6
6
|
import { AnimationGraphDefinition } from "./definition/AnimationGraphDefinition.js";
|
|
7
7
|
|
|
8
8
|
export class AnimationGraphSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
klass = AnimationGraph;
|
|
11
|
+
version = 0;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @type {AnimationGraphDefinitionSerializationAdapter}
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
18
|
+
__definitionAdapter = new AnimationGraphDefinitionSerializationAdapter();
|
|
14
19
|
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @type {AnimationGraphDefinitionSerializationAdapter}
|
|
18
|
-
* @private
|
|
19
|
-
*/
|
|
20
|
-
this.__definitionAdapter = new AnimationGraphDefinitionSerializationAdapter();
|
|
21
|
-
}
|
|
22
20
|
|
|
23
21
|
/**
|
|
24
22
|
*
|
|
@@ -10,12 +10,10 @@ import { AnimationStateDefinition } from "../AnimationStateDefinition.js";
|
|
|
10
10
|
import { AnimationTransitionDefinition } from "../AnimationTransitionDefinition.js";
|
|
11
11
|
|
|
12
12
|
export class AnimationGraphDefinitionSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
klass = AnimationGraphDefinition;
|
|
15
|
+
version = 0;
|
|
16
|
+
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
19
|
*
|
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../../../ecs/storage/binary/
|
|
|
2
2
|
import { Camera } from "../Camera.js";
|
|
3
3
|
|
|
4
4
|
export class CameraSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
klass = Camera;
|
|
7
|
+
version = 0;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSerializationAdapter.js
CHANGED
|
@@ -3,12 +3,8 @@ import TopDownCameraController from "./TopDownCameraController.js";
|
|
|
3
3
|
|
|
4
4
|
export class TopDownCameraControllerSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.klass = TopDownCameraController;
|
|
10
|
-
this.version = 1;
|
|
11
|
-
}
|
|
6
|
+
klass = TopDownCameraController;
|
|
7
|
+
version = 1;
|
|
12
8
|
|
|
13
9
|
/**
|
|
14
10
|
*
|
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
import { BinaryClassSerializationAdapter } from "../../../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
2
|
|
|
3
3
|
export class TopDownCameraLander {
|
|
4
|
-
constructor() {
|
|
5
|
-
|
|
6
|
-
}
|
|
7
4
|
}
|
|
8
5
|
|
|
9
6
|
TopDownCameraLander.typeName = 'TopDownCameraLander';
|
|
10
7
|
|
|
11
8
|
export class TopDownCameraLanderSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
|
|
15
|
-
this.klass = TopDownCameraLander;
|
|
16
|
-
this.version = 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
serialize(buffer, value) {
|
|
20
|
-
|
|
21
|
-
}
|
|
22
9
|
|
|
23
|
-
|
|
10
|
+
klass = TopDownCameraLander;
|
|
11
|
+
version = 0;
|
|
24
12
|
|
|
25
|
-
|
|
13
|
+
// NO-OP
|
|
26
14
|
}
|
|
@@ -2,11 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../../../ecs/storage/binary/
|
|
|
2
2
|
import { Decal } from "./Decal.js";
|
|
3
3
|
|
|
4
4
|
export class DecalSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
klass = Decal;
|
|
7
|
+
version = 0;
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
*
|
|
@@ -6,12 +6,9 @@ import {
|
|
|
6
6
|
} from "../../../ecs/storage/COMPONENT_SERIALIZATION_TRANSIENT_FIELD.js";
|
|
7
7
|
|
|
8
8
|
export class HighlightSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
10
|
+
klass = Highlight;
|
|
11
|
+
version = 1;
|
|
15
12
|
|
|
16
13
|
/**
|
|
17
14
|
*
|
|
@@ -22,7 +22,7 @@ import { makeHighlightDecodeShader } from "./HighlightDecodeShader.js";
|
|
|
22
22
|
import { makeDilationShader } from "./makeDilationShader.js";
|
|
23
23
|
import { ScreenSpaceQuadShader } from "../../../shaders/ScreenSpaceQuadShader.js";
|
|
24
24
|
import { makeGaussianBlurShader } from "./makeGaussianBlurShader.js";
|
|
25
|
-
import { HashMap } from "../../../../../core/collection/HashMap.js";
|
|
25
|
+
import { HashMap } from "../../../../../core/collection/map/HashMap.js";
|
|
26
26
|
import { invokeObjectEquals } from "../../../../../core/model/object/invokeObjectEquals.js";
|
|
27
27
|
import { invokeObjectHash } from "../../../../../core/model/object/invokeObjectHash.js";
|
|
28
28
|
import { assert } from "../../../../../core/assert.js";
|
|
@@ -3,12 +3,9 @@ import { LightType } from "./LightType.js";
|
|
|
3
3
|
import { Light } from "./Light.js";
|
|
4
4
|
|
|
5
5
|
export class LightSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
7
|
+
klass = Light;
|
|
8
|
+
version = 0;
|
|
12
9
|
|
|
13
10
|
/**
|
|
14
11
|
*
|
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../../../ecs/storage/binary/
|
|
|
2
2
|
import Mesh from "../Mesh.js";
|
|
3
3
|
|
|
4
4
|
export class MeshSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
klass = Mesh;
|
|
7
|
+
version = 0;
|
|
11
8
|
|
|
12
9
|
|
|
13
10
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractRenderAdapter } from "./AbstractRenderAdapter.js";
|
|
2
|
-
import { HashMap } from "../../../../../../core/collection/HashMap.js";
|
|
2
|
+
import { HashMap } from "../../../../../../core/collection/map/HashMap.js";
|
|
3
3
|
import { InstancedMeshGroup } from "../../../../geometry/instancing/InstancedMeshGroup.js";
|
|
4
4
|
import { ShadedGeometryFlags } from "../../ShadedGeometryFlags.js";
|
|
5
5
|
import { StreamDrawUsage } from "three";
|
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/Bin
|
|
|
2
2
|
import Water from "./Water.js";
|
|
3
3
|
|
|
4
4
|
export class WaterSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
klass = Water;
|
|
7
|
+
version = 1;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StaticMaterialCache } from "../../../../asset/loaders/material/StaticMaterialCache.js";
|
|
2
|
-
import { HashMap } from "../../../../../core/collection/HashMap.js";
|
|
2
|
+
import { HashMap } from "../../../../../core/collection/map/HashMap.js";
|
|
3
3
|
import { computeGeometryEquality } from "../../buffered/computeGeometryEquality.js";
|
|
4
4
|
import { computeGeometryHash } from "../../buffered/computeGeometryHash.js";
|
|
5
5
|
import { array_copy } from "../../../../../core/collection/array/array_copy.js";
|
|
@@ -7,7 +7,7 @@ import { mat4, vec3 } from "gl-matrix";
|
|
|
7
7
|
import { BakeShaderStandard } from "./shader/BakeShaderStandard.js";
|
|
8
8
|
import { Sampler2D } from "../../texture/sampler/Sampler2D.js";
|
|
9
9
|
import Signal from "../../../../core/events/signal/Signal.js";
|
|
10
|
-
import { HashMap } from "../../../../core/collection/HashMap.js";
|
|
10
|
+
import { HashMap } from "../../../../core/collection/map/HashMap.js";
|
|
11
11
|
import { computeMaterialHash } from "../../../asset/loaders/material/computeMaterialHash.js";
|
|
12
12
|
import { computeMaterialEquality } from "../../../asset/loaders/material/computeMaterialEquality.js";
|
|
13
13
|
import { UvEncoder } from "./grid/UvEncoder.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HashMap } from "../../../../core/collection/HashMap.js";
|
|
1
|
+
import { HashMap } from "../../../../core/collection/map/HashMap.js";
|
|
2
2
|
import { ManagedMaterial } from "./ManagedMaterial.js";
|
|
3
3
|
import { Cache } from "../../../../core/cache/Cache.js";
|
|
4
4
|
import { computeMaterialHash } from "../../../asset/loaders/material/computeMaterialHash.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { traverseThreeObject } from "../../ecs/highlight/renderer/traverseThreeObject.js";
|
|
2
2
|
import { TextureAttachmentsByMaterialType } from "../../../asset/loaders/material/TextureAttachmensByMaterialType.js";
|
|
3
|
-
import { HashMap } from "../../../../core/collection/HashMap.js";
|
|
3
|
+
import { HashMap } from "../../../../core/collection/map/HashMap.js";
|
|
4
4
|
import AABB2 from "../../../../core/geom/AABB2.js";
|
|
5
5
|
import { MaxRectanglesPacker } from "../../../../core/geom/packing/max-rect/MaxRectangles.js";
|
|
6
6
|
import { Sampler2D } from "../../texture/sampler/Sampler2D.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HashMap } from "../../../../../core/collection/HashMap.js";
|
|
1
|
+
import { HashMap } from "../../../../../core/collection/map/HashMap.js";
|
|
2
2
|
import { NodeInstancePortReference } from "../../../../../core/model/node-graph/node/NodeInstancePortReference.js";
|
|
3
3
|
|
|
4
4
|
export class CodeContext {
|
|
@@ -4,12 +4,9 @@ import {
|
|
|
4
4
|
import { ParameterLookupTable } from "../../parameter/ParameterLookupTable.js";
|
|
5
5
|
|
|
6
6
|
export class ParameterLookupTableSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
8
|
+
klass = ParameterLookupTable;
|
|
9
|
+
version = 0;
|
|
13
10
|
|
|
14
11
|
/**
|
|
15
12
|
*
|