Module: wine Branch: master Commit: 417534fdb7e955c8c6d670de3b3c4179ebc65a1d URL: http://source.winehq.org/git/wine.git/?a=commit;h=417534fdb7e955c8c6d670de3b...
Author: Dylan Smith dylan.ah.smith@gmail.com Date: Wed Apr 27 18:12:20 2011 -0400
d3dx9: Implement ID3DXMesh::DrawSubset.
---
dlls/d3dx9_36/mesh.c | 37 +++++++++++++++++++++++++++++++++++-- 1 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c index e67dffa..201b2b3 100644 --- a/dlls/d3dx9_36/mesh.c +++ b/dlls/d3dx9_36/mesh.c @@ -113,10 +113,43 @@ static ULONG WINAPI ID3DXMeshImpl_Release(ID3DXMesh *iface) static HRESULT WINAPI ID3DXMeshImpl_DrawSubset(ID3DXMesh *iface, DWORD attrib_id) { ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + HRESULT hr; + DWORD face_start; + DWORD face_end = 0; + DWORD vertex_size;
- FIXME("(%p)->(%u): stub\n", This, attrib_id); + TRACE("(%p)->(%u)\n", This, attrib_id);
- return E_NOTIMPL; + vertex_size = iface->lpVtbl->GetNumBytesPerVertex(iface); + + hr = IDirect3DDevice9_SetVertexDeclaration(This->device, This->vertex_declaration); + if (FAILED(hr)) return hr; + hr = IDirect3DDevice9_SetStreamSource(This->device, 0, This->vertex_buffer, 0, vertex_size); + if (FAILED(hr)) return hr; + hr = IDirect3DDevice9_SetIndices(This->device, This->index_buffer); + if (FAILED(hr)) return hr; + + while (face_end < This->numfaces) + { + for (face_start = face_end; face_start < This->numfaces; face_start++) + { + if (This->attrib_buffer[face_start] == attrib_id) + break; + } + if (face_start >= This->numfaces) + break; + for (face_end = face_start + 1; face_end < This->numfaces; face_end++) + { + if (This->attrib_buffer[face_end] != attrib_id) + break; + } + + hr = IDirect3DDevice9_DrawIndexedPrimitive(This->device, D3DPT_TRIANGLELIST, + 0, 0, This->numvertices, face_start * 3, face_end - face_start); + if (FAILED(hr)) return hr; + } + + return D3D_OK; }
static DWORD WINAPI ID3DXMeshImpl_GetNumFaces(ID3DXMesh *iface)