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.