vendredi 8 août 2014

c ++ - DirectX9 (D3D) « Remapper » SkinInfo après la génération du maillage progressif - Stack Overflow


I'm stuck for some days on generating a progressive skinned mesh, I have no problem with optimisation, but when the number of vertices change, there position in the vertexBuffer too and I cant find a solution to update the SkinInfo with the new positions, I tried that :


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);

Someone knows any way to do it? I didn't found any information about it on internet, just some people saying thats done automaticly, but it doesn't work for me...


Sorry for my bad english...



I'm stuck for some days on generating a progressive skinned mesh, I have no problem with optimisation, but when the number of vertices change, there position in the vertexBuffer too and I cant find a solution to update the SkinInfo with the new positions, I tried that :


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);

Someone knows any way to do it? I didn't found any information about it on internet, just some people saying thats done automaticly, but it doesn't work for me...


Sorry for my bad english...


0 commentaires:

Enregistrer un commentaire