Sign in to follow this  

Content of ppAdjacency??

This topic is 4227 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

MSDN has a description that "Address of a pointer to an ID3DXBuffer interface. When this method returns, this parameter is filled with an array of three DWORDs per face that specify the three neighbors for each face in the mesh. But I can't figure it out...
LPD3DXBUFFER AdjacencyBuffer = NULL;
.....
.....
if(FAILED(D3DXLoadSkinMeshFromXof(pDXData, D3DXMESH_SYSTEMMEM,pD3DDevice, 
									   &AdjacencyBuffer,
                                       &MaterialBuffer, NULL,
                                       &NumMaterials, 
									   &pSkin,
                                       &pLoadMesh)))assert(0);
.....
.....
DWORD AdjSize = AdjacencyBuffer->GetBufferSize();
		if(AdjSize) {
			pMeshCon->pAdjacency = (DWORD*)new char[AdjSize];
			memcpy(pMeshCon->pAdjacency, AdjacencyBuffer->GetBufferPointer(), AdjSize);
		}

Now I don't know the way to retrieve the vertex indices that make up the faces. Any comments? Thanks anyway!

Share this post


Link to post
Share on other sites
the adjacency buffer contains a listing of which faces are adjacent to which other faces. Each face has (up to) 3 other faces which share an edge.

To get the actual data for each face, you'll need to lock the index buffer and get the indices from there. The first 3 indices are the vertices of face 0. The next 3 form face 0, etc. etc. You'll then need to lock the vertex buffer and get the actual vertex data per vertex, if you require it.

Hope this helps.

[EDIT] Almost forgot! The Adjacency buffer is made up of DWORDs, which are 4 bytes each. If you're gonna do a memcpy, you'd need to multiply the number of items by 4. Hope this helps.

Share this post


Link to post
Share on other sites
Thank you for the reply!

Quote:
Original post by sirob
the adjacency buffer contains a listing of which faces are adjacent to which other faces. Each face has (up to) 3 other faces which share an edge.

So adjacency buffer contains "faces' indices" !?
That sounds , well..not decently.

Quote:
Original post by sirob
To get the actual data for each face, you'll need to lock the index buffer and get the indices from there. The first 3 indices are the vertices of face 0. The next 3 form face 0, etc. etc. You'll then need to lock the vertex buffer and get the actual vertex data per vertex, if you require it.

Hope this helps.

I use "D3DXLoadSkinMeshFromXof" to parse a .X model.
and "pMesh->pSkinInfo->UpdateSkinnedMesh" to update it
and "pMesh->DrawSubset(i)" to render it.
There's no index buffer here.
Thus, should I use pMesh->GetIndexBuffer() and pMesh->GetVertexBuffer() to retrieve them?

Quote:
Original post by sirob
[EDIT] Almost forgot! The Adjacency buffer is made up of DWORDs, which are 4 bytes each. If you're gonna do a memcpy, you'd need to multiply the number of items by 4. Hope this helps.


That's ok, I had already correctly do the memcpy.

What I hope to know is the content of Adjacency Buffer.

Share this post


Link to post
Share on other sites

This topic is 4227 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this