import { Scalar } from '@babylonjs/core/Maths/math.scalar';
export function copySizeTo(options) {
    // eslint-disable-next-line prefer-const
    let { src, dst, scale, epsilon } = { scale: 1, ...options };
    if ('getEngine' in src) {
        src = src.getEngine();
    }
    if ('getRenderWidth' in src) {
        src = {
            width: src.getRenderWidth(),
            height: src.getRenderHeight()
        };
    }
    const texCorrectWidth = Math.floor(src.width * scale);
    const texCorrectHeight = Math.floor(src.height * scale);
    const internalSize = dst.getSize();
    const texCurrentWidth = internalSize.width;
    const texCurrentHeight = internalSize.height;
    if (!Scalar.WithinEpsilon(texCurrentWidth, texCorrectWidth, epsilon) ||
        !Scalar.WithinEpsilon(texCurrentHeight, texCorrectHeight, epsilon)) {
        dst.resize({
            width: texCorrectWidth,
            height: texCorrectHeight
        });
    }
}
//# sourceMappingURL=CopySizeFunctions.js.map