UNPKG

@three.ez/instanced-mesh

Version:

Enhanced InstancedMesh with frustum culling, fast raycasting (using BVH), sorting, visibility management and more.

30 lines (26 loc) 909 B
export default /* glsl */ ` #ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; #ifdef USE_INSTANCING_SKINNING uniform int bonesPerInstance; #endif mat4 getBoneMatrix( const in float i ) { int size = textureSize( boneTexture, 0 ).x; #ifdef USE_INSTANCING_SKINNING int j = ( bonesPerInstance * int( instanceIndex ) + int( i ) ) * 4; #else int j = int( i ) * 4; #endif int x = j % size; int y = j / size; vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } #endif `; //# sourceMappingURL=instanced_skinning_pars_vertex.glsl.js.map