for (uint j = 0; j < mesh->mBones[i]->mNumWeights; j++) { uint VertexID = m_Entries[MeshIndex].BaseVertex + pMesh->mBones[i]->mWeights[j].mVertexId; float Weight = pMesh->mBones[i]->mWeights[j].mWeight; Bones[VertexID].AddBoneData(BoneIndex, Weight); }
时间: 2024-01-20 20:02:24 浏览: 32
这段代码中涉及到了一些自定义的数据类型,我们需要先了解这些数据类型的定义。在下面的代码示例中,我们假设Bones是一个自定义类型的数组,每个元素是一个自定义类型BoneData的对象。
```cpp
for (uint j = 0; j < mesh->mBones[i]->mNumWeights; j++) {
uint VertexID = m_Entries[MeshIndex].BaseVertex + pMesh->mBones[i]->mWeights[j].mVertexId;
float Weight = pMesh->mBones[i]->mWeights[j].mWeight;
Bones[VertexID].AddBoneData(BoneIndex, Weight);
}
```
在Qt中,您可以使用QVector来代替C++ STL库中的std::vector。QVector是Qt提供的一个动态数组,使用起来比std::vector更加方便。具体实现如下:
```cpp
for (uint j = 0; j < mesh->mBones[i]->mNumWeights; j++) {
uint VertexID = m_Entries[MeshIndex].BaseVertex + pMesh->mBones[i]->mWeights[j].mVertexId;
float Weight = pMesh->mBones[i]->mWeights[j].mWeight;
Bones[VertexID].addBoneData(BoneIndex, Weight);
}
```
这里使用了QVector<BoneData>类型的数组Bones,其中BoneData是自定义类型。在BoneData类中,您需要实现一个addBoneData函数,用于将骨骼索引和权重添加到BoneData对象中。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)