@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
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { DynamicActor } from "./DynamicActor.js";
|
|
2
|
-
import { AbstractContextSystem } from "../system/AbstractContextSystem.js";
|
|
3
|
-
import { SystemEntityContext } from "../system/SystemEntityContext.js";
|
|
4
1
|
import { DataScope } from "../../../../../model/game/unit/actions/data/DataScope.js";
|
|
5
|
-
import {
|
|
2
|
+
import { OverrideContextBehavior } from "../../../../../model/game/util/behavior/OverrideContextBehavior.js";
|
|
3
|
+
import { assert } from "../../../core/assert.js";
|
|
4
|
+
import { randomMultipleFromArray } from "../../../core/collection/array/randomMultipleFromArray.js";
|
|
5
|
+
import { HashMap } from "../../../core/collection/map/HashMap.js";
|
|
6
6
|
import { returnTrue } from "../../../core/function/Functions.js";
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
7
|
+
import { randomFloatBetween } from "../../../core/math/random/randomFloatBetween.js";
|
|
8
|
+
import { randomFromArray } from "../../../core/math/random/randomFromArray.js";
|
|
9
|
+
import { ResourceAccessKind } from "../../../core/model/ResourceAccessKind.js";
|
|
10
|
+
import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
|
|
11
|
+
import { number_compare_descending } from "../../../core/primitives/numbers/number_compare_descending.js";
|
|
12
|
+
import { computeStringHash } from "../../../core/primitives/strings/computeStringHash.js";
|
|
10
13
|
import { SequenceBehavior } from "../../intelligence/behavior/composite/SequenceBehavior.js";
|
|
14
|
+
import { BehaviorComponent } from "../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
11
15
|
import { DieBehavior } from "../../intelligence/behavior/ecs/DieBehavior.js";
|
|
16
|
+
import { Blackboard } from "../../intelligence/blackboard/Blackboard.js";
|
|
17
|
+
import { EntityProxyScope } from "../binding/EntityProxyScope.js";
|
|
12
18
|
import { SerializationMetadata } from "../components/SerializationMetadata.js";
|
|
13
19
|
import Tag from "../components/Tag.js";
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
20
|
+
import Entity from "../Entity.js";
|
|
21
|
+
import { EntityFlags } from "../EntityFlags.js";
|
|
22
|
+
import { AbstractContextSystem } from "../system/AbstractContextSystem.js";
|
|
23
|
+
import { SystemEntityContext } from "../system/SystemEntityContext.js";
|
|
24
|
+
import { DynamicActor } from "./DynamicActor.js";
|
|
17
25
|
import { RuleExecution } from "./RuleExecution.js";
|
|
18
26
|
import { computeContextualDynamicRuleDebugString } from "./rules/computeContextualDynamicRuleDebugString.js";
|
|
19
|
-
import { computeStringHash } from "../../../core/primitives/strings/computeStringHash.js";
|
|
20
|
-
import { randomFromArray } from "../../../core/math/random/randomFromArray.js";
|
|
21
|
-
import { randomFloatBetween } from "../../../core/math/random/randomFloatBetween.js";
|
|
22
|
-
import { randomMultipleFromArray } from "../../../core/collection/array/randomMultipleFromArray.js";
|
|
23
|
-
import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
|
|
24
|
-
import { ResourceAccessKind } from "../../../core/model/ResourceAccessKind.js";
|
|
25
|
-
import { EntityFlags } from "../EntityFlags.js";
|
|
26
|
-
import { number_compare_descending } from "../../../core/primitives/numbers/number_compare_descending.js";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* In seconds
|
|
@@ -39,21 +39,13 @@ const IDLE_EVENT_TIMEOUT_MAX = 5;
|
|
|
39
39
|
|
|
40
40
|
class Context extends SystemEntityContext {
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
super();
|
|
42
|
+
execution = new RuleExecution();
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*/
|
|
51
|
-
this.next_idle_event_time = 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
process(entity, scope) {
|
|
55
|
-
|
|
56
|
-
}
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @type {number}
|
|
47
|
+
*/
|
|
48
|
+
next_idle_event_time = 0;
|
|
57
49
|
|
|
58
50
|
/**
|
|
59
51
|
*
|
|
@@ -99,77 +91,78 @@ class Context extends SystemEntityContext {
|
|
|
99
91
|
|
|
100
92
|
|
|
101
93
|
export class DynamicActorSystem extends AbstractContextSystem {
|
|
94
|
+
dependencies = [DynamicActor];
|
|
95
|
+
|
|
96
|
+
components_used = [
|
|
97
|
+
ResourceAccessSpecification.from(Blackboard, ResourceAccessKind.Read)
|
|
98
|
+
];
|
|
99
|
+
|
|
102
100
|
/**
|
|
103
101
|
*
|
|
104
|
-
* @
|
|
102
|
+
* @type {DynamicRuleDescriptionTable}
|
|
105
103
|
*/
|
|
106
|
-
|
|
107
|
-
super(Context);
|
|
108
|
-
|
|
109
|
-
this.dependencies = [DynamicActor];
|
|
104
|
+
database = null;
|
|
110
105
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Scope used for dispatching actions
|
|
108
|
+
* @type {DataScope}
|
|
109
|
+
*/
|
|
110
|
+
scope = new DataScope();
|
|
114
111
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
112
|
+
/**
|
|
113
|
+
* When precisely each rule was last used
|
|
114
|
+
* @type {HashMap<DynamicRuleDescription, number>}
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
117
|
+
__global_last_used_times = new HashMap({
|
|
118
|
+
keyEqualityFunction(a, b) {
|
|
119
|
+
return a.id === b.id;
|
|
120
|
+
},
|
|
121
|
+
keyHashFunction(k) {
|
|
122
|
+
return computeStringHash(k.id);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
120
125
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
/**
|
|
127
|
+
* Time when a group with an ID will be cooled down
|
|
128
|
+
* @type {Map<string, number>}
|
|
129
|
+
* @private
|
|
130
|
+
*/
|
|
131
|
+
__global_cooldown_ready = new Map();
|
|
126
132
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
* @type {MultiPredicateEvaluator}
|
|
136
|
+
*/
|
|
137
|
+
evaluator = null;
|
|
132
138
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
keyEqualityFunction(a, b) {
|
|
140
|
-
return a.id === b.id;
|
|
141
|
-
},
|
|
142
|
-
keyHashFunction(k) {
|
|
143
|
-
return computeStringHash(k.id);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @type {number}
|
|
142
|
+
* @private
|
|
143
|
+
*/
|
|
144
|
+
__current_time = 0;
|
|
146
145
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Print debug output into console
|
|
148
|
+
* @type {boolean}
|
|
149
|
+
* @private
|
|
150
|
+
*/
|
|
151
|
+
__debug = false;
|
|
153
152
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
153
|
+
/**
|
|
154
|
+
*
|
|
155
|
+
* @param {Engine} engine
|
|
156
|
+
*/
|
|
157
|
+
constructor(engine) {
|
|
158
|
+
super(Context);
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
161
|
*
|
|
162
|
-
* @type {
|
|
163
|
-
* @private
|
|
162
|
+
* @type {Engine}
|
|
164
163
|
*/
|
|
165
|
-
this.
|
|
164
|
+
this.engine = engine;
|
|
166
165
|
|
|
167
|
-
/**
|
|
168
|
-
* Print debug output into console
|
|
169
|
-
* @type {boolean}
|
|
170
|
-
* @private
|
|
171
|
-
*/
|
|
172
|
-
this.__debug = false;
|
|
173
166
|
}
|
|
174
167
|
|
|
175
168
|
/**
|
|
@@ -369,7 +362,7 @@ export class DynamicActorSystem extends AbstractContextSystem {
|
|
|
369
362
|
|
|
370
363
|
evaluator.initialize(context);
|
|
371
364
|
|
|
372
|
-
for (
|
|
365
|
+
for (; ;) {
|
|
373
366
|
const predicate = evaluator.next();
|
|
374
367
|
|
|
375
368
|
if (predicate === undefined) {
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
export class RuleExecution {
|
|
2
|
-
constructor() {
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @type {DynamicRuleDescription}
|
|
6
|
+
*/
|
|
7
|
+
rule = null;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @type {Entity}
|
|
11
|
+
*/
|
|
12
|
+
executor = null
|
|
14
13
|
|
|
15
|
-
}
|
|
16
14
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by Alex on 09/02/2015.
|
|
3
3
|
*/
|
|
4
|
-
import Vector2 from '../../../core/geom/Vector2.js';
|
|
5
|
-
import ObservedBoolean from "../../../core/model/ObservedBoolean.js";
|
|
6
|
-
import { COMPONENT_SERIALIZATION_TRANSIENT_FIELD } from "../storage/COMPONENT_SERIALIZATION_TRANSIENT_FIELD.js";
|
|
7
4
|
import { assert } from "../../../core/assert.js";
|
|
5
|
+
import { computeHashIntegerArray } from "../../../core/collection/array/computeHashIntegerArray.js";
|
|
6
|
+
import Vector2 from '../../../core/geom/Vector2.js';
|
|
8
7
|
import { objectDeepEquals } from "../../../core/model/object/objectDeepEquals.js";
|
|
8
|
+
import ObservedBoolean from "../../../core/model/ObservedBoolean.js";
|
|
9
9
|
import { computeStringHash } from "../../../core/primitives/strings/computeStringHash.js";
|
|
10
|
-
import { computeHashIntegerArray } from "../../../core/collection/array/computeHashIntegerArray.js";
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
*
|
|
@@ -27,64 +26,48 @@ export const GUIElementFlag = {
|
|
|
27
26
|
class GUIElement {
|
|
28
27
|
/**
|
|
29
28
|
*
|
|
30
|
-
* @
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
* @type {ObservedBoolean}
|
|
75
|
-
*/
|
|
76
|
-
this.visible = new ObservedBoolean(true);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (view !== undefined) {
|
|
80
|
-
console.warn('constructor parameters are deprecated');
|
|
81
|
-
this.view = view;
|
|
82
|
-
|
|
83
|
-
//set non-serializable flag
|
|
84
|
-
this[COMPONENT_SERIALIZATION_TRANSIENT_FIELD] = true;
|
|
85
|
-
}
|
|
29
|
+
* @type {View}
|
|
30
|
+
*/
|
|
31
|
+
view = null;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @type {String}
|
|
36
|
+
*/
|
|
37
|
+
klass = null;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @type {Object}
|
|
42
|
+
*/
|
|
43
|
+
parameters = {};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* ranges from 0..1 in both X and Y, controls anchor point of element positioning
|
|
47
|
+
* @type {Vector2}
|
|
48
|
+
*/
|
|
49
|
+
anchor = new Vector2(0, 0);
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Used for visual grouping of elements, system will create and manage named containers to group elements together
|
|
53
|
+
* @readonly
|
|
54
|
+
* @type {String|null}
|
|
55
|
+
*/
|
|
56
|
+
group = null;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @private
|
|
60
|
+
* @type {number}
|
|
61
|
+
*/
|
|
62
|
+
flags = GUIElementFlag.Managed;
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @type {ObservedBoolean}
|
|
68
|
+
*/
|
|
69
|
+
visible = new ObservedBoolean(true);
|
|
86
70
|
|
|
87
|
-
}
|
|
88
71
|
|
|
89
72
|
/**
|
|
90
73
|
*
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* Created by Alex on 09/02/2015.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { System } from '../System.js';
|
|
6
|
-
import GUIElement, { GUIElementFlag } from './GUIElement.js';
|
|
7
5
|
import EmptyView from "../../../view/elements/EmptyView.js";
|
|
8
|
-
import domify from "../../../view/DOM.js";
|
|
9
6
|
import View from "../../../view/View.js";
|
|
7
|
+
import { System } from '../System.js';
|
|
8
|
+
import GUIElement, { GUIElementFlag } from './GUIElement.js';
|
|
10
9
|
import { GUIElementEvent } from "./GUIElementEvent.js";
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -38,6 +37,30 @@ function handleComponentVisibilityChange(v) {
|
|
|
38
37
|
export const EVENT_VIEW_INSTANTIATED = 'component.gui-element.view.instantiated';
|
|
39
38
|
|
|
40
39
|
class GUIElementSystem extends System {
|
|
40
|
+
|
|
41
|
+
view = new EmptyView({
|
|
42
|
+
classList: ["gui-system-root"],
|
|
43
|
+
css: {
|
|
44
|
+
|
|
45
|
+
position: "absolute",
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
zIndex: 100,
|
|
49
|
+
width: "inherit",
|
|
50
|
+
height: "inherit",
|
|
51
|
+
userSelect: "none",
|
|
52
|
+
pointerEvents: "none"
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
dependencies = [GUIElement];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @type {Object<View>}
|
|
61
|
+
*/
|
|
62
|
+
groups = {};
|
|
63
|
+
|
|
41
64
|
/**
|
|
42
65
|
*
|
|
43
66
|
* @param {View} containerView
|
|
@@ -65,22 +88,6 @@ class GUIElementSystem extends System {
|
|
|
65
88
|
super();
|
|
66
89
|
this.containerView = containerView;
|
|
67
90
|
|
|
68
|
-
this.view = new EmptyView();
|
|
69
|
-
|
|
70
|
-
domify(this.view.el)
|
|
71
|
-
.addClass("gui-system-root")
|
|
72
|
-
.css({
|
|
73
|
-
position: "absolute",
|
|
74
|
-
top: 0,
|
|
75
|
-
left: 0,
|
|
76
|
-
zIndex: 100,
|
|
77
|
-
width: "inherit",
|
|
78
|
-
height: "inherit",
|
|
79
|
-
userSelect: "none",
|
|
80
|
-
pointerEvents: "none"
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
this.dependencies = [GUIElement];
|
|
84
91
|
|
|
85
92
|
/**
|
|
86
93
|
* @type {ModuleRegistry}
|
|
@@ -93,11 +100,6 @@ class GUIElementSystem extends System {
|
|
|
93
100
|
*/
|
|
94
101
|
this.engine = engine;
|
|
95
102
|
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
* @type {Object<View>}
|
|
99
|
-
*/
|
|
100
|
-
this.groups = {};
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
shutdown(em, cmOk, cbFailure) {
|
|
@@ -5,27 +5,24 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
8
9
|
import Vector3 from '../../../../core/geom/Vector3.js';
|
|
9
10
|
import { HeadsUpDisplayFlag } from "./HeadsUpDisplayFlag.js";
|
|
10
|
-
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
11
11
|
|
|
12
12
|
class HeadsUpDisplay {
|
|
13
|
+
|
|
13
14
|
/**
|
|
14
15
|
*
|
|
16
|
+
* @type {Vector3}
|
|
15
17
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
* @type {number}
|
|
26
|
-
*/
|
|
27
|
-
this.flags = HeadsUpDisplayFlag.TransformWorldOffset;
|
|
28
|
-
}
|
|
18
|
+
worldOffset = new Vector3();
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @type {number}
|
|
23
|
+
*/
|
|
24
|
+
flags = HeadsUpDisplayFlag.TransformWorldOffset;
|
|
25
|
+
|
|
29
26
|
|
|
30
27
|
/**
|
|
31
28
|
*
|
|
@@ -103,7 +100,7 @@ class HeadsUpDisplay {
|
|
|
103
100
|
this.writeFlag(HeadsUpDisplayFlag.PerspectiveRotation, perspectiveRotation);
|
|
104
101
|
}
|
|
105
102
|
|
|
106
|
-
static fromJSON(j){
|
|
103
|
+
static fromJSON(j) {
|
|
107
104
|
const r = new HeadsUpDisplay();
|
|
108
105
|
|
|
109
106
|
r.fromJSON(j);
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
* Date: 22/6/2014
|
|
4
4
|
* Time: 22:07
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
6
|
+
import { mat4 } from "gl-matrix";
|
|
7
|
+
import { ResourceAccessKind } from "../../../../core/model/ResourceAccessKind.js";
|
|
8
|
+
import { ResourceAccessSpecification } from "../../../../core/model/ResourceAccessSpecification.js";
|
|
9
9
|
import { GraphicsEngine } from "../../../graphics/GraphicsEngine.js";
|
|
10
10
|
import { FogOfWarVisibilityPredicate } from "../../fow/FogOfWarVisibilityPredicate.js";
|
|
11
|
-
import
|
|
11
|
+
import { System } from '../../System.js';
|
|
12
|
+
import { Transform } from '../../transform/Transform.js';
|
|
12
13
|
import GUIElement from "../GUIElement.js";
|
|
14
|
+
import ViewportPosition from "../position/ViewportPosition.js";
|
|
15
|
+
import HeadsUpDisplay from './HeadsUpDisplay.js';
|
|
13
16
|
import { HeadsUpDisplayFlag } from "./HeadsUpDisplayFlag.js";
|
|
14
|
-
import { mat4 } from "gl-matrix";
|
|
15
|
-
import { ResourceAccessSpecification } from "../../../../core/model/ResourceAccessSpecification.js";
|
|
16
|
-
import { ResourceAccessKind } from "../../../../core/model/ResourceAccessKind.js";
|
|
17
17
|
|
|
18
18
|
const projection = new Float32Array(16);
|
|
19
19
|
|
|
@@ -25,6 +25,14 @@ const projection = new Float32Array(16);
|
|
|
25
25
|
* @constructor
|
|
26
26
|
*/
|
|
27
27
|
class HeadsUpDisplaySystem extends System {
|
|
28
|
+
dependencies = [HeadsUpDisplay];
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
components_used = [
|
|
32
|
+
ResourceAccessSpecification.from(GUIElement, ResourceAccessKind.Read | ResourceAccessKind.Write),
|
|
33
|
+
ResourceAccessSpecification.from(ViewportPosition, ResourceAccessKind.Read | ResourceAccessKind.Write),
|
|
34
|
+
];
|
|
35
|
+
|
|
28
36
|
/**
|
|
29
37
|
*
|
|
30
38
|
* @param {GraphicsEngine} graphicsEngine
|
|
@@ -32,14 +40,6 @@ class HeadsUpDisplaySystem extends System {
|
|
|
32
40
|
constructor(graphicsEngine) {
|
|
33
41
|
super();
|
|
34
42
|
|
|
35
|
-
this.dependencies = [HeadsUpDisplay];
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this.components_used = [
|
|
39
|
-
ResourceAccessSpecification.from(GUIElement, ResourceAccessKind.Read | ResourceAccessKind.Write),
|
|
40
|
-
ResourceAccessSpecification.from(ViewportPosition, ResourceAccessKind.Read | ResourceAccessKind.Write),
|
|
41
|
-
];
|
|
42
|
-
|
|
43
43
|
if (!(graphicsEngine instanceof GraphicsEngine)) {
|
|
44
44
|
throw new TypeError(`graphicsEngine is not an instance of GraphicsEngine`);
|
|
45
45
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { System } from "../../System.js";
|
|
2
|
-
import { GuiElementParallax } from "./GuiElementParallax.js";
|
|
3
2
|
import GUIElement from "../GUIElement.js";
|
|
3
|
+
import { GuiElementParallax } from "./GuiElementParallax.js";
|
|
4
4
|
|
|
5
5
|
export class GuiElementParallaxSystem extends System {
|
|
6
|
+
dependencies = [GuiElementParallax, GUIElement];
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
@@ -12,7 +13,6 @@ export class GuiElementParallaxSystem extends System {
|
|
|
12
13
|
constructor({ viewport, pointer }) {
|
|
13
14
|
super();
|
|
14
15
|
|
|
15
|
-
this.dependencies = [GuiElementParallax, GUIElement];
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
*
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Created by Alex on 28/01/2015.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
5
6
|
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
6
7
|
import ObservedBoolean from "../../../../core/model/ObservedBoolean.js";
|
|
7
|
-
import { BinaryClassSerializationAdapter } from "../../storage/binary/BinaryClassSerializationAdapter.js";
|
|
8
|
-
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
9
8
|
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -20,11 +19,9 @@ export const ViewportPositionFlags = {
|
|
|
20
19
|
class ViewportPosition {
|
|
21
20
|
/**
|
|
22
21
|
*
|
|
23
|
-
* @param {Vector2} [position]
|
|
24
|
-
* @param {Vector2} [offset]
|
|
25
22
|
* @constructor
|
|
26
23
|
*/
|
|
27
|
-
constructor(
|
|
24
|
+
constructor(options) {
|
|
28
25
|
/**
|
|
29
26
|
* Clip-scale position, on-screen values are in range of 0 to 1
|
|
30
27
|
* @type {Vector2}
|
|
@@ -70,12 +67,9 @@ class ViewportPosition {
|
|
|
70
67
|
*/
|
|
71
68
|
this.enabled = new ObservedBoolean(true);
|
|
72
69
|
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (offset !== void 0) {
|
|
78
|
-
this.offset.copy(offset);
|
|
70
|
+
if (options !== undefined) {
|
|
71
|
+
console.warn("ViewportPosition constructor options is deprecated, please use static fromJSON method instead if you need similar functionality");
|
|
72
|
+
this.fromJSON(options);
|
|
79
73
|
}
|
|
80
74
|
}
|
|
81
75
|
|
|
@@ -150,42 +144,3 @@ ViewportPosition.serializable = true;
|
|
|
150
144
|
|
|
151
145
|
export default ViewportPosition;
|
|
152
146
|
|
|
153
|
-
export class ViewportPositionSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
154
|
-
|
|
155
|
-
version = 0;
|
|
156
|
-
klass = ViewportPosition;
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
*
|
|
160
|
-
* @param {BinaryBuffer} buffer
|
|
161
|
-
* @param {ViewportPosition} value
|
|
162
|
-
*/
|
|
163
|
-
serialize(buffer, value) {
|
|
164
|
-
value.position.toBinaryBufferFloat32(buffer);
|
|
165
|
-
value.offset.toBinaryBufferFloat32(buffer);
|
|
166
|
-
value.anchor.toBinaryBufferFloat32(buffer);
|
|
167
|
-
|
|
168
|
-
buffer.writeFloat32(value.screenEdgeWidth);
|
|
169
|
-
|
|
170
|
-
buffer.writeUint8(value.resolveGuiCollisions ? 1 : 0);
|
|
171
|
-
buffer.writeUint8(value.stickToScreenEdge ? 1 : 0);
|
|
172
|
-
buffer.writeUint8(value.enabled.getValue() ? 1 : 0);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
*
|
|
177
|
-
* @param {BinaryBuffer} buffer
|
|
178
|
-
* @param {ViewportPosition} value
|
|
179
|
-
*/
|
|
180
|
-
deserialize(buffer, value) {
|
|
181
|
-
value.position.fromBinaryBufferFloat32(buffer);
|
|
182
|
-
value.offset.fromBinaryBufferFloat32(buffer);
|
|
183
|
-
value.anchor.fromBinaryBufferFloat32(buffer);
|
|
184
|
-
|
|
185
|
-
value.screenEdgeWidth = buffer.readFloat32();
|
|
186
|
-
|
|
187
|
-
value.resolveGuiCollisions = buffer.readUint8() !== 0;
|
|
188
|
-
value.stickToScreenEdge = buffer.readUint8() !== 0;
|
|
189
|
-
value.enabled.set(buffer.readUint8() !== 0);
|
|
190
|
-
}
|
|
191
|
-
}
|