d3dx9: Implement ID3DXMesh::Optimize using OptimizeInplace.

This commit is contained in:
Dylan Smith 2011-05-18 04:34:41 -04:00 committed by Alexandre Julliard
parent 33fa518c87
commit bf202cfdfd
1 changed files with 19 additions and 2 deletions

View File

@ -646,10 +646,27 @@ static HRESULT WINAPI ID3DXMeshImpl_Optimize(ID3DXMesh *iface, DWORD flags, CONS
DWORD *face_remap, LPD3DXBUFFER *vertex_remap, LPD3DXMESH *opt_mesh) DWORD *face_remap, LPD3DXBUFFER *vertex_remap, LPD3DXMESH *opt_mesh)
{ {
ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface);
HRESULT hr;
D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE] = { D3DDECL_END() };
ID3DXMesh *optimized_mesh;
FIXME("(%p)->(%u,%p,%p,%p,%p,%p): stub\n", This, flags, adjacency_in, adjacency_out, face_remap, vertex_remap, opt_mesh); TRACE("(%p)->(%x,%p,%p,%p,%p,%p)\n", This, flags, adjacency_in, adjacency_out, face_remap, vertex_remap, opt_mesh);
return E_NOTIMPL; if (!opt_mesh)
return D3DERR_INVALIDCALL;
hr = iface->lpVtbl->GetDeclaration(iface, declaration);
if (FAILED(hr)) return hr;
hr = iface->lpVtbl->CloneMesh(iface, This->options, declaration, This->device, &optimized_mesh);
if (FAILED(hr)) return hr;
hr = optimized_mesh->lpVtbl->OptimizeInplace(optimized_mesh, flags, adjacency_in, adjacency_out, face_remap, vertex_remap);
if (SUCCEEDED(hr))
*opt_mesh = optimized_mesh;
else
IUnknown_Release(optimized_mesh);
return hr;
} }
/* Creates a vertex_remap that removes unused vertices. /* Creates a vertex_remap that removes unused vertices.