|
|
我是用D3DXCreateMeshFVF 创建的
然后加入顶点数据和索引
调试的时候我已经检查过顶点数据都很合理
索引也很合理
但是为什么我最后就这看到一个三角形呢~
请前辈指点下
------------------------------
if (D3D_OK != D3DXCreateMeshFVF(m_pModelView[0].nTris/3, m_pModelView[0].nIndex, D3DXMESH_DYNAMIC, CUSVERTEXFVF_MODEL,m_pD3DDevice,&m_pD3DMesh))
{
return false;
}
if (m_pD3DMesh == NULL)
{
return false;
}
m_pD3DMesh->LockVertexBuffer(D3DLOCK_DISCARD, (VOID**)&m_pModel);
for (int i=0; i<(int)m_pModelHeader->nVertices; i++)
{
m_pModel = MODEL(m_pModelVertex[m_pVetex].pos, m_pModelVertex[m_pVetex].normal, m_pModelVertex[m_pVetex].texcoords);
}
m_pD3DMesh->UnlockVertexBuffer();
VOID* pIndices;
m_pD3DMesh->LockIndexBuffer(D3DLOCK_DISCARD,(VOID**)&pIndices);
memcpy(pIndices, m_pIndices, sizeof(m_pIndices));
m_pD3DMesh->UnlockIndexBuffer();
后面直接
m_pD3DMesh->DrawSubset(0);咯 [em4] [em4] [em4] |
|