@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.
package/build/meep.cjs CHANGED
@@ -77948,13 +77948,6 @@ function rewriteMaterial(shader) {
77948
77948
 
77949
77949
  const newVertexShader = SHADER_PREAMBLE
77950
77950
  + originalVertexShader
77951
- // .replace(
77952
- // '#include <uv_vertex>',
77953
- // `
77954
- // mat4 instanceMatrix = getInstanceMatrix();
77955
- // #include <uv_vertex>
77956
- // `
77957
- // )
77958
77951
  .replace(
77959
77952
  '#include <begin_vertex>',
77960
77953
  `
@@ -77964,7 +77957,18 @@ function rewriteMaterial(shader) {
77964
77957
  .replace(
77965
77958
  '#include <beginnormal_vertex>',
77966
77959
  `
77967
- vec3 objectNormal = mat3( instanceMatrix ) * vec3( normal );
77960
+ vec3 objectNormal = vec3( normal );
77961
+ {
77962
+ // this is in lieu of a per-instance normal-matrix
77963
+ // shear transforms in the instance matrix are not supported
77964
+
77965
+ mat3 m = mat3( instanceMatrix );
77966
+
77967
+ objectNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
77968
+ objectNormal = m * objectNormal;
77969
+
77970
+ }
77971
+
77968
77972
  #ifdef USE_TANGENT
77969
77973
  vec3 objectTangent = vec3( tangent.xyz );
77970
77974
  #endif