three
Version:
JavaScript 3D library
39 lines (23 loc) • 913 B
JavaScript
export default /* glsl */`
uniform float morphTargetBaseInfluence;
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
uniform sampler2DArray morphTargetsTexture;
uniform vec2 morphTargetsTextureSize;
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
float texelIndex = float( vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset );
float y = floor( texelIndex / morphTargetsTextureSize.x );
float x = texelIndex - y * morphTargetsTextureSize.x;
vec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );
return texture( morphTargetsTexture, morphUV );
}
uniform float morphTargetInfluences[ 8 ];
uniform float morphTargetInfluences[ 4 ];
`;