@woosh/meep-engine 2.119.94 → 2.119.96
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/model/node-graph/util/convert_node_graph_to_dot_string.d.ts +7 -0
- package/src/core/model/node-graph/util/convert_node_graph_to_dot_string.d.ts.map +1 -0
- package/src/core/model/node-graph/util/convert_node_graph_to_dot_string.js +67 -0
- package/src/engine/Engine.js +32 -20
- package/src/engine/EngineConfiguration.d.ts.map +1 -1
- package/src/engine/EngineConfiguration.js +6 -0
- package/src/engine/reference/v2/Reference.d.ts.map +1 -1
- package/src/engine/reference/v2/Reference.js +8 -1
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert_node_graph_to_dot_string.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/util/convert_node_graph_to_dot_string.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,4DAHW,SAAS,GACP,MAAM,CA6DlB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import LineBuilder from "../../../codegen/LineBuilder.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a Graphviz diagram from a node graph
|
|
5
|
+
* @param {NodeGraph} graph
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
export function convert_node_graph_to_dot_string({graph}){
|
|
9
|
+
// see https://stackoverflow.com/questions/7922960/block-diagram-layout-with-dot-graphviz
|
|
10
|
+
|
|
11
|
+
const lb = new LineBuilder();
|
|
12
|
+
|
|
13
|
+
lb.add('digraph G {');
|
|
14
|
+
lb.indent();
|
|
15
|
+
|
|
16
|
+
lb.add('graph [rankdir = LR];')
|
|
17
|
+
lb.add('node[shape=record];')
|
|
18
|
+
|
|
19
|
+
function nodeId(index) {
|
|
20
|
+
return `n${index}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param index
|
|
26
|
+
* @returns {string}
|
|
27
|
+
*/
|
|
28
|
+
function portId(index){
|
|
29
|
+
return `p${index}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param {NodeInstancePortReference[]} endpoints
|
|
35
|
+
* @returns {string}
|
|
36
|
+
*/
|
|
37
|
+
function portBlock(endpoints){
|
|
38
|
+
return `{${endpoints.map(e => `<${portId(e.port.id)}>${e.port.name}`).join("|")}}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// populate nodes
|
|
42
|
+
const nodes = graph.getNodes();
|
|
43
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
44
|
+
const node = nodes[i];
|
|
45
|
+
|
|
46
|
+
const inputs = portBlock(node.inEndpoints);
|
|
47
|
+
const outputs = portBlock(node.outEndpoints);
|
|
48
|
+
|
|
49
|
+
lb.add(`${nodeId(node.id)}[label="${inputs}|${node.desciption.name}/${node.id}|${outputs}"];`)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// populate connections
|
|
53
|
+
const connections = graph.getConnections();
|
|
54
|
+
for (let i = 0; i < connections.length; i++) {
|
|
55
|
+
const connection = connections[i];
|
|
56
|
+
|
|
57
|
+
const source = connection.source;
|
|
58
|
+
const target = connection.target;
|
|
59
|
+
lb.add(`${nodeId(source.instance.id)}:${portId(source.port.id)} -> ${nodeId(source.instance.id)}:${portId(source.port.id)};`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
lb.dedent();
|
|
63
|
+
lb.add('}');
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
return lb.build();
|
|
67
|
+
}
|
package/src/engine/Engine.js
CHANGED
|
@@ -48,6 +48,38 @@ class Engine {
|
|
|
48
48
|
|
|
49
49
|
viewStack = new ViewStack();
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* Static database
|
|
54
|
+
* Can contain tables of structured data that the application often works with.
|
|
55
|
+
* Engine startup will load all tables ensuring that data is ready once startup finishes
|
|
56
|
+
* Use sparingly, this is not suitable for very large amounts of data as all the data will be in memory and deserialization will stall engine startup
|
|
57
|
+
* Example: inventory item table, monster table
|
|
58
|
+
* @readonly
|
|
59
|
+
* @type {StaticKnowledgeDatabase}
|
|
60
|
+
*/
|
|
61
|
+
staticKnowledge = new StaticKnowledgeDatabase();
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @readonly
|
|
65
|
+
* @type {EnginePluginManager}
|
|
66
|
+
*/
|
|
67
|
+
plugins = new EnginePluginManager();
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Main simulation ticker
|
|
71
|
+
* @readonly
|
|
72
|
+
* @type {Ticker}
|
|
73
|
+
*/
|
|
74
|
+
ticker = new Ticker();
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Default executor, enables time-sharing concurrency
|
|
78
|
+
* @readonly
|
|
79
|
+
* @type {ConcurrentExecutor}
|
|
80
|
+
*/
|
|
81
|
+
executor = new ConcurrentExecutor(1, 10);
|
|
82
|
+
|
|
51
83
|
/**
|
|
52
84
|
*
|
|
53
85
|
* @param {EnginePlatform} platform
|
|
@@ -71,18 +103,8 @@ class Engine {
|
|
|
71
103
|
*/
|
|
72
104
|
this.platform = platform;
|
|
73
105
|
|
|
74
|
-
/**
|
|
75
|
-
*
|
|
76
|
-
* @type {StaticKnowledgeDatabase}
|
|
77
|
-
*/
|
|
78
|
-
this.staticKnowledge = new StaticKnowledgeDatabase();
|
|
79
106
|
this.staticKnowledge.validation_enabled = debug;
|
|
80
107
|
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
* @type {EnginePluginManager}
|
|
84
|
-
*/
|
|
85
|
-
this.plugins = new EnginePluginManager();
|
|
86
108
|
|
|
87
109
|
/**
|
|
88
110
|
*
|
|
@@ -90,11 +112,6 @@ class Engine {
|
|
|
90
112
|
*/
|
|
91
113
|
this.performance = new MetricCollection();
|
|
92
114
|
|
|
93
|
-
/**
|
|
94
|
-
*
|
|
95
|
-
* @type {ConcurrentExecutor}
|
|
96
|
-
*/
|
|
97
|
-
this.executor = new ConcurrentExecutor(1, 10);
|
|
98
115
|
|
|
99
116
|
this.__using_external_entity_manager = entityManager !== undefined;
|
|
100
117
|
|
|
@@ -106,11 +123,6 @@ class Engine {
|
|
|
106
123
|
this.entityManager = new EntityManager();
|
|
107
124
|
}
|
|
108
125
|
|
|
109
|
-
/**
|
|
110
|
-
*
|
|
111
|
-
* @type {Ticker}
|
|
112
|
-
*/
|
|
113
|
-
this.ticker = new Ticker();
|
|
114
126
|
|
|
115
127
|
/**
|
|
116
128
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineConfiguration.d.ts","sourceRoot":"","sources":["../../../src/engine/EngineConfiguration.js"],"names":[],"mappings":"AAGA;IAEI;;;OAGG;IACH,gBAAa;IAEb;;;OAGG;IACH,gBAAa;IAEb
|
|
1
|
+
{"version":3,"file":"EngineConfiguration.d.ts","sourceRoot":"","sources":["../../../src/engine/EngineConfiguration.js"],"names":[],"mappings":"AAGA;IAEI;;;OAGG;IACH,gBAAa;IAEb;;;OAGG;IACH,gBAAa;IAEb;;;;;;;;;OASG;IACH,2BAAe;IAEf;;;OAGG;IACH,SAFU,GAAG,CAAC,MAAM,EAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAElB;IAEpB;;;;OAIG;IACH,gBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,UAJa,CAAC,QACH,MAAM,UACN,WAAW,CAAC,CAAC,CAAC,WAUxB;IAED;;;;OAIG;IACH,aAJa,CAAC,QACH,MAAM,GACJ,WAAW,CAAC,CAAC,CAAC,CAU1B;IAED;;;;OAIG;IACH,kBAHW,KAAK,CAAC,YAAY,CAAC,GACjB,OAAO,CAQnB;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,OAAO,CAUnB;IAED;;OAEG;IACH,2BAFW,MAAM,QAOhB;IAED;;;;OAIG;IACH,oBAHW,kCAAkC,GAChC,OAAO,CASnB;IAED;;;OAGG;IACH,cAFW,MAAM,iBAqDhB;CACJ"}
|
|
@@ -16,7 +16,13 @@ export class EngineConfiguration {
|
|
|
16
16
|
plugins = [];
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
+
* Static database
|
|
20
|
+
* Can contain tables of structured data that the application often works with.
|
|
21
|
+
* Engine startup will load all tables ensuring that data is ready once startup finishes
|
|
22
|
+
* Use sparingly, this is not suitable for very large amounts of data as all the data will be in memory and deserialization will stall engine startup
|
|
23
|
+
* Example: inventory item table, monster table
|
|
19
24
|
* @private
|
|
25
|
+
* @readonly
|
|
20
26
|
* @type {StaticKnowledgeDataTableDescriptor[]}
|
|
21
27
|
*/
|
|
22
28
|
knowledge = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Reference.d.ts","sourceRoot":"","sources":["../../../../../src/engine/reference/v2/Reference.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"Reference.d.ts","sourceRoot":"","sources":["../../../../../src/engine/reference/v2/Reference.js"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,uBAFa,CAAC;IA0BV,qBAEC;IAED;;;OAGG;IACH,kBAFa,MAAM,CAAC,IAAI,EAAC,CAAC,CAAC,CAI1B;IAED;;;OAGG;IACH,YAFW,CAAC,QAcX;IAED;;;OAGG;IACH,YAFa,CAAC,CAIb;IAED;;;OAGG;IACH,gBAcC;;CACJ;;cAKS,QAAQ,gBAAW;;mBAlGV,uCAAuC"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import Signal from "../../../core/events/signal/Signal.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
+
* Value container, allows reference counting through {@link #onReleased} signal
|
|
5
|
+
* Intended for usage with reference-managing systems
|
|
6
|
+
* @example
|
|
7
|
+
* const ref: Reference<Texture> = texture_system.get(some_id);
|
|
8
|
+
* // do work with texture
|
|
9
|
+
* ref.release(); // we're done with the resource, texture_system will be notified
|
|
10
|
+
* // now ref.getValue() === null, reference is no longer valid
|
|
4
11
|
* @template T
|
|
5
12
|
*/
|
|
6
13
|
export class Reference {
|
|
@@ -21,7 +28,7 @@ export class Reference {
|
|
|
21
28
|
|
|
22
29
|
|
|
23
30
|
/**
|
|
24
|
-
*
|
|
31
|
+
* Whether a value is bound or not. Will be true if value is != null
|
|
25
32
|
* @type {boolean}
|
|
26
33
|
* @private
|
|
27
34
|
*/
|