Commit e07f8242 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

d3drm: Implement IDirect3DRMMeshBuilderX_Scale method.

parent 4c7fb67f
/*
* Implementation of IDirect3DRMMeshBuilder2 Interface
* Implementation of IDirect3DRMMeshBuilderX and IDirect3DRMMesh interfaces
*
* Copyright 2010, 2012 Christian Costa
* Copyright 2011 André Hentschel
......@@ -19,10 +19,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/debug.h"
#define NONAMELESSUNION
#define COBJMACROS
#include "wine/debug.h"
#include "winbase.h"
#include "wingdi.h"
#include "dxfile.h"
......@@ -472,9 +474,9 @@ static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_Scale(IDirect3DRMMeshBuilder2*
{
IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface);
FIXME("(%p)->(%f,%f,%f): stub\n", This, sx, sy, sz);
TRACE("(%p)->(%f,%f,%f)\n", This, sx, sy, sz);
return D3DRM_OK;
return IDirect3DRMMeshBuilder3_Scale(&This->IDirect3DRMMeshBuilder3_iface, sx, sy, sz);
}
static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_Translate(IDirect3DRMMeshBuilder2* iface,
......@@ -1415,10 +1417,20 @@ static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_Scale(IDirect3DRMMeshBuilder3*
D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
{
IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface);
int i;
FIXME("(%p)->(%f,%f,%f): stub\n", This, sx, sy, sz);
TRACE("(%p)->(%f,%f,%f)\n", This, sx, sy, sz);
return E_NOTIMPL;
for (i = 0; i < This->nb_vertices; i++)
{
This->pVertices[i].u1.x *= sx;
This->pVertices[i].u2.y *= sy;
This->pVertices[i].u3.z *= sz;
}
/* Normals are not affected by Scale */
return D3DRM_OK;
}
static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_Translate(IDirect3DRMMeshBuilder3* iface,
......
......@@ -325,6 +325,33 @@ static void test_MeshBuilder(void)
ok(f[6] == 2 , "Wrong component f[6] = %d (expected 2)\n", f[6]);
ok(f[7] == 0 , "Wrong component f[7] = %d (expected 0)\n", f[7]);
hr = IDirect3DRMMeshBuilder_Scale(pMeshBuilder, 2, 3 ,4);
ok(hr == D3DRM_OK, "Scale failed returning hr = %x\n", hr);
hr = IDirect3DRMMeshBuilder_GetVertices(pMeshBuilder, &val1, v, &val2, n, &val3, f);
ok(hr == D3DRM_OK, "Cannot get vertices information (hr = %x)\n", hr);
ok(val2 == 3, "Wrong number of normals %d (must be 3)\n", val2);
ok(val1 == 3, "Wrong number of vertices %d (must be 3)\n", val1);
ok(U1(v[0]).x == 0.1f*2, "Wrong component v[0].x = %f (expected %f)\n", U1(v[0]).x, 0.1f*2);
ok(U2(v[0]).y == 0.2f*3, "Wrong component v[0].y = %f (expected %f)\n", U2(v[0]).y, 0.2f*3);
ok(U3(v[0]).z == 0.3f*4, "Wrong component v[0].z = %f (expected %f)\n", U3(v[0]).z, 0.3f*4);
ok(U1(v[1]).x == 0.4f*2, "Wrong component v[1].x = %f (expected %f)\n", U1(v[1]).x, 0.4f*2);
ok(U2(v[1]).y == 0.5f*3, "Wrong component v[1].y = %f (expected %f)\n", U2(v[1]).y, 0.5f*3);
ok(U3(v[1]).z == 0.6f*4, "Wrong component v[1].z = %f (expected %f)\n", U3(v[1]).z, 0.6f*4);
ok(U1(v[2]).x == 0.7f*2, "Wrong component v[2].x = %f (expected %f)\n", U1(v[2]).x, 0.7f*2);
ok(U2(v[2]).y == 0.8f*3, "Wrong component v[2].y = %f (expected %f)\n", U2(v[2]).y, 0.8f*3);
ok(U3(v[2]).z == 0.9f*4, "Wrong component v[2].z = %f (expected %f)\n", U3(v[2]).z, 0.9f*4);
/* Normals are not affected by Scale */
ok(U1(n[0]).x == 1.1f, "Wrong component n[0].x = %f (expected %f)\n", U1(n[0]).x, 1.1f);
ok(U2(n[0]).y == 1.2f, "Wrong component n[0].y = %f (expected %f)\n", U2(n[0]).y, 1.2f);
ok(U3(n[0]).z == 1.3f, "Wrong component n[0].z = %f (expected %f)\n", U3(n[0]).z, 1.3f);
ok(U1(n[1]).x == 1.4f, "Wrong component n[1].x = %f (expected %f)\n", U1(n[1]).x, 1.4f);
ok(U2(n[1]).y == 1.5f, "Wrong component n[1].y = %f (expected %f)\n", U2(n[1]).y, 1.5f);
ok(U3(n[1]).z == 1.6f, "Wrong component n[1].z = %f (expected %f)\n", U3(n[1]).z, 1.6f);
ok(U1(n[2]).x == 1.7f, "Wrong component n[2].x = %f (expected %f)\n", U1(n[2]).x, 1.7f);
ok(U2(n[2]).y == 1.8f, "Wrong component n[2].y = %f (expected %f)\n", U2(n[2]).y, 1.8f);
ok(U3(n[2]).z == 1.9f, "Wrong component n[2].z = %f (expected %f)\n", U3(n[2]).z, 1.9f);
IDirect3DRMMeshBuilder_Release(pMeshBuilder);
IDirect3DRM_Release(pD3DRM);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment