@woosh/meep-engine 2.126.66 → 2.126.67

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
@@ -5,7 +5,7 @@
5
5
  "description": "Pure JavaScript game engine. Fully featured and production ready.",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.126.66",
8
+ "version": "2.126.67",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"spline3_hermite_nearest_point.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/spline/spline3_hermite_nearest_point.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;;;GAYG;AACH,qDARW,MAAM,SACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAuFlB"}
1
+ {"version":3,"file":"spline3_hermite_nearest_point.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/spline/spline3_hermite_nearest_point.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;;;GAYG;AACH,qDARW,MAAM,SACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAyFlB"}
@@ -90,6 +90,8 @@ export function spline3_hermite_nearest_point(
90
90
  for (let j = NEWTON_STEPS; j > 0; j--) {
91
91
 
92
92
  const f_t = polyval(quintic_coeffs, t, 6);
93
+
94
+ // derivative of the polynomial we are finding the root of
93
95
  const fp_t = polyval(quartic_coeffs, t, 5);
94
96
 
95
97
  if (Math.abs(fp_t) < tolerance) {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Rebuild skinned mesh as a regular mesh applying skinning in the process
3
+ * @param {SkinnedMesh} skinned
4
+ * @returns {Mesh}
5
+ */
6
+ export function meshFromSkinnedMesh(skinned: SkinnedMesh): Mesh;
7
+ import { Mesh } from "three";
8
+ //# sourceMappingURL=meshFromSkinnedMesh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshFromSkinnedMesh.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/skining/meshFromSkinnedMesh.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,2DAFa,IAAI,CAgChB;qBAtCoB,OAAO"}
@@ -0,0 +1,39 @@
1
+ import { Mesh } from "three";
2
+ import { computeSkinnedMeshVertices } from "./computeSkinnedMeshVertices.js";
3
+
4
+ /**
5
+ * Rebuild skinned mesh as a regular mesh applying skinning in the process
6
+ * @param {SkinnedMesh} skinned
7
+ * @returns {Mesh}
8
+ */
9
+ export function meshFromSkinnedMesh(skinned) {
10
+
11
+ const geometry = skinned.geometry;
12
+
13
+ const bakedGeometry = geometry.clone();
14
+
15
+ delete bakedGeometry.attributes.skinIndex;
16
+ delete bakedGeometry.attributes.skinWeight;
17
+
18
+ const positionAttribute = bakedGeometry.getAttribute("position");
19
+ const vertices = positionAttribute.array;
20
+
21
+ computeSkinnedMeshVertices(vertices, skinned);
22
+
23
+ const mesh = new Mesh(bakedGeometry, skinned.material);
24
+
25
+ mesh.position.copy(skinned.position);
26
+ mesh.rotation.copy(skinned.rotation);
27
+ mesh.scale.copy(skinned.scale);
28
+
29
+ //apply transform to each vertex
30
+ skinned.updateMatrix();
31
+ skinned.updateMatrixWorld(true);
32
+
33
+ const m4 = skinned.matrixWorld.clone();
34
+ m4.invert();
35
+
36
+ positionAttribute.applyMatrix4(m4);
37
+
38
+ return mesh;
39
+ }