DirectX9(D3D)在重建网格生成之后“重新映射”SkinInfo

时间:2012-10-31 10:06:16

标签: c++ direct3d

我在生成渐进式蒙皮网格时已经停留了几天,我对优化没有任何问题,但是当顶点数量发生变化时,也会在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);

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

抱歉我的英语不好......

0 个答案:

没有答案