This commit is contained in:
Akko
2025-08-04 18:57:35 +02:00
parent 8cf6e78a79
commit 9495868c2e
5030 changed files with 518594 additions and 17609 deletions

View File

@@ -0,0 +1,31 @@
import { getLocalBounds } from '../../../scene/container/bounds/getLocalBounds.mjs';
import { boundsPool, matrixPool } from '../../../scene/container/bounds/utils/matrixAndBoundsPool.mjs';
import { warn } from '../../../utils/logging/warn.mjs';
"use strict";
function addMaskLocalBounds(mask, bounds, localRoot) {
const boundsToMask = boundsPool.get();
mask.measurable = true;
const tempMatrix = matrixPool.get().identity();
const relativeMask = getMatrixRelativeToParent(mask, localRoot, tempMatrix);
getLocalBounds(mask, boundsToMask, relativeMask);
mask.measurable = false;
bounds.addBoundsMask(boundsToMask);
matrixPool.return(tempMatrix);
boundsPool.return(boundsToMask);
}
function getMatrixRelativeToParent(target, root, matrix) {
if (!target) {
warn("Mask bounds, renderable is not inside the root container");
return matrix;
}
if (target !== root) {
getMatrixRelativeToParent(target.parent, root, matrix);
target.updateLocalTransform();
matrix.append(target.localTransform);
}
return matrix;
}
export { addMaskLocalBounds, getMatrixRelativeToParent };
//# sourceMappingURL=addMaskLocalBounds.mjs.map