export declare const sdefDeclaration = "\n#ifndef SDEFDECLARATION\n#define SDEFDECLARATION\n\n#if NUM_BONE_INFLUENCERS > 0 && defined(SDEF)\nattribute vec3 matricesSdefC;\nattribute vec3 matricesSdefR0;\nattribute vec3 matricesSdefR1;\n\nvec4 rotationMatrixToQuaternion(mat3 matrix) {\n    float trace = matrix[0][0] + matrix[1][1] + matrix[2][2];\n    float s;\n\n    float sqrtParam;\n    if (trace > 0.0) {\n        sqrtParam = trace + 1.0;\n    } else if (matrix[0][0] > matrix[1][1] && matrix[0][0] > matrix[2][2]) {\n        sqrtParam = 1.0 + matrix[0][0] - matrix[1][1] - matrix[2][2];\n    } else if (matrix[1][1] > matrix[2][2]) {\n        sqrtParam = 1.0 + matrix[1][1] - matrix[0][0] - matrix[2][2];\n    } else {\n        sqrtParam = 1.0 + matrix[2][2] - matrix[0][0] - matrix[1][1];\n    }\n    float sqrtValue = sqrt(sqrtParam);\n\n    if (trace > 0.0) {\n        s = 0.5 / sqrtValue;\n\n        return vec4(\n            (matrix[1][2] - matrix[2][1]) * s,\n            (matrix[2][0] - matrix[0][2]) * s,\n            (matrix[0][1] - matrix[1][0]) * s,\n            0.25 / s\n        );\n    } else if (matrix[0][0] > matrix[1][1] && matrix[0][0] > matrix[2][2]) {\n        s = 2.0 * sqrtValue;\n\n        return vec4(\n            0.25 * s,\n            (matrix[0][1] + matrix[1][0]) / s,\n            (matrix[2][0] + matrix[0][2]) / s,\n            (matrix[1][2] - matrix[2][1]) / s\n        );\n    } else if (matrix[1][1] > matrix[2][2]) {\n        s = 2.0 * sqrtValue;\n        \n        return vec4(\n            (matrix[0][1] + matrix[1][0]) / s,\n            0.25 * s,\n            (matrix[1][2] + matrix[2][1]) / s,\n            (matrix[2][0] - matrix[0][2]) / s\n        );\n    } else {\n        s = 2.0 * sqrtValue;\n\n        return vec4(\n            (matrix[2][0] + matrix[0][2]) / s,\n            (matrix[1][2] + matrix[2][1]) / s,\n            0.25 * s,\n            (matrix[0][1] - matrix[1][0]) / s\n        );\n    }\n}\n\nmat3 quaternionToRotationMatrix(vec4 q) {\n    float xx = q.x * q.x;\n    float yy = q.y * q.y;\n    float zz = q.z * q.z;\n    float xy = q.x * q.y;\n    float zw = q.z * q.w;\n    float zx = q.z * q.x;\n    float yw = q.y * q.w;\n    float yz = q.y * q.z;\n    float xw = q.x * q.w;\n\n    return mat3(\n        1.0 - 2.0 * (yy + zz), 2.0 * (xy + zw), 2.0 * (zx - yw),\n        2.0 * (xy - zw), 1.0 - 2.0 * (zz + xx), 2.0 * (yz + xw),\n        2.0 * (zx + yw), 2.0 * (yz - xw), 1.0 - 2.0 * (yy + xx)\n    );\n}\n\nvec4 slerp(vec4 q0, vec4 q1, float t) {\n    float cosTheta = dot(q0, q1);\n\n    // if (cosTheta < 0.0) {\n    //     q1 = -q1;\n    //     cosTheta = -cosTheta;\n    // }\n    q1 = mix(-q1, q1, step(0.0, cosTheta));\n    cosTheta = abs(cosTheta);\n    \n    if (cosTheta > 0.999999) {\n        return normalize(mix(q0, q1, t));\n    }\n\n    float theta = acos(cosTheta);\n    float sinTheta = sin(theta);\n\n    float w0 = sin((1.0 - t) * theta) / sinTheta;\n    float w1 = sin(t * theta) / sinTheta;\n\n    return q0 * w0 + q1 * w1;\n}\n#endif\n\n#endif\n";
