2

我在生成渐进式蒙皮网格上停留了几天,我对优化没有任何问题,但是当顶点数量发生变化时,vertexBuffer 中也有位置,我找不到用新位置更新 SkinInfo 的解决方案,我试过了:

D3D::Mesh m;
meshData->pMesh->CloneMesh(D3DXMESH_MANAGED, Declaration, D3D::getDevice(), &m);
LPD3DXBUFFER vRemap=0;
D3D::checkError("Failed to optimise mesh",
    m->Optimize(D3DXMESH_MANAGED | D3DXMESHOPT_VERTEXCACHE | D3DXMESHOPT_ATTRSORT,
        newMeshContainer->pAdjacency,newMeshContainer->pAdjacency,
        0,&vRemap,&m));

if (pSkinInfo) {
    D3D::checkError("Failed to remap skin info",
        pSkinInfo->Remap( m->GetNumVertices(), 
        (DWORD*)vRemap->GetBufferPointer()));
}

D3DXCleanMesh(D3DXCLEAN_SIMPLIFICATION, m, newMeshContainer->pAdjacency, &m, newMeshContainer->pAdjacency, NULL);

D3D::ProgressiveMesh ProgMesh;
D3D::checkError("Failed to generate progressive mesh",
    D3DXGeneratePMesh(m, newMeshContainer->pAdjacency, 0, 0, 0, D3DXMESHSIMP_FACE, &ProgMesh));
ProgMesh->SetNumVertices(ProgMesh->GetMaxVertices());

ProgMesh->CloneMesh(D3DXMESH_MANAGED, 0, D3D::getDevice(), &newMeshContainer->MeshData.pMesh);

有人知道有什么办法吗?我在互联网上没有找到任何关于它的信息,只是有人说这是自动完成的,但它对我不起作用......

对不起,我的英语不好...

4

0 回答 0