Jump to content
  • Advertisement
Sign in to follow this  
Quaid Tseng

Content of ppAdjacency??

This topic is 4445 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!