@woosh/meep-engine 2.43.46 → 2.43.48
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/model/node-graph/NodeGraph.js +1 -1
- package/core/model/node-graph/NodeGraph.spec.js +16 -0
- package/engine/asset/loaders/image/png/prototypePNG.js +1 -1
- package/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +33 -10
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +8 -8
- package/package.json +1 -1
|
@@ -31,3 +31,19 @@ test("createConnection returns a number", () => {
|
|
|
31
31
|
|
|
32
32
|
expect(typeof g.createConnection(i0, pOut, i1, pInt)).toBe('number');
|
|
33
33
|
});
|
|
34
|
+
|
|
35
|
+
test('getNode produces correct result', () => {
|
|
36
|
+
const graph = new NodeGraph();
|
|
37
|
+
|
|
38
|
+
//
|
|
39
|
+
expect(graph.getNode(0)).toBe(undefined);
|
|
40
|
+
|
|
41
|
+
const d = new NodeDescription();
|
|
42
|
+
|
|
43
|
+
const node_id = graph.createNode(d);
|
|
44
|
+
|
|
45
|
+
const node_instance = graph.getNode(node_id);
|
|
46
|
+
|
|
47
|
+
expect(node_instance).toBeDefined();
|
|
48
|
+
expect(node_instance.id).toBe(node_id);
|
|
49
|
+
});
|
|
@@ -7,7 +7,7 @@ const array_loader = new ArrayBufferLoader();
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
array_loader.load('moicon/
|
|
10
|
+
array_loader.load('moicon/ISO 7010 - Safety Signs (3)/ISO 7010 - Safety Signs/Emergency/400px/E001 – Emergency exit (left hand).png',(asset)=>{
|
|
11
11
|
|
|
12
12
|
const array = asset.create();
|
|
13
13
|
|
|
@@ -26,6 +26,7 @@ import { DrawMode } from "../../mesh-v2/DrawMode.js";
|
|
|
26
26
|
import { OctahedralUvEncoder } from "../../../impostors/octahedral/grid/OctahedralUvEncoder.js";
|
|
27
27
|
import { makeSolidArrowGeometry } from "../../../../../editor/process/symbolic/makeSolidArrowGeometry.js";
|
|
28
28
|
import { vec3 } from "gl-matrix";
|
|
29
|
+
import Quaternion from "../../../../../core/geom/Quaternion.js";
|
|
29
30
|
|
|
30
31
|
const decal_urls = `data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_13_t.png
|
|
31
32
|
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_01_t.png
|
|
@@ -266,10 +267,7 @@ function grid(ecd, offset_x, offset_y, x, y, size_x, size_y, spacing, textures)
|
|
|
266
267
|
|
|
267
268
|
}
|
|
268
269
|
|
|
269
|
-
function makeNormalTestGridDecal(ecd) {
|
|
270
|
-
|
|
271
|
-
const GRID_OFFSET = new Vector3(5, 0, 5);
|
|
272
|
-
|
|
270
|
+
function makeNormalTestGridDecal(ecd, root_transform = new Transform()) {
|
|
273
271
|
const uv = new OctahedralUvEncoder();
|
|
274
272
|
|
|
275
273
|
const GRID_SIZE = 9;
|
|
@@ -285,7 +283,7 @@ function makeNormalTestGridDecal(ecd) {
|
|
|
285
283
|
|
|
286
284
|
uv.uv_to_unit(direction, [i / (GRID_SIZE - 1), j / (GRID_SIZE - 1)]);
|
|
287
285
|
|
|
288
|
-
vec3.negate(direction,direction);
|
|
286
|
+
vec3.negate(direction, direction);
|
|
289
287
|
|
|
290
288
|
const decal = new Decal();
|
|
291
289
|
|
|
@@ -298,14 +296,14 @@ function makeNormalTestGridDecal(ecd) {
|
|
|
298
296
|
const transform = new Transform();
|
|
299
297
|
transform.position.set(
|
|
300
298
|
SPACING * i,
|
|
299
|
+
SPACING * j,
|
|
301
300
|
0,
|
|
302
|
-
SPACING * j
|
|
303
301
|
);
|
|
302
|
+
transform.scale.setScalar(1);
|
|
303
|
+
transform.rotation._lookRotation(direction[0],direction[2], direction[1] , 0, 1, 0);
|
|
304
304
|
|
|
305
|
-
transform.
|
|
305
|
+
transform.multiplyTransforms(root_transform, transform);
|
|
306
306
|
|
|
307
|
-
transform.scale.setScalar(1);
|
|
308
|
-
transform.rotation._lookRotation(direction[0], direction[1], direction[2], 0, 1, 0);
|
|
309
307
|
|
|
310
308
|
entity
|
|
311
309
|
.add(ShadedGeometry.from(DEBUG_BOX, new LineBasicMaterial(), DrawMode.LineSegments))
|
|
@@ -422,7 +420,32 @@ async function main(engine) {
|
|
|
422
420
|
|
|
423
421
|
const task = countTask(0, ENTITY_COUNT, makeOne);
|
|
424
422
|
|
|
425
|
-
|
|
423
|
+
const q_down = new Quaternion();
|
|
424
|
+
q_down.lookRotation(Vector3.down)
|
|
425
|
+
|
|
426
|
+
makeNormalTestGridDecal(ecd, Transform.fromJSON({
|
|
427
|
+
position: new Vector3(5, 0, 5),
|
|
428
|
+
rotation: q_down
|
|
429
|
+
}));
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
const q_forward = new Quaternion();
|
|
433
|
+
q_forward.lookRotation(Vector3.forward)
|
|
434
|
+
|
|
435
|
+
const t_forward_grid = Transform.fromJSON({
|
|
436
|
+
position: new Vector3(5, 4, 5),
|
|
437
|
+
rotation: q_forward
|
|
438
|
+
});
|
|
439
|
+
makeNormalTestGridDecal(ecd, t_forward_grid);
|
|
440
|
+
|
|
441
|
+
new EntityBuilder()
|
|
442
|
+
.add(SGMesh.fromURL('data/models/snaps/cube_white.gltf'))
|
|
443
|
+
.add(Transform.fromJSON({
|
|
444
|
+
position:new Vector3(14,1,4.8),
|
|
445
|
+
rotation: t_forward_grid.rotation,
|
|
446
|
+
scale: new Vector3(25,25,0.1)
|
|
447
|
+
}))
|
|
448
|
+
.build(ecd);
|
|
426
449
|
|
|
427
450
|
// TaskLoadingScreen.instance.load(engine, task);
|
|
428
451
|
|
|
@@ -61,18 +61,18 @@ export const FP_SHADER_CHUNK_ACCUMULATION = `
|
|
|
61
61
|
vec4 light_data_4 = texelFetch(fp_t_light_data, address_to_data_texture_coordinates(light_address+4u), 0);
|
|
62
62
|
|
|
63
63
|
// compute normal of the decal, we get this by extracting rotation matrix and transforming (0,1,0) vector using that
|
|
64
|
-
|
|
65
|
-
mat4 decal_view_transform = viewMatrix*decal_transform_matrix;
|
|
66
|
-
|
|
67
64
|
vec3 decal_normal = normalize(vec3(
|
|
68
|
-
|
|
69
|
-
));
|
|
70
|
-
|
|
71
|
-
float decal_surface_dot = dot(decal_normal, geometry.normal);
|
|
65
|
+
decal_transform_matrix[0][2], decal_transform_matrix[1][2], decal_transform_matrix[2][2]
|
|
66
|
+
));
|
|
72
67
|
|
|
68
|
+
// Get geometry normal in world-space
|
|
69
|
+
vec3 g_normal = normalize( ( transpose(viewMatrix) * vec4( geometry.normal, 0.0 ) ).xyz );
|
|
70
|
+
|
|
71
|
+
float decal_surface_dot = dot(decal_normal, g_normal);
|
|
72
|
+
|
|
73
73
|
// we fade out decals when the projection angle to the surface gets too steep
|
|
74
74
|
// 0.7 is cos(45deg) and 0.5 is cos(60deg), dot returns cos of angle between two normals
|
|
75
|
-
float decal_surface_angle_fade = smoothstep(0.
|
|
75
|
+
float decal_surface_angle_fade = smoothstep(-0.5,-0.7,decal_surface_dot);
|
|
76
76
|
|
|
77
77
|
if(decal_surface_angle_fade <= 0.0){
|
|
78
78
|
continue;
|
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.48",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|