UNPKG

playcanvas

Version:

PlayCanvas WebGL game engine

3 lines (2 loc) 761 B
declare const _default: "\nattribute float vertex_boneIndices;\n\nuniform highp sampler2D texture_poseMap;\n\nmat4 getBoneMatrix(const in float indexFloat) {\n\n int width = textureSize(texture_poseMap, 0).x;\n int index = int(indexFloat + 0.5) * 3;\n int iy = index / width;\n int ix = index % width;\n\n // read elements of 4x3 matrix\n vec4 v1 = texelFetch(texture_poseMap, ivec2(ix + 0, iy), 0);\n vec4 v2 = texelFetch(texture_poseMap, ivec2(ix + 1, iy), 0);\n vec4 v3 = texelFetch(texture_poseMap, ivec2(ix + 2, iy), 0);\n\n // transpose to 4x4 matrix\n return mat4(\n v1.x, v2.x, v3.x, 0,\n v1.y, v2.y, v3.y, 0,\n v1.z, v2.z, v3.z, 0,\n v1.w, v2.w, v3.w, 1\n );\n}\n"; export default _default;