mdx-m3-viewer
Version:
A browser WebGL model viewer. Mainly focused on models of the games Warcraft 3 and Starcraft 2.
3 lines (2 loc) • 857 B
TypeScript
declare const shader = "\nuniform sampler2D u_boneMap;\nuniform float u_vectorSize;\nuniform float u_rowSize;\n\nmat4 fetchMatrix(float column, float row) {\n column *= u_vectorSize * 4.0;\n row *= u_rowSize;\n // Add in half a texel, to sample in the middle of the texel.\n // Otherwise, since the sample is directly on the boundary, floating point errors can cause the sample to get the wrong pixel.\n // This is most noticeable with NPOT textures, which the bone maps are.\n column += 0.5 * u_vectorSize;\n row += 0.5 * u_rowSize;\n\n return mat4(texture2D(u_boneMap, vec2(column, row)),\n texture2D(u_boneMap, vec2(column + u_vectorSize, row)),\n texture2D(u_boneMap, vec2(column + u_vectorSize * 2.0, row)),\n texture2D(u_boneMap, vec2(column + u_vectorSize * 3.0, row)));\n}\n";
export default shader;