Dylan Smith : d3dx9: Implement ID3DXMesh::Optimize using OptimizeInplace.

Alexandre Julliard julliard at winehq.org
Wed May 18 11:15:34 CDT 2011


Module: wine
Branch: master
Commit: bf202cfdfd78c8b6e1fd0cff771df4e573b5c415
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bf202cfdfd78c8b6e1fd0cff771df4e573b5c415

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Wed May 18 04:34:41 2011 -0400

d3dx9: Implement ID3DXMesh::Optimize using OptimizeInplace.

---

 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 0ed5030..b5504d5 100644
--- a/dlls/d3dx9_36/mesh.c
+++ b/dlls/d3dx9_36/mesh.c
@@ -646,10 +646,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
+        IUnknown_Release(optimized_mesh);
+    return hr;
 }
 
 /* Creates a vertex_remap that removes unused vertices.




More information about the wine-cvs mailing list