I know this is d3d, but its general c++ errors im getting, so heres the full source, I tried using the
'typedef VERTEX* LPVERTEX;' on it, but I get:
Quote:
error C2664: 'ID3DXMesh::LockVertexBuffer' : cannot convert parameter 2 from 'BYTE **' to 'LPVOID *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
struct VERTEX //removed _VERTEX{ D3DXVECTOR3 pos; // vertex position D3DXVECTOR3 norm; // vertex normal float tu; // texture coordinates float tv;}; // removed VERTEX,*LPVERTEX;typedef VERTEX* LPVERTEX; //added#define FVF_VERTEX D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1LPD3DXMESH CreateMappedSphere(LPDIRECT3DDEVICE8 pDev,float fRad,UINT slices,UINT stacks){ // create the sphere LPD3DXMESH mesh; if (FAILED(D3DXCreateSphere(pDev,fRad,slices,stacks,&mesh,NULL))) return NULL; // create a copy of the mesh with texture coordinates, // since the D3DX function doesn't include them LPD3DXMESH texMesh; if (FAILED(mesh->CloneMeshFVF(D3DXMESH_SYSTEMMEM,FVF_VERTEX,pDev,&texMesh))) // failed, return un-textured mesh return mesh; // finished with the original mesh, release it mesh->Release(); // lock the vertex buffer LPVERTEX pVerts; if (SUCCEEDED(texMesh->LockVertexBuffer(0,(BYTE **) &pVerts))) { // get vertex count int numVerts=texMesh->GetNumVertices(); // loop through the vertices for (int i=0;i<numVerts;i++) { // calculate texture coordinates pVerts->tu=asinf(pVerts->norm.x)/D3DX_PI+0.5f; pVerts->tv=asinf(pVerts->norm.y)/D3DX_PI+0.5f; // go to next vertex pVerts++; } // unlock the vertex buffer texMesh->UnlockVertexBuffer(); } // return pointer to caller return texMesh;}
thx