UNPKG

mdx-m3-viewer

Version:

A browser WebGL model viewer. Mainly focused on models of the games Warcraft 3 and Starcraft 2.

24 lines (22 loc) 975 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const shader = ` uniform sampler2D u_boneMap; uniform float u_vectorSize; uniform float u_rowSize; mat4 fetchMatrix(float column, float row) { column *= u_vectorSize * 4.0; row *= u_rowSize; // Add in half a texel, to sample in the middle of the texel. // Otherwise, since the sample is directly on the boundary, floating point errors can cause the sample to get the wrong pixel. // This is most noticeable with NPOT textures, which the bone maps are. column += 0.5 * u_vectorSize; row += 0.5 * u_rowSize; return mat4(texture2D(u_boneMap, vec2(column, row)), texture2D(u_boneMap, vec2(column + u_vectorSize, row)), texture2D(u_boneMap, vec2(column + u_vectorSize * 2.0, row)), texture2D(u_boneMap, vec2(column + u_vectorSize * 3.0, row))); } `; exports.default = shader; //# sourceMappingURL=bonetexture.glsl.js.map