@woosh/meep-engine 2.120.1 → 2.120.3
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/README.md +1 -1
- package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +2 -1
- package/editor/view/ecs/EntityEditor.js +2 -1
- package/editor/view/makeEntityDecorators.js +5 -5
- package/package.json +1 -1
- package/src/core/binary/BitSet.d.ts +59 -38
- package/src/core/binary/BitSet.d.ts.map +1 -1
- package/src/core/binary/BitSet.js +76 -55
- package/src/core/function/noop.d.ts +4 -1
- package/src/core/function/noop.d.ts.map +1 -1
- package/src/core/function/noop.js +4 -1
- package/src/core/geom/2d/circle/Circle.d.ts +7 -5
- package/src/core/geom/2d/circle/Circle.d.ts.map +1 -1
- package/src/core/geom/2d/circle/Circle.js +7 -5
- package/src/core/geom/2d/circle/circle_area.d.ts +7 -0
- package/src/core/geom/2d/circle/circle_area.d.ts.map +1 -0
- package/src/core/geom/2d/circle/circle_area.js +8 -0
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +57 -23
- package/src/core/geom/Vector4.d.ts.map +1 -1
- package/src/core/geom/Vector4.js +27 -5
- package/src/core/math/gaussian.d.ts +5 -4
- package/src/core/math/gaussian.d.ts.map +1 -1
- package/src/core/math/gaussian.js +5 -4
- package/src/core/math/matrix/SquareMatrix.d.ts +55 -32
- package/src/core/math/matrix/SquareMatrix.d.ts.map +1 -1
- package/src/core/math/matrix/SquareMatrix.js +59 -33
- package/src/core/math/spline/spline_hermite3_to_bezier.d.ts +6 -5
- package/src/core/math/spline/spline_hermite3_to_bezier.d.ts.map +1 -1
- package/src/core/math/spline/spline_hermite3_to_bezier.js +15 -11
- package/src/core/model/ModuleRegistry.d.ts.map +1 -1
- package/src/core/model/ModuleRegistry.js +2 -2
- package/src/engine/EngineConfiguration.js +1 -1
- package/src/engine/ecs/Entity.d.ts.map +1 -1
- package/src/engine/ecs/Entity.js +44 -4
- package/src/engine/ecs/EntityBuilderUtils.js +1 -1
- package/src/engine/ecs/EntityComponentDataset.d.ts +1 -1
- package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +56 -17
- package/src/engine/ecs/EntityManager.d.ts.map +1 -1
- package/src/engine/ecs/EntityManager.js +16 -13
- package/src/engine/ecs/EntityObserver.d.ts.map +1 -1
- package/src/engine/ecs/EntityObserver.js +2 -10
- package/src/engine/ecs/EntityReference.d.ts +24 -2
- package/src/engine/ecs/EntityReference.d.ts.map +1 -1
- package/src/engine/ecs/EntityReference.js +42 -6
- package/src/engine/ecs/EventType.d.ts +10 -0
- package/src/engine/ecs/EventType.d.ts.map +1 -0
- package/src/engine/ecs/EventType.js +10 -0
- package/src/engine/ecs/System.d.ts.map +1 -1
- package/src/engine/ecs/System.js +1 -12
- package/src/engine/ecs/computeSystemName.d.ts +8 -0
- package/src/engine/ecs/computeSystemName.d.ts.map +1 -0
- package/src/engine/ecs/computeSystemName.js +10 -0
- package/src/engine/ecs/parent/ParentEntitySystem.js +1 -1
- package/src/engine/ecs/terrain/TerrainClouds.d.ts +43 -10
- package/src/engine/ecs/terrain/TerrainClouds.d.ts.map +1 -1
- package/src/engine/ecs/terrain/TerrainClouds.js +38 -2
- package/src/engine/ecs/terrain/ecs/Terrain.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/Terrain.js +6 -0
- package/src/engine/ecs/terrain/ecs/makeTerrainWorkerProxy.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/makeTerrainWorkerProxy.js +3 -1
- package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.js +7 -7
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts +349 -50
- package/src/engine/input/devices/InputDeviceSwitch.d.ts +4 -0
- package/src/engine/input/devices/InputDeviceSwitch.d.ts.map +1 -1
- package/src/engine/input/devices/InputDeviceSwitch.js +4 -2
- package/src/engine/input/devices/KeyCodes.d.ts.map +1 -1
- package/src/engine/input/devices/KeyCodes.js +1 -0
- package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
- package/src/engine/input/devices/KeyboardDevice.js +28 -3
- package/src/engine/intelligence/behavior/ecs/DieBehavior.d.ts +3 -0
- package/src/engine/intelligence/behavior/ecs/DieBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/DieBehavior.js +4 -0
- package/src/engine/intelligence/behavior/ecs/KillBehavior.d.ts +17 -0
- package/src/engine/intelligence/behavior/ecs/KillBehavior.d.ts.map +1 -0
- package/src/engine/intelligence/behavior/ecs/KillBehavior.js +47 -0
- package/src/engine/knowledge/database/StaticKnowledgeDataTable.d.ts.map +1 -1
- package/src/engine/knowledge/database/StaticKnowledgeDataTable.js +3 -0
- package/src/engine/ui/notification/NotificationManager.d.ts.map +1 -1
- package/src/engine/ui/notification/NotificationManager.js +2 -1
- package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.d.ts +7 -6
- package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.d.ts.map +1 -1
- package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.js +51 -43
- package/editor/actions/concrete/ModifyPatchSampler2DAction.d.ts +0 -48
- package/editor/actions/concrete/ModifyPatchTextureArray2DAction.d.ts.map +0 -1
- package/editor/actions/concrete/PaintTerrainOverlayAction.d.ts.map +0 -1
- package/editor/actions/concrete/PatchTerrainHeightAction.d.ts.map +0 -1
- package/editor/actions/concrete/SelectionAddAction.d.ts.map +0 -1
- package/editor/actions/concrete/SelectionClearAction.d.ts.map +0 -1
- package/editor/actions/concrete/SelectionRemoveAction.d.ts.map +0 -1
- package/editor/actions/concrete/TransformModifyAction.d.ts.map +0 -1
- package/editor/actions/concrete/WriteGridValueAction.d.ts.map +0 -1
- package/src/engine/ecs/read_entity_reference.d.ts +0 -9
- package/src/engine/ecs/read_entity_reference.d.ts.map +0 -1
- package/src/engine/ecs/read_entity_reference.js +0 -15
- package/src/engine/ecs/transform/Transform.editor.schema.json +0 -16
|
@@ -5,22 +5,12 @@ import { IllegalStateException } from "../../core/fsm/exceptions/IllegalStateExc
|
|
|
5
5
|
|
|
6
6
|
import { noop } from "../../core/function/noop.js";
|
|
7
7
|
import { ResourceAccessKind } from "../../core/model/ResourceAccessKind.js";
|
|
8
|
+
import { computeSystemName } from "./computeSystemName.js";
|
|
8
9
|
import { EntityObserver } from "./EntityObserver.js";
|
|
9
|
-
import {
|
|
10
|
+
import { System, SystemState } from "./System.js";
|
|
10
11
|
import { computeSystemComponentDependencyGraph } from "./system/computeSystemComponentDependencyGraph.js";
|
|
11
12
|
import { validateSystem } from "./validateSystem.js";
|
|
12
13
|
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @enum {string}
|
|
16
|
-
* @readonly
|
|
17
|
-
*/
|
|
18
|
-
export const EventType = {
|
|
19
|
-
EntityRemoved: "entityRemoved",
|
|
20
|
-
ComponentAdded: "componentAdded",
|
|
21
|
-
ComponentRemoved: "componentRemoved"
|
|
22
|
-
};
|
|
23
|
-
|
|
24
14
|
/**
|
|
25
15
|
* @readonly
|
|
26
16
|
* @enum {number}
|
|
@@ -34,6 +24,10 @@ export const EntityManagerState = {
|
|
|
34
24
|
Stopped: 5
|
|
35
25
|
};
|
|
36
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Brings together {@link System}s and an {@link EntityComponentDataset}
|
|
29
|
+
* Main entry point into the simulation process
|
|
30
|
+
*/
|
|
37
31
|
export class EntityManager {
|
|
38
32
|
|
|
39
33
|
/**
|
|
@@ -44,12 +38,14 @@ export class EntityManager {
|
|
|
44
38
|
|
|
45
39
|
/**
|
|
46
40
|
* @readonly
|
|
41
|
+
* @private
|
|
47
42
|
* @type {System[]}
|
|
48
43
|
*/
|
|
49
44
|
systemsExecutionOrder = [];
|
|
50
45
|
|
|
51
46
|
/**
|
|
52
47
|
* @readonly
|
|
48
|
+
* @private
|
|
53
49
|
* @type {EntityObserver[]}
|
|
54
50
|
*/
|
|
55
51
|
systemObservers = [];
|
|
@@ -74,6 +70,8 @@ export class EntityManager {
|
|
|
74
70
|
state = EntityManagerState.Initial;
|
|
75
71
|
|
|
76
72
|
/**
|
|
73
|
+
* Track remainders of simulation time for fixed step
|
|
74
|
+
* Needed for accurate time keeping
|
|
77
75
|
* @private
|
|
78
76
|
* @readonly
|
|
79
77
|
* @type {Map<System, number>}
|
|
@@ -102,7 +100,8 @@ export class EntityManager {
|
|
|
102
100
|
dataset = null;
|
|
103
101
|
|
|
104
102
|
/**
|
|
105
|
-
*
|
|
103
|
+
* Whenever a system is added or removed, optimal execution plan changes, this flag tells us to rebuild the current plan
|
|
104
|
+
* see {@link #systemsExecutionOrder}
|
|
106
105
|
* @type {boolean}
|
|
107
106
|
* @private
|
|
108
107
|
*/
|
|
@@ -744,6 +743,10 @@ export class EntityManager {
|
|
|
744
743
|
* @param {function} errorCallback
|
|
745
744
|
*/
|
|
746
745
|
shutdown(readyCallback, errorCallback) {
|
|
746
|
+
if(this.state !== EntityManagerState.Running){
|
|
747
|
+
throw new IllegalStateException(`System is wrong state, expected '${EntityManagerState.Running}'`);
|
|
748
|
+
}
|
|
749
|
+
|
|
747
750
|
this.state = EntityManagerState.Stopping;
|
|
748
751
|
|
|
749
752
|
if (this.dataset !== null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityObserver.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityObserver.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityObserver.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityObserver.js"],"names":[],"mappings":"AAGA;IAoBI;;;;;;;OAOG;IACH,0FAHW,GAAC,EA+CX;IAvED;;;OAGG;IACH,eAFU,MAAM,CAEa;IAE7B;;;;OAIG;IACH,uBAFU,MAAM,EAAE,CAES;IAE3B;;;OAGG;IACH,SAFU,sBAAsB,GAAC,IAAI,CAEtB;IA0BX;;OAEG;IACH,oBAFU,MAAM,CAE2B;IAE3C;;;OAGG;IACH,kBAFU,CAAS,IAAK,eAAC,CAEgB;IAEzC;;;OAGG;IACH,gBAFU,CAAS,IAAK,eAAC,CAEW;IAEpC;;;OAGG;IACH,sBAAoC;IAEpC;;;OAGG;IACH,SAFU,GAAC,CAEW;IAG1B;;;OAGG;IACH,qCAqBC;IAED;;;OAGG;IACH,iBAFW,sBAAsB,QAIhC;IAED,mBAGC;CACJ;uBAnHsB,6BAA6B"}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {Array} componentTypes
|
|
4
|
-
* @param {function(components:Array)} completedCallback "this" parameter will be set to entity ID
|
|
5
|
-
* @param {function(components:Array)} brokenCallback "this" parameter will be set to entity ID
|
|
6
|
-
* @constructor
|
|
7
|
-
* @class
|
|
8
|
-
*/
|
|
9
1
|
import { assert } from "../../core/assert.js";
|
|
10
2
|
import { BitSet } from "../../core/binary/BitSet.js";
|
|
11
3
|
|
|
@@ -32,8 +24,8 @@ export class EntityObserver {
|
|
|
32
24
|
/**
|
|
33
25
|
*
|
|
34
26
|
* @param {Array} componentTypes
|
|
35
|
-
* @param {function} completedCallback
|
|
36
|
-
* @param {function} brokenCallback
|
|
27
|
+
* @param {function(components:Array)} completedCallback
|
|
28
|
+
* @param {function(components:Array)} brokenCallback
|
|
37
29
|
* @param {*} [thisArg=undefined] will assume {@link this} value inside callbacks
|
|
38
30
|
* @constructor
|
|
39
31
|
*/
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Uniquely identifies an entity by both its ID and generation.
|
|
3
3
|
* Lets us distinguish between two entities with the same ID that were created at different times
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* // 1. Get your EntityComponentDataset to where you manager entities.
|
|
7
|
+
* const ecd = ... ; //EntityComponentDataset
|
|
8
|
+
*
|
|
9
|
+
* // 2. Create an entity (we'll get an ID). Or use an existing one.
|
|
10
|
+
* const entityId = ecd.createEntity(); // Let's say this returns ID 1, generation 0
|
|
11
|
+
*
|
|
12
|
+
* // 3. Create an EntityReference and bind it to the entity.
|
|
13
|
+
* const entityRef = EntityReference.bind(ecd, entityId);
|
|
14
|
+
*
|
|
15
|
+
* // 4. After you no longer need the entity - destroy the entity via reference.
|
|
16
|
+
* entityRef.destroy(ecd);
|
|
17
|
+
*
|
|
4
18
|
*/
|
|
5
19
|
export class EntityReference {
|
|
6
20
|
/**
|
|
@@ -10,6 +24,13 @@ export class EntityReference {
|
|
|
10
24
|
* @return {EntityReference}
|
|
11
25
|
*/
|
|
12
26
|
static from(id: number, generation: number): EntityReference;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param {EntityComponentDataset} ecd
|
|
30
|
+
* @param {number} id
|
|
31
|
+
* @returns {EntityReference}
|
|
32
|
+
*/
|
|
33
|
+
static bind(ecd: EntityComponentDataset, id: number): EntityReference;
|
|
13
34
|
/**
|
|
14
35
|
* Entity ID
|
|
15
36
|
* When entity is live - this is the entity ID inside associated `EntityComponentDataset`, when the entity is not live - it's set to -1
|
|
@@ -50,9 +71,10 @@ export class EntityReference {
|
|
|
50
71
|
*/
|
|
51
72
|
verify(ecd: EntityComponentDataset): boolean;
|
|
52
73
|
/**
|
|
53
|
-
*
|
|
74
|
+
* Destroys entity bound to this reference
|
|
75
|
+
* If the reference is invalid for the given dataset - does nothing
|
|
54
76
|
* @param {EntityComponentDataset} ecd
|
|
55
|
-
* @returns {boolean}
|
|
77
|
+
* @returns {boolean} true if entity was destroyed, false otherwise
|
|
56
78
|
*/
|
|
57
79
|
destroy(ecd: EntityComponentDataset): boolean;
|
|
58
80
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityReference.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityReference.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"EntityReference.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityReference.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH;IAqHI;;;;;OAKG;IACH,gBAJW,MAAM,cACN,MAAM,GACL,eAAe,CAQ1B;IAED;;;;;OAKG;IACH,iBAJW,sBAAsB,MACtB,MAAM,GACJ,eAAe,CAQ3B;IA7ID;;;;OAIG;IACH,IAFU,MAAM,CAET;IAEP;;;;OAIG;IACH,YAFU,MAAM,CAED;IAEf;;;OAGG;IACH,YAFW,eAAe,QAKzB;IAED;;;OAGG;IACH,SAFa,eAAe,CAQ3B;IAED;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,cAHW,eAAe,GACd,OAAO,CAMlB;IAED;;;;OAIG;IACH,YAHW,sBAAsB,GACpB,OAAO,CAYnB;IAED;;;;;OAKG;IACH,aAHW,sBAAsB,GACpB,OAAO,CASnB;IAED;;;;OAIG;IACH,UAHW,sBAAsB,UACtB,MAAM,QAShB;IAED;;;;OAIG;IACH,SAHW,MAAM,cACN,MAAM,QAUhB;IA+BL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;CAN1C;;cAWS,eAAe"}
|
|
@@ -3,6 +3,20 @@ import { assert } from "../../core/assert.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Uniquely identifies an entity by both its ID and generation.
|
|
5
5
|
* Lets us distinguish between two entities with the same ID that were created at different times
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // 1. Get your EntityComponentDataset to where you manager entities.
|
|
9
|
+
* const ecd = ... ; //EntityComponentDataset
|
|
10
|
+
*
|
|
11
|
+
* // 2. Create an entity (we'll get an ID). Or use an existing one.
|
|
12
|
+
* const entityId = ecd.createEntity(); // Let's say this returns ID 1, generation 0
|
|
13
|
+
*
|
|
14
|
+
* // 3. Create an EntityReference and bind it to the entity.
|
|
15
|
+
* const entityRef = EntityReference.bind(ecd, entityId);
|
|
16
|
+
*
|
|
17
|
+
* // 4. After you no longer need the entity - destroy the entity via reference.
|
|
18
|
+
* entityRef.destroy(ecd);
|
|
19
|
+
*
|
|
6
20
|
*/
|
|
7
21
|
export class EntityReference {
|
|
8
22
|
|
|
@@ -24,7 +38,7 @@ export class EntityReference {
|
|
|
24
38
|
*
|
|
25
39
|
* @param {EntityReference} other
|
|
26
40
|
*/
|
|
27
|
-
copy(other){
|
|
41
|
+
copy(other) {
|
|
28
42
|
this.id = other.id;
|
|
29
43
|
this.generation = other.generation;
|
|
30
44
|
}
|
|
@@ -33,7 +47,7 @@ export class EntityReference {
|
|
|
33
47
|
*
|
|
34
48
|
* @returns {EntityReference}
|
|
35
49
|
*/
|
|
36
|
-
clone(){
|
|
50
|
+
clone() {
|
|
37
51
|
const r = new EntityReference();
|
|
38
52
|
|
|
39
53
|
r.copy(this);
|
|
@@ -66,6 +80,10 @@ export class EntityReference {
|
|
|
66
80
|
* @returns {boolean}
|
|
67
81
|
*/
|
|
68
82
|
verify(ecd) {
|
|
83
|
+
if (this.id < 0) {
|
|
84
|
+
// special case
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
69
87
|
|
|
70
88
|
return ecd.entityExists(this.id)
|
|
71
89
|
&& this.generation === ecd.getEntityGeneration(this.id)
|
|
@@ -74,9 +92,10 @@ export class EntityReference {
|
|
|
74
92
|
}
|
|
75
93
|
|
|
76
94
|
/**
|
|
77
|
-
*
|
|
95
|
+
* Destroys entity bound to this reference
|
|
96
|
+
* If the reference is invalid for the given dataset - does nothing
|
|
78
97
|
* @param {EntityComponentDataset} ecd
|
|
79
|
-
* @returns {boolean}
|
|
98
|
+
* @returns {boolean} true if entity was destroyed, false otherwise
|
|
80
99
|
*/
|
|
81
100
|
destroy(ecd) {
|
|
82
101
|
if (this.verify(ecd)) {
|
|
@@ -92,7 +111,10 @@ export class EntityReference {
|
|
|
92
111
|
* @param {EntityComponentDataset} ecd
|
|
93
112
|
* @param {number} entity
|
|
94
113
|
*/
|
|
95
|
-
bind(ecd, entity){
|
|
114
|
+
bind(ecd, entity) {
|
|
115
|
+
assert.defined(ecd, 'ecd');
|
|
116
|
+
assert.equal(ecd.isEntityComponentDataset, true, 'ecd.isEntityComponentDataset !== true');
|
|
117
|
+
|
|
96
118
|
const generation = ecd.getEntityGeneration(entity);
|
|
97
119
|
|
|
98
120
|
this.from(entity, generation);
|
|
@@ -103,7 +125,7 @@ export class EntityReference {
|
|
|
103
125
|
* @param {number} id
|
|
104
126
|
* @param {number} generation
|
|
105
127
|
*/
|
|
106
|
-
from(id, generation){
|
|
128
|
+
from(id, generation) {
|
|
107
129
|
|
|
108
130
|
assert.isNonNegativeInteger(id, 'id');
|
|
109
131
|
assert.isNonNegativeInteger(generation, 'generation');
|
|
@@ -126,6 +148,20 @@ export class EntityReference {
|
|
|
126
148
|
|
|
127
149
|
return r;
|
|
128
150
|
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
*
|
|
154
|
+
* @param {EntityComponentDataset} ecd
|
|
155
|
+
* @param {number} id
|
|
156
|
+
* @returns {EntityReference}
|
|
157
|
+
*/
|
|
158
|
+
static bind(ecd, id) {
|
|
159
|
+
const r = new EntityReference();
|
|
160
|
+
|
|
161
|
+
r.bind(ecd, id);
|
|
162
|
+
|
|
163
|
+
return r;
|
|
164
|
+
}
|
|
129
165
|
}
|
|
130
166
|
|
|
131
167
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventType.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EventType.js"],"names":[],"mappings":";;;wBAEU,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/System.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/System.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH,oBAFa,CAAC;IAIV;;;OAGG;IACH,yBAFU,aAAa,CAEF;IAErB;;;OAGG;IACH,gBAFU,aAAa,CAAE,WAAW,CAAC,CAEU;IAE/C;;;OAGG;IACH,oBAAkB;IAElB;;;;;;;;OAQG;IACH,iBAFU,2BAA2B,EAAE,CAElB;IAGrB;;OAEG;IACH,mCAcC;IAED;;;;OAIG;IACH,sBAJa,CAAC,SACH,CAAC,GACA,MAAM,CA8BjB;IAED,0EAGC;IAED,2EAEC;IAED,wCAEC;IAED,0CAEC;IAIL;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,yBAA4B;IAG5B;;;OAGG;IACH,oBAAuB;CApBtB;;;;0BA2CS,MAAM;;;;;;;;0BAzJU,mCAAmC;qBADxC,6BAA6B"}
|
package/src/engine/ecs/System.js
CHANGED
|
@@ -8,7 +8,7 @@ import { ResourceAccessKind } from "../../core/model/ResourceAccessKind.js";
|
|
|
8
8
|
*
|
|
9
9
|
* @template C
|
|
10
10
|
*/
|
|
11
|
-
class System {
|
|
11
|
+
export class System {
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @protected
|
|
@@ -170,14 +170,3 @@ export const SystemState = {
|
|
|
170
170
|
*/
|
|
171
171
|
System.State = SystemState;
|
|
172
172
|
|
|
173
|
-
/**
|
|
174
|
-
*
|
|
175
|
-
* @param {System} system
|
|
176
|
-
* @returns {string}
|
|
177
|
-
*/
|
|
178
|
-
function computeSystemName(system) {
|
|
179
|
-
|
|
180
|
-
return system.constructor.name;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export { System, computeSystemName };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeSystemName.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/computeSystemName.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,0CAHW,MAAM,GACJ,MAAM,CAKlB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventType } from "../
|
|
1
|
+
import { EventType } from "../EventType.js";
|
|
2
2
|
import { AbstractContextSystem } from "../system/AbstractContextSystem.js";
|
|
3
3
|
import { SystemEntityContext } from "../system/SystemEntityContext.js";
|
|
4
4
|
import { ParentEntity } from "./ParentEntity.js";
|
|
@@ -27,21 +27,54 @@ declare class Clouds {
|
|
|
27
27
|
* @returns {boolean}
|
|
28
28
|
*/
|
|
29
29
|
get enabled(): boolean;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param {number} x
|
|
33
|
+
* @param {number} y
|
|
34
|
+
*/
|
|
35
|
+
setSpeed(x: number, y: number): void;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param {THREE.Material} mat
|
|
39
|
+
*/
|
|
40
|
+
writeOneCloudSpeed(mat: THREE.Material): void;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @param {THREE.Material} mat
|
|
44
|
+
*/
|
|
45
|
+
writeOneEnabled(mat: THREE.Material): void;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param {THREE.Material} mat
|
|
49
|
+
*/
|
|
50
|
+
writeOneTime(mat: THREE.Material): void;
|
|
34
51
|
writeAllTime(): void;
|
|
35
|
-
update(timeDelta: any): void;
|
|
36
|
-
writeOneCloudTextures(mat: any): void;
|
|
37
|
-
writeOneCloudUniforms(mat: any): void;
|
|
38
52
|
/**
|
|
39
53
|
*
|
|
40
|
-
* @param {
|
|
54
|
+
* @param {number} timeDelta
|
|
55
|
+
*/
|
|
56
|
+
update(timeDelta: number): void;
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @param {THREE.Material} mat
|
|
60
|
+
*/
|
|
61
|
+
writeOneCloudTextures(mat: THREE.Material): void;
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @param {THREE.Material} mat
|
|
65
|
+
*/
|
|
66
|
+
writeOneCloudUniforms(mat: THREE.Material): void;
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @param {THREE.Material} material
|
|
41
70
|
* @returns {boolean}
|
|
42
71
|
*/
|
|
43
|
-
removeMaterial(material: Material): boolean;
|
|
44
|
-
|
|
72
|
+
removeMaterial(material: THREE.Material): boolean;
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param {THREE.Material} material
|
|
76
|
+
*/
|
|
77
|
+
addMaterial(material: THREE.Material): void;
|
|
45
78
|
}
|
|
46
79
|
import Vector2 from '../../../core/geom/Vector2.js';
|
|
47
80
|
//# sourceMappingURL=TerrainClouds.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerrainClouds.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/terrain/TerrainClouds.js"],"names":[],"mappings":";AA6BA;IACI;;;;OAIG;IACH,kBAAkB;IAClB;;;;OAIG;IACH,kBAAe;IACf,aAAS;IAGT,kBAAyB;IACzB,kBAAyB;IACzB,kBAAyB;IAGzB,oBAAmB;IAMnB;;;OAGG;IACH,iBAFW,OAAO,EASjB;IAED;;;OAGG;IACH,eAFa,OAAO,CAInB;IAED
|
|
1
|
+
{"version":3,"file":"TerrainClouds.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/terrain/TerrainClouds.js"],"names":[],"mappings":";AA6BA;IACI;;;;OAIG;IACH,kBAAkB;IAClB;;;;OAIG;IACH,kBAAe;IACf,aAAS;IAGT,kBAAyB;IACzB,kBAAyB;IACzB,kBAAyB;IAGzB,oBAAmB;IAMnB;;;OAGG;IACH,iBAFW,OAAO,EASjB;IAED;;;OAGG;IACH,eAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,YAHW,MAAM,KACN,MAAM,QAQhB;IAED;;;OAGG;IACH,wBAFW,KAAK,CAAC,QAAQ,QAQxB;IAED;;;OAGG;IACH,qBAFW,KAAK,CAAC,QAAQ,QAKxB;IAED;;;OAGG;IACH,kBAFW,KAAK,CAAC,QAAQ,QAKxB;IAGD,qBAQC;IAED;;;OAGG;IACH,kBAFW,MAAM,QAKhB;IAED;;;OAGG;IACH,2BAFW,KAAK,CAAC,QAAQ,QAOxB;IAED;;;OAGG;IACH,2BAFW,KAAK,CAAC,QAAQ,QAaxB;IAED;;;;OAIG;IACH,yBAHW,KAAK,CAAC,QAAQ,GACZ,OAAO,CAWnB;IAED;;;OAGG;IACH,sBAFW,KAAK,CAAC,QAAQ,QAgBxB;CACJ;oBA1MmB,+BAA+B"}
|
|
@@ -75,6 +75,11 @@ class Clouds {
|
|
|
75
75
|
return this.__enabled;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* @param {number} x
|
|
81
|
+
* @param {number} y
|
|
82
|
+
*/
|
|
78
83
|
setSpeed(x, y) {
|
|
79
84
|
const variability = this.variability;
|
|
80
85
|
|
|
@@ -83,6 +88,10 @@ class Clouds {
|
|
|
83
88
|
this.__speed2.set(x * (1 + variability), y * (1 - variability));
|
|
84
89
|
}
|
|
85
90
|
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* @param {THREE.Material} mat
|
|
94
|
+
*/
|
|
86
95
|
writeOneCloudSpeed(mat) {
|
|
87
96
|
const uniforms = mat.uniforms;
|
|
88
97
|
|
|
@@ -91,11 +100,19 @@ class Clouds {
|
|
|
91
100
|
uniforms.v_CloudsSpeed_2.value.copy(this.__speed2);
|
|
92
101
|
}
|
|
93
102
|
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @param {THREE.Material} mat
|
|
106
|
+
*/
|
|
94
107
|
writeOneEnabled(mat) {
|
|
95
108
|
mat.defines.SHADOWMAP_CLOUDS = this.__enabled;
|
|
96
109
|
mat.needsUpdate = true;
|
|
97
110
|
}
|
|
98
111
|
|
|
112
|
+
/**
|
|
113
|
+
*
|
|
114
|
+
* @param {THREE.Material} mat
|
|
115
|
+
*/
|
|
99
116
|
writeOneTime(mat) {
|
|
100
117
|
const uniforms = mat.uniforms;
|
|
101
118
|
uniforms.f_CloudsTime.value = this.time;
|
|
@@ -112,11 +129,19 @@ class Clouds {
|
|
|
112
129
|
}
|
|
113
130
|
}
|
|
114
131
|
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
* @param {number} timeDelta
|
|
135
|
+
*/
|
|
115
136
|
update(timeDelta) {
|
|
116
137
|
this.time += timeDelta;
|
|
117
138
|
this.writeAllTime();
|
|
118
139
|
}
|
|
119
140
|
|
|
141
|
+
/**
|
|
142
|
+
*
|
|
143
|
+
* @param {THREE.Material} mat
|
|
144
|
+
*/
|
|
120
145
|
writeOneCloudTextures(mat) {
|
|
121
146
|
const uniforms = mat.uniforms;
|
|
122
147
|
uniforms.t_Clouds_0.value = loadCloudTexture("data/textures/noise/tile_256.png");
|
|
@@ -124,6 +149,10 @@ class Clouds {
|
|
|
124
149
|
uniforms.t_Clouds_2.value = loadCloudTexture("data/textures/noise/tile_256.png");
|
|
125
150
|
}
|
|
126
151
|
|
|
152
|
+
/**
|
|
153
|
+
*
|
|
154
|
+
* @param {THREE.Material} mat
|
|
155
|
+
*/
|
|
127
156
|
writeOneCloudUniforms(mat) {
|
|
128
157
|
|
|
129
158
|
const uniforms = mat.uniforms;
|
|
@@ -139,7 +168,7 @@ class Clouds {
|
|
|
139
168
|
|
|
140
169
|
/**
|
|
141
170
|
*
|
|
142
|
-
* @param {Material} material
|
|
171
|
+
* @param {THREE.Material} material
|
|
143
172
|
* @returns {boolean}
|
|
144
173
|
*/
|
|
145
174
|
removeMaterial(material) {
|
|
@@ -153,8 +182,15 @@ class Clouds {
|
|
|
153
182
|
return true;
|
|
154
183
|
}
|
|
155
184
|
|
|
185
|
+
/**
|
|
186
|
+
*
|
|
187
|
+
* @param {THREE.Material} material
|
|
188
|
+
*/
|
|
156
189
|
addMaterial(material) {
|
|
157
|
-
if (
|
|
190
|
+
if (
|
|
191
|
+
typeof material.defines === "object"
|
|
192
|
+
&& material.defines.hasOwnProperty("SHADOWMAP_CLOUDS")
|
|
193
|
+
) {
|
|
158
194
|
this.writeOneTime(material);
|
|
159
195
|
this.writeOneEnabled(material);
|
|
160
196
|
this.writeOneCloudTextures(material);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Terrain.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/ecs/Terrain.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Terrain.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/ecs/Terrain.js"],"names":[],"mappings":"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"}
|
|
@@ -34,6 +34,12 @@ import { TerrainFlags } from "./TerrainFlags.js";
|
|
|
34
34
|
|
|
35
35
|
let idCounter = 0;
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Terrain is split into equal sized square patches
|
|
39
|
+
* Dimensions of single patch in width and height
|
|
40
|
+
* NOTE: edges of the terrain will typically result in patches smaller than this, so this is upper bound
|
|
41
|
+
* @type {number}
|
|
42
|
+
*/
|
|
37
43
|
const TILE_SIZE = 7;
|
|
38
44
|
|
|
39
45
|
class Terrain {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeTerrainWorkerProxy.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/ecs/makeTerrainWorkerProxy.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,0CAFY,WAAW,
|
|
1
|
+
{"version":3,"file":"makeTerrainWorkerProxy.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/ecs/makeTerrainWorkerProxy.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,0CAFY,WAAW,CAkFtB"}
|
|
@@ -8,7 +8,9 @@ export function makeTerrainWorkerProxy() {
|
|
|
8
8
|
const workerBuilder = new WorkerBuilder();
|
|
9
9
|
workerBuilder.importScript('bundle-worker-terrain.js');
|
|
10
10
|
|
|
11
|
-
workerBuilder.addCode(
|
|
11
|
+
workerBuilder.addCode(
|
|
12
|
+
//language=JavaScript
|
|
13
|
+
`
|
|
12
14
|
function useSampler(callback) {
|
|
13
15
|
if (globalScope.samplerHeight !== undefined) {
|
|
14
16
|
callback(globalScope.samplerHeight);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RibbonPathBuilder.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.js"],"names":[],"mappings":"AAaA;IAEQ;;;OAGG;IACH,OAFU,eAAe,GAAC,IAAI,CAEb;IAEjB;;;OAGG;IACH,MAFU,IAAI,GAAC,IAAI,CAEH;IAEhB;;;OAGG;IACH,QAFU,aAAa,GAAC,IAAI,CAEV;IAGtB;;;OAGG;IACH,gBAFW,eAAe,QAIzB;IAED;;;OAGG;IACH,cAFW,IAAI,QAId;IAED;;;OAGG;IACH,kBAFW,aAAa,QAIvB;IAED;;;OAGG;IACH,mBAFW,MAAM,EAAE,QAsFlB;CAEJ;
|
|
1
|
+
{"version":3,"file":"RibbonPathBuilder.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.js"],"names":[],"mappings":"AAaA;IAEQ;;;OAGG;IACH,OAFU,eAAe,GAAC,IAAI,CAEb;IAEjB;;;OAGG;IACH,MAFU,IAAI,GAAC,IAAI,CAEH;IAEhB;;;OAGG;IACH,QAFU,aAAa,GAAC,IAAI,CAEV;IAGtB;;;OAGG;IACH,gBAFW,eAAe,QAIzB;IAED;;;OAGG;IACH,cAFW,IAAI,QAId;IAED;;;OAGG;IACH,kBAFW,aAAa,QAIvB;IAED;;;OAGG;IACH,mBAFW,MAAM,EAAE,QAsFlB;CAEJ;mBAnJkB,2BAA2B"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { RibbonX } from "../../../trail/x/RibbonX.js";
|
|
2
|
-
import {
|
|
3
|
-
RIBBON_ATTRIBUTE_ADDRESS_AGE,
|
|
4
|
-
RIBBON_ATTRIBUTE_ADDRESS_UV_OFFSET
|
|
5
|
-
} from "../../../trail/x/ribbon_attributes_spec.js";
|
|
6
1
|
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
2
|
+
import Entity from "../../../../ecs/Entity.js";
|
|
3
|
+
import { EventType } from "../../../../ecs/EventType.js";
|
|
7
4
|
import Renderable from "../../../../ecs/renderable/Renderable.js";
|
|
8
5
|
import { RenderableFlags } from "../../../../ecs/renderable/RenderableFlags.js";
|
|
9
6
|
import { Transform } from "../../../../ecs/transform/Transform.js";
|
|
10
|
-
import Entity from "../../../../ecs/Entity.js";
|
|
11
7
|
import ThreeFactory from "../../../three/ThreeFactory.js";
|
|
12
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
RIBBON_ATTRIBUTE_ADDRESS_AGE,
|
|
10
|
+
RIBBON_ATTRIBUTE_ADDRESS_UV_OFFSET
|
|
11
|
+
} from "../../../trail/x/ribbon_attributes_spec.js";
|
|
12
|
+
import { RibbonX } from "../../../trail/x/RibbonX.js";
|
|
13
13
|
|
|
14
14
|
export class RibbonPathBuilder {
|
|
15
15
|
constructor() {
|