(clip, time, nodes)
| 116 | } |
| 117 | |
| 118 | function sampleAnimation(clip, time, nodes) { |
| 119 | const nodeTransforms = new Map(); |
| 120 | for (const channel of clip.channels) { |
| 121 | const sampler = clip.samplers[channel.samplerIndex]; |
| 122 | if (!sampler) continue; |
| 123 | |
| 124 | const nodeIndex = channel.target.nodeIndex; |
| 125 | const path = channel.target.path; |
| 126 | const value = sampleSampler(sampler, time, path); |
| 127 | if (!value) continue; |
| 128 | |
| 129 | if (!nodeTransforms.has(nodeIndex)) { |
| 130 | nodeTransforms.set(nodeIndex, {}); |
| 131 | } |
| 132 | const t = nodeTransforms.get(nodeIndex); |
| 133 | if (path === 'translation') t.position = value; |
| 134 | else if (path === 'rotation') t.rotation = value; |
| 135 | else if (path === 'scale') t.scale = value; |
| 136 | } |
| 137 | return nodeTransforms; |
| 138 | } |
| 139 | |
| 140 | function calculateBoneMatrices(skeleton, nodes, animTransforms) { |
| 141 | const { joints } = skeleton; |
no test coverage detected