@woosh/meep-engine 2.160.0 → 2.161.0

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 CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Pure JavaScript game engine. Fully featured and production ready.",
7
7
  "type": "module",
8
8
  "author": "Alexander Goldring",
9
- "version": "2.160.0",
9
+ "version": "2.161.0",
10
10
  "main": "build/meep.module.js",
11
11
  "module": "build/meep.module.js",
12
12
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"make_cap.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/path/tube/build/make_cap.js"],"names":[],"mappings":"AAgNA;;;;;;;;;;;;;;GAcG;AACH,4DAbW,MAAM,gBACN,YAAY,GAAC,MAAM,EAAE,cACrB,OAAO,EAAE,gBACT,OAAO,EAAE,eAET,OAAO,EAAE,SACT,MAAM,EAAE,gBACR,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,mBACN,MAAM,EAAE,GAAC,YAAY,aACrB,MAAM,QACN,OAAO,QA6BjB;AAED;;;;;;GAMG;AACH,wDALW,MAAM,OACN;IAAC,aAAa,EAAC,MAAM,CAAC;IAAC,YAAY,EAAC,MAAM,CAAA;CAAC,mBAC3C,MAAM,QACN,OAAO,QAiBjB;wBAlRuB,OAAO;wBAMP,eAAe"}
1
+ {"version":3,"file":"make_cap.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/path/tube/build/make_cap.js"],"names":[],"mappings":"AAyOA;;;;;;;;;;;;;;GAcG;AACH,4DAbW,MAAM,gBACN,YAAY,GAAC,MAAM,EAAE,cACrB,OAAO,EAAE,gBACT,OAAO,EAAE,eAET,OAAO,EAAE,SACT,MAAM,EAAE,gBACR,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,mBACN,MAAM,EAAE,GAAC,YAAY,aACrB,MAAM,QACN,OAAO,QA6BjB;AAED;;;;;;GAMG;AACH,wDALW,MAAM,OACN;IAAC,aAAa,EAAC,MAAM,CAAC;IAAC,YAAY,EAAC,MAAM,CAAA;CAAC,mBAC3C,MAAM,QACN,OAAO,QAiBjB;wBA3SuB,OAAO;wBAMP,eAAe"}
@@ -138,6 +138,31 @@ function make_cap_round(
138
138
  }
139
139
 
140
140
  make_ring_faces(out, index_offset, cap_segment_count, shape_length);
141
+
142
+ // Correct the cap vertex normals. make_ring_vertices wrote the tube WALL
143
+ // normal (purely radial) for each cap ring, which shades the dome like a
144
+ // flat cylinder end. Every cap vertex lies on the sphere of radius `radius`
145
+ // centred at the cap base (Px, Py, Pz), so the true outward normal is just
146
+ // the direction from that centre to the vertex. This bends the normals from
147
+ // radial (at the base ring) to axial (at the pole), independent of the
148
+ // path frame's roll.
149
+ const cap_normals = out.normals;
150
+ const cap_positions = out.positions;
151
+ for (let v = index_offset; v < out.cursor_vertices; v++) {
152
+ const v3 = v * 3;
153
+
154
+ const nx = cap_positions[v3] - Px;
155
+ const ny = cap_positions[v3 + 1] - Py;
156
+ const nz = cap_positions[v3 + 2] - Pz;
157
+
158
+ const length = Math.sqrt(nx * nx + ny * ny + nz * nz);
159
+ if (length > 1e-8) {
160
+ const inv = 1 / length;
161
+ cap_normals[v3] = nx * inv;
162
+ cap_normals[v3 + 1] = ny * inv;
163
+ cap_normals[v3 + 2] = nz * inv;
164
+ }
165
+ }
141
166
  }
142
167
 
143
168
  const m3_zero = new Float32Array(9);