@needle-tools/three-mesh-effects 0.1.1 → 0.2.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/CHANGELOG.md +8 -0
- package/README.md +92 -9
- package/build/hull-effects.js +109 -7
- package/build/hull-effects.js.map +3 -3
- package/build/index.js +57 -0
- package/build/index.js.map +7 -0
- package/build/internal/rendering/hull-effect-metadata.js +136 -0
- package/build/internal/rendering/hull-effect-metadata.js.map +7 -0
- package/build/internal/rendering/hull-effect-runtime.js +5707 -0
- package/build/internal/rendering/hull-effect-runtime.js.map +7 -0
- package/build/internal/rendering/wrap-preview.js +9 -7
- package/build/internal/rendering/wrap-preview.js.map +2 -2
- package/build/types/public/hull-effects.d.ts +2 -0
- package/build/types/public/index.d.ts +23 -0
- package/build/types/public/index.js +1 -0
- package/build/types/rendering/hull-effect-metadata.d.ts +12 -0
- package/build/types/rendering/hull-effect-metadata.js +1 -0
- package/build/types/rendering/hull-effect-runtime.d.ts +39 -0
- package/build/types/rendering/hull-effect-runtime.js +1 -0
- package/build/types/rendering/wrap-preview.d.ts +2 -2
- package/package.json +8 -2
- package/src/public/hull-effects.js +3 -0
- package/src/public/index.js +73 -0
- package/src/rendering/hull-effect-metadata.js +27 -0
- package/src/rendering/hull-effect-runtime.js +89 -0
- package/src/rendering/wrap-preview.js +10 -8
|
@@ -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
|
|
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
|
|
5106
|
-
sourceCopy
|
|
5107
|
-
|
|
5108
|
-
|
|
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(
|
|
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)));
|