[source lang = "cpp"]
for(DWORD i = 0; i < FaceNum; i ++ )
{
vArray[0] = pVertices[pIndices[i*3+0]].vPosition.x;
vArray[1] = pVertices[pIndices[i*3+0]].vPosition.y;
vArray[2] = pVertices[pIndices[i*3+0]].vPosition.z;
vArray[3] = pVertices[pIndices[i*3+1]].vPosition.x;
vArray[4] = pVertices[pIndices[i*3+1]].vPosition.y;
vArray[5] = pVertices[pIndices[i*3+1]].vPosition.z;
vArray[6] = pVertices[pIndices[i*3+2]].vPosition.x;
vArray[7] = pVertices[pIndices[i*3+2]].vPosition.y;
vArray[8] = pVertices[pIndices[i*3+2]].vPosition.z;
}
direct3d mesh and convex hulls and compound collision
hi all
i am triing to create an array of convex hulls to pass it to a compound collision
as i heard they work freakin awesome for concave shapes
but create convex hulls of what?
i think i should create a convex hull for every subset of my mesh
so how can i acces the vertex and vertex buffer of every subset one by one
i acces the whole vertex and index buffer like this
is it possible at all to acces the VB and IB of a specified subset????
please help
so what?
no answer
or i donot understand what is convex hull and compound collision?
ok guys could you please tell me?
no answer
or i donot understand what is convex hull and compound collision?
ok guys could you please tell me?
You need to access the attribute table of the mesh. Each attribute table entry contains the indices and vertices used by that subset (There's still only one VB and IB). Untested example code:
HRESULT foo(ID3DXBaseMesh* pMesh, DWORD dwSubset){ // Get attribute table size DWORD dwSize = 0; HRESULT hResult = pMesh->GetAttributeTable(NULL, &dwSize); if(FAILED(hResult)) return hResult; // Check subset ID if(dwSubset >= dwSize) return E_INVALIDPARAM; // Allocate and get attributes D3DXATTRIBUTERANGE* pAttr = new D3DXATTRIBUTERANGE[dwSize]; hResult = pMesh->GetAttributeTable(pAttr, &dwSize); if(FAILED(hResult)) { delete[] pAttr; return hResult; } // Get starting vertex and index for this subset DWORD dwVertexStart = pAttr[dwSubset].VertexStart; DWORD dwVertexCount = pAttr[dwSubset].VertexCount; DWORD dwIndexStart = pAttr[dwSubset].FaceStart*3; DWORD dwIndexCount = pAttr[dwSubset].FaceCount*3; // Cleanup delete[] pAttr; return D3D_OK;}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement