[PATCH 2/2] d3dx9: Add stub and basic test for D3DXCreateSphere.

Misha Koshelev misha680 at gmail.com
Tue Jun 22 22:58:47 CDT 2010


FYI, I am following the current definition of D3DXCreateBox, which is in the mesh.c file.

If you think I should start a separate (shape.c) file for these functions, please let me know.

Prior patch fixed an #include which should have been present in d3dx9.h

Starting work on 
http://bugs.winehq.org/show_bug.cgi?id=22918

implementing D3DXCreateSphere

Thank you
Misha

p.s. Actually I remember I used to be quite into game programming many years ago - "Tricks of the Game Programming Gurus", even wrote my own Mode X library at one point ;) - not 3D though

---
 dlls/d3dx9_36/d3dx9_36.spec |    2 +-
 dlls/d3dx9_36/mesh.c        |    8 ++++++++
 dlls/d3dx9_36/tests/mesh.c  |    9 +++++++++
 include/d3dx9shape.h        |    7 +++++++
 4 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec
index 19406e7..b9a00da 100644
--- a/dlls/d3dx9_36/d3dx9_36.spec
+++ b/dlls/d3dx9_36/d3dx9_36.spec
@@ -87,7 +87,7 @@
 @ stub D3DXCreateSkinInfo
 @ stub D3DXCreateSkinInfoFromBlendedMesh
 @ stub D3DXCreateSkinInfoFVF
-@ stub D3DXCreateSphere
+@ stdcall D3DXCreateSphere(ptr long long long ptr ptr)
 @ stdcall D3DXCreateSprite(ptr ptr)
 @ stub D3DXCreateTeapot
 @ stub D3DXCreateTextA
diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c
index 9691eed..5611030 100644
--- a/dlls/d3dx9_36/mesh.c
+++ b/dlls/d3dx9_36/mesh.c
@@ -335,3 +335,11 @@ HRESULT WINAPI D3DXCreateBox(LPDIRECT3DDEVICE9 device, FLOAT width, FLOAT height
 
     return E_NOTIMPL;
 }
+
+HRESULT WINAPI D3DXCreateSphere(LPDIRECT3DDEVICE9 device, FLOAT radius, UINT slices,
+                             UINT stacks, LPD3DXMESH* mesh, LPD3DXBUFFER* adjacency)
+{
+    FIXME("(%p, %f, %d, %d, %p, %p): stub\n", device, radius, slices, stacks, mesh, adjacency);
+
+    return E_NOTIMPL;
+}
diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index 8e4e26d..0086bb3 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -476,6 +476,14 @@ static void D3DXIntersectTriTest(void)
     ok( got_res == exp_res, "Expected result = %d, got %d\n",exp_res,got_res);
 }
 
+static void D3DXCreateSphereTest(void)
+{
+    HRESULT hr;
+
+    hr = D3DXCreateSphere(NULL, 0.0, 0, 0, NULL, NULL);
+    todo_wine ok( hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n",hr,D3DERR_INVALIDCALL);       
+}
+
 static void test_get_decl_vertex_size(void)
 {
     static const D3DVERTEXELEMENT9 declaration1[] =
@@ -556,5 +564,6 @@ START_TEST(mesh)
     D3DXDeclaratorFromFVFTest();
     D3DXGetFVFVertexSizeTest();
     D3DXIntersectTriTest();
+    D3DXCreateSphereTest();
     test_get_decl_vertex_size();
 }
diff --git a/include/d3dx9shape.h b/include/d3dx9shape.h
index e1bf231..36bca6b 100644
--- a/include/d3dx9shape.h
+++ b/include/d3dx9shape.h
@@ -32,6 +32,13 @@ HRESULT WINAPI D3DXCreateBox(LPDIRECT3DDEVICE9 device,
                              LPD3DXMESH* mesh,
                              LPD3DXBUFFER* adjacency);
 
+HRESULT WINAPI D3DXCreateSphere(LPDIRECT3DDEVICE9 device,
+                                FLOAT radius,
+                                UINT slices,
+                                UINT stacks,
+                                LPD3DXMESH* mesh,
+                                LPD3DXBUFFER* adjacency);
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.7.1






More information about the wine-devel mailing list