Gediminas Jakutis : d3dx9: Add adjacency generation for D3DXCreateSphere() .

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jul 3 12:54:49 CDT 2014


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

Author: Gediminas Jakutis <gediminas at varciai.lt>
Date:   Thu Jul  3 01:42:11 2014 +0300

d3dx9: Add adjacency generation for D3DXCreateSphere().

---

 dlls/d3dx9_36/mesh.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c
index 1a2b020..3b3784b 100644
--- a/dlls/d3dx9_36/mesh.c
+++ b/dlls/d3dx9_36/mesh.c
@@ -4693,12 +4693,6 @@ HRESULT WINAPI D3DXCreateSphere(struct IDirect3DDevice9 *device, float radius, U
         return D3DERR_INVALIDCALL;
     }
 
-    if (adjacency)
-    {
-        FIXME("Case of adjacency != NULL not implemented.\n");
-        return E_NOTIMPL;
-    }
-
     number_of_vertices = 2 + slices * (stacks-1);
     number_of_faces = 2 * slices + (stacks - 2) * (2 * slices);
 
@@ -4836,6 +4830,24 @@ HRESULT WINAPI D3DXCreateSphere(struct IDirect3DDevice9 *device, float radius, U
     free_sincos_table(&phi);
     sphere->lpVtbl->UnlockIndexBuffer(sphere);
     sphere->lpVtbl->UnlockVertexBuffer(sphere);
+
+
+    if (adjacency)
+    {
+        if (FAILED(hr = D3DXCreateBuffer(number_of_faces * sizeof(DWORD) * 3, adjacency)))
+        {
+            sphere->lpVtbl->Release(sphere);
+            return hr;
+        }
+
+        if (FAILED(hr = sphere->lpVtbl->GenerateAdjacency(sphere, 0.0f, (*adjacency)->lpVtbl->GetBufferPointer(*adjacency))))
+        {
+            (*adjacency)->lpVtbl->Release(*adjacency);
+            sphere->lpVtbl->Release(sphere);
+            return hr;
+        }
+    }
+
     *mesh = sphere;
 
     return D3D_OK;




More information about the wine-cvs mailing list