1 for(int i=0; i<numBS; i++)
2 {
3 uint offset = bsPitch * bsOffsets.Load(i);
4 float weight = bsWeights.Load(i);
5 dp = bsVertices.Load(offset + 3*vertexID+0);
6 dn = bsVertices.Load(offset + 3*vertexID+1);
7 dt = bsVertices.Load(offset + 3*vertexID+2);
8
9 pos += dp * weight;
10 normal += dn * weight;
11 tangent += dt * weight;
12 }
13
Blend Shapes 放在一个固定的数组bsVertices中,
按照
S0V0, S0V1 ... S0VN, S1V0 ... SMVN
的形式存放.
numBS说明了有多少个BS被混合,也就是slots的大小;
bsPitch为SxV0 - SxVN的长度;
bsOffsets[i] 代表第i个slot使用了哪个BS.