/**
 * Returns a Ready Player Me avatar
 * @example
 * ```
 const rpmAvatar = getExternalAvatar({
    avatar: {
      glb: 'https://models.readyplayer.me/6401fc12ce7f75d51cdb2888.glb',
      skg: 'SKG_RPM_MALE',
      asg: 'skg_rpm_male',
    },
    emot: animations.an_default_emote_applaud,
    p: [0, 0, 5],
    r: [0, 180, 0],
  });
 */
export const getExternalAvatar = (options) => {
    const { avatar, emot, speed = 1, name, p, s = 1, r } = options ?? {};
    let url = avatar.glb;
    if (url.indexOf('meshLod=0&textureAtlas=0') === -1) {
        url = `${url}?meshLod=1&textureAtlas=512`;
    }
    const skinnedAnimation = emot?.id && {
        animationID: emot?.id,
        animationSpeed: speed,
        skeletonGroupID: avatar?.asg,
    };
    const node = {
        rendering: {
            meshID: url,
            materialID: url,
        },
        externalGlbDependency: {
            url,
            skeleton: avatar.skg,
        },
        name,
        skinnedAnimation,
        transform: {
            pos: p,
            scale: s,
            rot: r,
        },
    };
    return node;
};
//# sourceMappingURL=getExternalAvatar.js.map