@woosh/meep-engine 2.70.0 → 2.72.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-terrain.js +1 -1
- package/build/meep.cjs +111 -122
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +111 -122
- package/package.json +1 -1
- package/src/core/collection/array/array_get_index_in_range.js +1 -1
- package/src/core/collection/array/array_swap.js +2 -2
- package/src/core/geom/3d/quaternion/quat_encode_to_uint32.js +2 -3
- package/src/core/geom/3d/v3_compute_triangle_normal.js +7 -1
- package/src/core/geom/vec3/v3_normalize_array.js +27 -0
- package/src/core/math/remap.js +5 -1
- package/src/core/math/statistics/computeStatisticalPartialMedian.js +1 -1
- 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/terrain/BufferedGeometryArraysBuilder.js +2 -2
- package/src/engine/ecs/transform/TransformSerializationAdapter.js +5 -10
- package/src/engine/graphics/geometry/buffered/ComputeNormals.js +11 -26
- package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +20 -20
- package/src/engine/graphics/texture/sprite/prototypeSpriteCutoutGeometry.js +12 -12
- package/src/engine/graphics/texture/virtual/v2/NOTES.md +17 -0
- package/src/engine/graphics/texture/virtual/v2/ShaderUsage.js +49 -26
- package/src/engine/graphics/texture/virtual/v2/UsageDebugView.js +51 -0
- package/src/engine/graphics/texture/virtual/v2/UsageMetadata.js +221 -0
- package/src/engine/graphics/texture/virtual/v2/UsagePyramidDebugView.js +239 -0
- package/src/engine/graphics/texture/virtual/v2/VirtualTextureManager.js +248 -0
- package/src/engine/graphics/texture/virtual/v2/prototype.js +104 -31
- 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/core/geom/2d/quad-tree/PointQuadTree.js +0 -478
- package/src/core/math/random/makeRangedRandom.js +0 -19
- 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
- package/src/engine/ecs/terrain/TerrainGeometryBuilder.js +0 -152
- package/src/engine/ecs/terrain/ecs/PromiseSamplerHeight.js +0 -66
- package/src/engine/ecs/terrain/ecs/TerrainClassifier.js +0 -125
- package/src/engine/graphics/texture/sampler/SampleTraverser.js +0 -165
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import GUIElementSystem from "../../../ecs/gui/GUIElementSystem.js";
|
|
2
|
+
import ViewportPositionSystem from "../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
3
|
+
import { EngineConfiguration } from "../../../EngineConfiguration.js";
|
|
1
4
|
import { EngineHarness } from "../../../EngineHarness.js";
|
|
2
5
|
import { AnimationCurve } from "../AnimationCurve.js";
|
|
6
|
+
import { build_plot_entity_from_array } from "../draw/build_plot_entity_from_array.js";
|
|
3
7
|
import { Keyframe } from "../Keyframe.js";
|
|
4
|
-
import { EngineConfiguration } from "../../../EngineConfiguration.js";
|
|
5
|
-
import GUIElementSystem from "../../../ecs/gui/GUIElementSystem.js";
|
|
6
|
-
import ViewportPositionSystem from "../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
7
|
-
import { sample_animation_curve_to_float_array } from "./sample_animation_curve_to_float_array.js";
|
|
8
8
|
import { downsample_float_array_curve_by_error } from "./downsample_float_array_curve_by_error.js";
|
|
9
|
-
import {
|
|
9
|
+
import { sample_animation_curve_to_float_array } from "./sample_animation_curve_to_float_array.js";
|
|
10
10
|
|
|
11
11
|
const eh = new EngineHarness();
|
|
12
12
|
|
|
@@ -134,7 +134,7 @@ async function main(engine) {
|
|
|
134
134
|
return curve;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
const curve =
|
|
137
|
+
const curve = sample_curve_0();
|
|
138
138
|
|
|
139
139
|
curve.smoothAllTangents();
|
|
140
140
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
1
2
|
import { CanvasView } from "../../../../view/elements/CanvasView.js";
|
|
2
|
-
import { plot_data } from "./plot_data.js";
|
|
3
|
-
import { draw_label } from "./draw_label.js";
|
|
4
3
|
import Entity from "../../../ecs/Entity.js";
|
|
5
|
-
import ViewportPosition from "../../../ecs/gui/position/ViewportPosition.js";
|
|
6
4
|
import GUIElement from "../../../ecs/gui/GUIElement.js";
|
|
7
|
-
import
|
|
5
|
+
import ViewportPosition from "../../../ecs/gui/position/ViewportPosition.js";
|
|
6
|
+
import { draw_label } from "./draw_label.js";
|
|
7
|
+
import { plot_data } from "./plot_data.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
@@ -22,12 +22,17 @@ export function build_plot_entity_from_array({
|
|
|
22
22
|
x, y,
|
|
23
23
|
width = 600,
|
|
24
24
|
height = 200,
|
|
25
|
-
margin = new Vector2(10,10),
|
|
25
|
+
margin = new Vector2(10, 10),
|
|
26
26
|
label = ''
|
|
27
27
|
}) {
|
|
28
28
|
|
|
29
29
|
const canvasView = new CanvasView();
|
|
30
30
|
canvasView.size.set(width, height);
|
|
31
|
+
canvasView.css({
|
|
32
|
+
position: "absolute",
|
|
33
|
+
left: "0",
|
|
34
|
+
top: "0"
|
|
35
|
+
});
|
|
31
36
|
const ctx = canvasView.context2d;
|
|
32
37
|
|
|
33
38
|
plot_data({ ctx, data, width, height, margin });
|
|
@@ -36,7 +41,7 @@ export function build_plot_entity_from_array({
|
|
|
36
41
|
draw_label(ctx, text, margin.x, height - (20));
|
|
37
42
|
|
|
38
43
|
if (typeof label === "string" && label.length > 0) {
|
|
39
|
-
draw_label(ctx, label,
|
|
44
|
+
draw_label(ctx, label, width - margin.x - 50 , 20)
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
return new Entity()
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
export class DynamicActor {
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* @type {number[]}
|
|
9
|
-
*/
|
|
10
|
-
this.context = [];
|
|
11
|
-
|
|
12
|
-
}
|
|
3
|
+
/**
|
|
4
|
+
* Entities whose blackboards should be included into evaluation context
|
|
5
|
+
* @type {number[]}
|
|
6
|
+
*/
|
|
7
|
+
context = [];
|
|
13
8
|
}
|
|
14
9
|
|
|
15
10
|
/**
|
|
@@ -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
|
}
|