@woosh/meep-engine 2.43.49 → 2.43.51
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/core/collection/list/List.js +15 -0
- package/core/model/node-graph/DataType.js +1 -1
- package/core/model/node-graph/NodeGraph.js +8 -0
- package/core/model/node-graph/NodeGraph.spec.js +19 -0
- package/engine/graphics/ecs/decal/v2/FPDecalSystem.js +14 -1
- package/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +2 -1
- package/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.js +1 -1
- package/package.json +1 -1
|
@@ -92,6 +92,21 @@ List.prototype.add = function (el) {
|
|
|
92
92
|
return this;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @param {T} el
|
|
98
|
+
* @return {boolean}
|
|
99
|
+
*/
|
|
100
|
+
List.prototype.addUnique = function (el) {
|
|
101
|
+
if (this.contains(el)) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
this.add(el);
|
|
106
|
+
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
|
|
95
110
|
/**
|
|
96
111
|
* Insert element at a specific position into the list
|
|
97
112
|
* @param {number} index
|
|
@@ -243,6 +243,10 @@ export class NodeGraph {
|
|
|
243
243
|
|
|
244
244
|
this.connections.add(connection);
|
|
245
245
|
|
|
246
|
+
// add connection links to the nodes
|
|
247
|
+
sourceNodeInstance.connections.addUnique(connection);
|
|
248
|
+
targetNodeInstance.connections.addUnique(connection);
|
|
249
|
+
|
|
246
250
|
return id;
|
|
247
251
|
}
|
|
248
252
|
|
|
@@ -261,6 +265,10 @@ export class NodeGraph {
|
|
|
261
265
|
|
|
262
266
|
this.connections.removeOneOf(connection);
|
|
263
267
|
|
|
268
|
+
// remove from end-point nodes
|
|
269
|
+
connection.source.instance.connections.removeOneOf(connection);
|
|
270
|
+
connection.target.instance.connections.removeOneOf(connection);
|
|
271
|
+
|
|
264
272
|
return true;
|
|
265
273
|
}
|
|
266
274
|
|
|
@@ -32,6 +32,25 @@ test("createConnection returns a number", () => {
|
|
|
32
32
|
expect(typeof g.createConnection(i0, pOut, i1, pInt)).toBe('number');
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
test("createConnection populates NodeInstance.connections", () => {
|
|
36
|
+
const node = new NodeDescription();
|
|
37
|
+
|
|
38
|
+
const dt = new DataType();
|
|
39
|
+
|
|
40
|
+
const pInt = node.createPort(dt, "in", PortDirection.In);
|
|
41
|
+
const pOut = node.createPort(dt, "out", PortDirection.Out);
|
|
42
|
+
|
|
43
|
+
const g = new NodeGraph();
|
|
44
|
+
|
|
45
|
+
const i0 = g.createNode(node);
|
|
46
|
+
const i1 = g.createNode(node);
|
|
47
|
+
|
|
48
|
+
g.createConnection(i0, pOut, i1, pInt);
|
|
49
|
+
|
|
50
|
+
expect(g.getNode(i0).connections.length).toBe(1);
|
|
51
|
+
expect(g.getNode(i1).connections.length).toBe(1);
|
|
52
|
+
});
|
|
53
|
+
|
|
35
54
|
test('getNode produces correct result', () => {
|
|
36
55
|
const graph = new NodeGraph();
|
|
37
56
|
|
|
@@ -10,6 +10,7 @@ import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
|
|
|
10
10
|
import { GameAssetType } from "../../../../asset/GameAssetType.js";
|
|
11
11
|
import { assert } from "../../../../../core/assert.js";
|
|
12
12
|
import { AsyncLoadingCache } from "../../../../../core/collection/map/AsyncLoadingCache.js";
|
|
13
|
+
import { copy_Sampler2D_channel_data } from "../../../texture/sampler/copy_Sampler2D_channel_data.js";
|
|
13
14
|
|
|
14
15
|
const placeholder_texture = Sampler2D.uint8(4, 1, 1);
|
|
15
16
|
placeholder_texture.data.fill(255);
|
|
@@ -167,7 +168,19 @@ export class FPDecalSystem extends AbstractContextSystem {
|
|
|
167
168
|
* @private
|
|
168
169
|
*/
|
|
169
170
|
this.__texture_cache = new AsyncLoadingCache(new Map(), (key) => {
|
|
170
|
-
return this.__assets.promise(key, GameAssetType.Image).then(asset =>
|
|
171
|
+
return this.__assets.promise(key, GameAssetType.Image).then(asset => {
|
|
172
|
+
const asset_sampler = asset.create();
|
|
173
|
+
|
|
174
|
+
if (asset_sampler.itemSize === 4) {
|
|
175
|
+
return asset_sampler;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const resampled = Sampler2D.uint8(4, asset_sampler.width, asset_sampler.height);
|
|
179
|
+
|
|
180
|
+
copy_Sampler2D_channel_data(asset_sampler, resampled);
|
|
181
|
+
|
|
182
|
+
return resampled;
|
|
183
|
+
});
|
|
171
184
|
});
|
|
172
185
|
|
|
173
186
|
/**
|
|
@@ -287,7 +287,8 @@ function makeNormalTestGridDecal(ecd, root_transform = new Transform()) {
|
|
|
287
287
|
|
|
288
288
|
const decal = new Decal();
|
|
289
289
|
|
|
290
|
-
decal.uri = decal_urls[1];
|
|
290
|
+
// decal.uri = decal_urls[1];
|
|
291
|
+
decal.uri ='moicon/ISO 7010 - Safety Signs (3)/ISO 7010 - Safety Signs/Emergency/400px/E001 – Emergency exit (left hand).png';
|
|
291
292
|
|
|
292
293
|
const entity = new EntityBuilder();
|
|
293
294
|
|
|
@@ -44,7 +44,7 @@ export function copy_Sampler2D_channel_data(source, destination) {
|
|
|
44
44
|
destination_data[i4 + 1] = source_data[i3 + 1];
|
|
45
45
|
destination_data[i4 + 2] = source_data[i3 + 2];
|
|
46
46
|
|
|
47
|
-
destination_data[i4] = 255; // fill alpha
|
|
47
|
+
destination_data[i4 + 3] = 255; // fill alpha
|
|
48
48
|
}
|
|
49
49
|
} else if (source_item_size === 2 && destination_item_size === 4) {
|
|
50
50
|
//RA -> RGBA
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"productName": "Meep",
|
|
6
6
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.43.
|
|
8
|
+
"version": "2.43.51",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|