@woosh/meep-engine 2.47.39 → 2.47.41

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.
@@ -77946,13 +77946,6 @@ function rewriteMaterial(shader) {
77946
77946
 
77947
77947
  const newVertexShader = SHADER_PREAMBLE
77948
77948
  + originalVertexShader
77949
- // .replace(
77950
- // '#include <uv_vertex>',
77951
- // `
77952
- // mat4 instanceMatrix = getInstanceMatrix();
77953
- // #include <uv_vertex>
77954
- // `
77955
- // )
77956
77949
  .replace(
77957
77950
  '#include <begin_vertex>',
77958
77951
  `
@@ -77962,7 +77955,18 @@ function rewriteMaterial(shader) {
77962
77955
  .replace(
77963
77956
  '#include <beginnormal_vertex>',
77964
77957
  `
77965
- vec3 objectNormal = mat3( instanceMatrix ) * vec3( normal );
77958
+ vec3 objectNormal = vec3( normal );
77959
+ {
77960
+ // this is in lieu of a per-instance normal-matrix
77961
+ // shear transforms in the instance matrix are not supported
77962
+
77963
+ mat3 m = mat3( instanceMatrix );
77964
+
77965
+ objectNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
77966
+ objectNormal = m * objectNormal;
77967
+
77968
+ }
77969
+
77966
77970
  #ifdef USE_TANGENT
77967
77971
  vec3 objectTangent = vec3( tangent.xyz );
77968
77972
  #endif
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.47.39",
8
+ "version": "2.47.41",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -79,7 +79,7 @@ export function deserializeNodeGraphFromJSON({
79
79
  } else {
80
80
 
81
81
  if (!existing_node.equals(loaded_node)) {
82
- throw new Error(`Loaded node does not match the one in the registry`);
82
+ throw new Error(`Loaded node does not match the one in the registry. Loaded: ${loaded_node}, Existing: ${existing_node}`);
83
83
  }
84
84
 
85
85
  // re-use node from registry
@@ -339,6 +339,10 @@ export class NodeDescription {
339
339
  ;
340
340
  }
341
341
 
342
+ toString() {
343
+ return `NodeDescription[id=${this.id}, name='${this.name}']`;
344
+ }
345
+
342
346
  toJSON() {
343
347
  return {
344
348
  id: this.id,
@@ -11,13 +11,6 @@ export function rewriteMaterial(shader) {
11
11
 
12
12
  const newVertexShader = SHADER_PREAMBLE
13
13
  + originalVertexShader
14
- // .replace(
15
- // '#include <uv_vertex>',
16
- // `
17
- // mat4 instanceMatrix = getInstanceMatrix();
18
- // #include <uv_vertex>
19
- // `
20
- // )
21
14
  .replace(
22
15
  '#include <begin_vertex>',
23
16
  `
@@ -27,7 +20,18 @@ export function rewriteMaterial(shader) {
27
20
  .replace(
28
21
  '#include <beginnormal_vertex>',
29
22
  `
30
- vec3 objectNormal = mat3( instanceMatrix ) * vec3( normal );
23
+ vec3 objectNormal = vec3( normal );
24
+ {
25
+ // this is in lieu of a per-instance normal-matrix
26
+ // shear transforms in the instance matrix are not supported
27
+
28
+ mat3 m = mat3( instanceMatrix );
29
+
30
+ objectNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
31
+ objectNormal = m * objectNormal;
32
+
33
+ }
34
+
31
35
  #ifdef USE_TANGENT
32
36
  vec3 objectTangent = vec3( tangent.xyz );
33
37
  #endif