@needle-tools/three-mesh-effects 0.1.1 → 0.2.1

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.
@@ -5084,7 +5084,7 @@ function createHullEffect(asset, original, effect, options = {}) {
5084
5084
  const hazeNoiseEnabled = mode === "heat-haze" && values.strength > 0;
5085
5085
  const shroudCurlEnabled = mode === "shroud" && values.amplitude > 0;
5086
5086
  asset.updateWorldMatrix(true, true);
5087
- original.updateWorldMatrix(true, true);
5087
+ original?.updateWorldMatrix(true, true);
5088
5088
  const inverse = asset.matrixWorld.clone().invert();
5089
5089
  const shells = [];
5090
5090
  asset.traverse((object) => {
@@ -5102,12 +5102,14 @@ function createHullEffect(asset, original, effect, options = {}) {
5102
5102
  const center = uniform2(bounds.getCenter(new THREE3.Vector3()));
5103
5103
  const size = Math.max(bounds.getSize(new THREE3.Vector3()).length(), 1e-5);
5104
5104
  const normalized = positionLocal.sub(center).div(size);
5105
- const sourceCopy = cloneSkeleton(original);
5106
- sourceCopy.name = "Original inside wrap";
5107
- if (mode === "control") sourceCopy.visible = false;
5108
- sourceCopy.matrix.copy(inverse.clone().multiply(original.matrixWorld));
5105
+ const animationSource = original ?? asset;
5106
+ const sourceCopy = cloneSkeleton(animationSource);
5107
+ sourceCopy.name = original ? "Original inside wrap" : "Hull animation driver";
5108
+ if (!original || mode === "control") sourceCopy.visible = false;
5109
+ if (original) sourceCopy.matrix.copy(inverse.clone().multiply(original.matrixWorld));
5110
+ else sourceCopy.matrix.identity();
5109
5111
  sourceCopy.matrixAutoUpdate = false;
5110
- const skin = createWrapSkin(original, sourceCopy, asset, options.animate);
5112
+ const skin = createWrapSkin(animationSource, sourceCopy, asset, options.animate);
5111
5113
  const helpers = [];
5112
5114
  sourceCopy.traverse((object) => {
5113
5115
  if (object.userData.previewWireframeOverlay || object.userData.previewGaussianSplat || object.userData.wrapPreview) helpers.push(object);
@@ -5124,7 +5126,7 @@ function createHullEffect(asset, original, effect, options = {}) {
5124
5126
  };
5125
5127
  object.material = Array.isArray(object.material) ? object.material.map(cloneMaterial) : cloneMaterial(object.material);
5126
5128
  });
5127
- group.add(sourceCopy);
5129
+ if (original || skin) group.add(sourceCopy);
5128
5130
  const clock = time.mul(uniforms.speed ?? 1);
5129
5131
  const curl = (p) => {
5130
5132
  const q = p.sub(center).div(size).mul(mode === "force-field" || mode === "shroud" ? uniforms.detail : 4).add(vec32(0, clock.mul(0.3), clock.mul(0.2)));