[5/5] d3dx9: Implement ID3DXMesh::Optimize using OptimizeInplace.

Dylan Smith dylan.ah.smith at gmail.com
Fri May 6 11:11:17 CDT 2011


---
 dlls/d3dx9_36/mesh.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c
index 4887c76..3009c71 100644
--- a/dlls/d3dx9_36/mesh.c
+++ b/dlls/d3dx9_36/mesh.c
@@ -645,10 +645,27 @@ static HRESULT WINAPI ID3DXMeshImpl_Optimize(ID3DXMesh *iface, DWORD flags, CONS
                                              DWORD *face_remap, LPD3DXBUFFER *vertex_remap, LPD3DXMESH *opt_mesh)
 {
     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
+        optimized_mesh->lpVtbl->Release(optimized_mesh);
+    return hr;
 }
 
 static int attrib_entry_compare(const DWORD **a, const DWORD **b)
-- 
1.7.2.5



More information about the wine-patches mailing list