@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
3 lines (2 loc) • 2.18 kB
JavaScript
import{aF as e,aG as t}from"./index-DFZFpUG-.esm.min.js";function n(e){let t="var influence: mat4x4<f32> = readMatrixFromRawSampler(boneSampler, f32(joints[0])) * weights[0];\ninfluence = influence + readMatrixFromRawSampler(boneSampler, f32(joints[1])) * weights[1];\ninfluence = influence + readMatrixFromRawSampler(boneSampler, f32(joints[2])) * weights[2];\ninfluence = influence + readMatrixFromRawSampler(boneSampler, f32(joints[3])) * weights[3];";return e&&(t+="\ninfluence = influence + readMatrixFromRawSampler(boneSampler, f32(joints1[0])) * weights1[0];\ninfluence = influence + readMatrixFromRawSampler(boneSampler, f32(joints1[1])) * weights1[1];\ninfluence = influence + readMatrixFromRawSampler(boneSampler, f32(joints1[2])) * weights1[2];\ninfluence = influence + readMatrixFromRawSampler(boneSampler, f32(joints1[3])) * weights1[3];"),`${t}\nfinalWorld = mesh.world * influence;`}function r(e){return{_id:"skeleton",_vertexAttributes:[{_name:"joints",_type:"vec4<u32>",_gpuFormat:"uint32x4",_arrayStride:16},{_name:"weights",_type:"vec4<f32>",_gpuFormat:"float32x4",_arrayStride:16},...e?[{_name:"joints1",_type:"vec4<u32>",_gpuFormat:"uint32x4",_arrayStride:16},{_name:"weights1",_type:"vec4<f32>",_gpuFormat:"float32x4",_arrayStride:16}]:[]],_vertexBindings:[{_name:"boneSampler",_type:{_kind:"texture",_textureType:"texture_2d<f32>",_sampleType:"unfilterable-float"},_visibility:1}],_vertexHelperFunctions:"\nfn readMatrixFromRawSampler(smp: texture_2d<f32>, index: f32) -> mat4x4<f32> {\nlet offset = i32(index) * 4;\nlet m0 = textureLoad(smp, vec2<i32>(offset + 0, 0), 0);\nlet m1 = textureLoad(smp, vec2<i32>(offset + 1, 0), 0);\nlet m2 = textureLoad(smp, vec2<i32>(offset + 2, 0), 0);\nlet m3 = textureLoad(smp, vec2<i32>(offset + 3, 0), 0);\nreturn mat4x4f(m0, m1, m2, m3);\n}\n",_vertexSlots:{VW:n(e)}}}const a={id:"skeleton",phase:"vertex",frag:n=>n._meshFeatures&e?r(0!==(n._meshFeatures&t)):null,bind(t,n,r){const a=t._mesh;return t._meshFeatures&e&&a?.skeleton?(n.push({binding:r++,resource:a.skeleton.boneTexture.createView()}),r):r}};export{r as createSkeletonFragment,a as pbrExt};
//# sourceMappingURL=skeleton-fragment-BxNS3Ej8.esm.min.js.map