From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/d3drm/d3drm_private.h | 1 + dlls/d3drm/meshbuilder.c | 26 ++++++++++++++++++-------- dlls/d3drm/tests/d3drm.c | 13 +++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/dlls/d3drm/d3drm_private.h b/dlls/d3drm/d3drm_private.h index b5d60e518f8..4aea42ce0a3 100644 --- a/dlls/d3drm/d3drm_private.h +++ b/dlls/d3drm/d3drm_private.h @@ -165,6 +165,7 @@ struct d3drm_mesh_builder DWORD nb_materials; struct mesh_material *materials; DWORD *material_indices; + D3DRMRENDERQUALITY quality; };
struct mesh_group diff --git a/dlls/d3drm/meshbuilder.c b/dlls/d3drm/meshbuilder.c index 4a08b32d72d..1f783baf1fe 100644 --- a/dlls/d3drm/meshbuilder.c +++ b/dlls/d3drm/meshbuilder.c @@ -670,9 +670,10 @@ static HRESULT WINAPI d3drm_mesh_builder2_SetTextureTopology(IDirect3DRMMeshBuil static HRESULT WINAPI d3drm_mesh_builder2_SetQuality(IDirect3DRMMeshBuilder2 *iface, D3DRMRENDERQUALITY quality) { - FIXME("iface %p, quality %#lx stub!\n", iface, quality); + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface); + TRACE("iface %p, quality %#lx\n", iface, quality);
- return E_NOTIMPL; + return IDirect3DRMMeshBuilder3_SetQuality(&mesh_builder->IDirect3DRMMeshBuilder3_iface, quality); }
static HRESULT WINAPI d3drm_mesh_builder2_SetPerspective(IDirect3DRMMeshBuilder2 *iface, BOOL enable) @@ -815,9 +816,11 @@ static HRESULT WINAPI d3drm_mesh_builder2_CreateFace(IDirect3DRMMeshBuilder2 *if
static D3DRMRENDERQUALITY WINAPI d3drm_mesh_builder2_GetQuality(IDirect3DRMMeshBuilder2 *iface) { - FIXME("iface %p stub!\n", iface); + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder2(iface);
- return 0; + TRACE("iface %p\n", iface); + + return mesh_builder->quality; }
static BOOL WINAPI d3drm_mesh_builder2_GetPerspective(IDirect3DRMMeshBuilder2 *iface) @@ -1754,9 +1757,13 @@ static HRESULT WINAPI d3drm_mesh_builder3_SetTextureTopology(IDirect3DRMMeshBuil static HRESULT WINAPI d3drm_mesh_builder3_SetQuality(IDirect3DRMMeshBuilder3 *iface, D3DRMRENDERQUALITY quality) { - FIXME("iface %p, quality %#lx stub!\n", iface, quality); + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface);
- return E_NOTIMPL; + TRACE("iface %p, quality %#lx\n", iface, quality); + + mesh_builder->quality = quality; + + return S_OK; }
static HRESULT WINAPI d3drm_mesh_builder3_SetPerspective(IDirect3DRMMeshBuilder3 *iface, @@ -1904,9 +1911,11 @@ static HRESULT WINAPI d3drm_mesh_builder3_CreateFace(IDirect3DRMMeshBuilder3 *if
static D3DRMRENDERQUALITY WINAPI d3drm_mesh_builder3_GetQuality(IDirect3DRMMeshBuilder3 *iface) { - FIXME("iface %p stub!\n", iface); + struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface);
- return 0; + TRACE("iface %p\n", iface); + + return mesh_builder->quality; }
static BOOL WINAPI d3drm_mesh_builder3_GetPerspective(IDirect3DRMMeshBuilder3 *iface) @@ -2345,6 +2354,7 @@ HRESULT d3drm_mesh_builder_create(struct d3drm_mesh_builder **mesh_builder, IDir object->IDirect3DRMMeshBuilder3_iface.lpVtbl = &d3drm_mesh_builder3_vtbl; object->ref = 1; object->d3drm = d3drm; + object->quality = D3DRMRENDER_GOURAUD; IDirect3DRM_AddRef(object->d3drm);
d3drm_object_init(&object->obj, classname); diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 7b591958373..209ff7ec311 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -863,6 +863,7 @@ static void test_Face(void) D3DCOLOR color; DWORD count; int icount; + D3DRMRENDERQUALITY quality;
hr = Direct3DRMCreate(&d3drm); ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface, hr %#lx\n", hr); @@ -934,6 +935,18 @@ static void test_Face(void) icount = IDirect3DRMFace_GetVertexCount(face1); ok(!icount, "wrong VertexCount: %i\n", icount);
+ quality = IDirect3DRMMeshBuilder3_GetQuality(MeshBuilder2); + ok(quality == D3DRMRENDER_GOURAUD, "Unexpected %lx.\n", quality); + + hr = IDirect3DRMMeshBuilder3_SetQuality(MeshBuilder2, D3DRMRENDER_PHONG); + ok(hr == S_OK, "got %lx.\n", hr); + + quality = IDirect3DRMMeshBuilder3_GetQuality(MeshBuilder2); + ok(quality == D3DRMRENDER_PHONG, "got %lx.\n", quality); + + hr = IDirect3DRMMeshBuilder3_SetQuality(MeshBuilder2, D3DRMRENDER_GOURAUD); + ok(hr == S_OK, "got %lx.\n", hr); + IDirect3DRMFace_Release(face1); IDirect3DRMMeshBuilder2_Release(MeshBuilder2);
On 5/18/22 19:39, Alistair Leslie-Hughes wrote:
From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com
dlls/d3drm/d3drm_private.h | 1 + dlls/d3drm/meshbuilder.c | 26 ++++++++++++++++++-------- dlls/d3drm/tests/d3drm.c | 13 +++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-)
Shouldn't this quality be propagated to the created mesh?
If nothing else it deserves a FIXME warning that the quality set is ignored. Same for the other patches in this series.
From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/d3drm/d3drm_private.h | 2 ++ dlls/d3drm/tests/d3drm.c | 17 +++++++++++++++++ dlls/d3drm/texture.c | 18 ++++++++++++++---- 3 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/dlls/d3drm/d3drm_private.h b/dlls/d3drm/d3drm_private.h index 4aea42ce0a3..26accb1e1fb 100644 --- a/dlls/d3drm/d3drm_private.h +++ b/dlls/d3drm/d3drm_private.h @@ -64,6 +64,8 @@ struct d3drm_texture IDirect3DRM *d3drm; D3DRMIMAGE *image; IDirectDrawSurface *surface; + LONG decal_x; + LONG decal_y; };
struct d3drm_frame diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 209ff7ec311..82993e050d5 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -2706,6 +2706,7 @@ static void test_Texture(void) IDirect3DRMTexture2 *texture2; IDirect3DRMTexture3 *texture3; IDirectDrawSurface *surface; + LONG decalx, decaly;
D3DRMIMAGE initimg = { @@ -2867,6 +2868,22 @@ static void test_Texture(void) test_object_name((IDirect3DRMObject *)texture2); test_object_name((IDirect3DRMObject *)texture3);
+ hr = IDirect3DRMTexture_GetDecalOrigin(texture1, &decalx, &decaly); + ok(hr == S_OK, "got %#lx.\n", hr); + ok(decalx == 0, "got %ld.\n", decalx); + ok(decaly == 0, "got %ld.\n", decaly); + + hr = IDirect3DRMTexture_SetDecalOrigin(texture1, 1, 1); + ok(hr == S_OK, "got %#lx.\n", hr); + + hr = IDirect3DRMTexture_GetDecalOrigin(texture1, &decalx, &decaly); + ok(hr == S_OK, "got %#lx.\n", hr); + ok(decalx == 1, "got %ld.\n", decalx); + ok(decaly == 1, "got %ld.\n", decaly); + + hr = IDirect3DRMTexture_SetDecalOrigin(texture1, 0, 0); + ok(hr == S_OK, "got %#lx.\n", hr); + d3drm_img = IDirect3DRMTexture_GetImage(texture1); ok(!!d3drm_img, "Failed to get image.\n"); ok(d3drm_img == &initimg, "Expected image returned == %p, got %p.\n", &initimg, d3drm_img); diff --git a/dlls/d3drm/texture.c b/dlls/d3drm/texture.c index c679100c6b7..5e9dc37b3a6 100644 --- a/dlls/d3drm/texture.c +++ b/dlls/d3drm/texture.c @@ -1194,9 +1194,14 @@ static HRESULT WINAPI d3drm_texture3_SetDecalSize(IDirect3DRMTexture3 *iface, D3
static HRESULT WINAPI d3drm_texture3_SetDecalOrigin(IDirect3DRMTexture3 *iface, LONG x, LONG y) { - FIXME("iface %p, x %ld, y %ld stub!\n", iface, x, y); + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
- return E_NOTIMPL; + TRACE("iface %p, x %ld, y %ld\n", iface, x, y); + + texture->decal_x = x; + texture->decal_y = y; + + return S_OK; }
static HRESULT WINAPI d3drm_texture3_SetDecalScale(IDirect3DRMTexture3 *iface, DWORD scale) @@ -1229,9 +1234,14 @@ static HRESULT WINAPI d3drm_texture3_GetDecalSize(IDirect3DRMTexture3 *iface, D3
static HRESULT WINAPI d3drm_texture3_GetDecalOrigin(IDirect3DRMTexture3 *iface, LONG *x, LONG *y) { - FIXME("iface %p, x %p, y %p stub!\n", iface, x, y); + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
- return E_NOTIMPL; + TRACE("iface %p, x %p, y %p\n", iface, x, y); + + *x = texture->decal_x; + *y = texture->decal_y; + + return S_OK; }
static D3DRMIMAGE * WINAPI d3drm_texture3_GetImage(IDirect3DRMTexture3 *iface)
From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/d3drm/d3drm_private.h | 1 + dlls/d3drm/tests/d3drm.c | 13 +++++++++++++ dlls/d3drm/texture.c | 14 +++++++++----- 3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/dlls/d3drm/d3drm_private.h b/dlls/d3drm/d3drm_private.h index 26accb1e1fb..9cebefb955a 100644 --- a/dlls/d3drm/d3drm_private.h +++ b/dlls/d3drm/d3drm_private.h @@ -66,6 +66,7 @@ struct d3drm_texture IDirectDrawSurface *surface; LONG decal_x; LONG decal_y; + DWORD max_colors; };
struct d3drm_frame diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 82993e050d5..0244892cdcf 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -2707,6 +2707,7 @@ static void test_Texture(void) IDirect3DRMTexture3 *texture3; IDirectDrawSurface *surface; LONG decalx, decaly; + DWORD colors;
D3DRMIMAGE initimg = { @@ -2884,6 +2885,18 @@ static void test_Texture(void) hr = IDirect3DRMTexture_SetDecalOrigin(texture1, 0, 0); ok(hr == S_OK, "got %#lx.\n", hr);
+ colors = IDirect3DRMTexture_GetColors(texture1); + ok(colors == 8, "got %ld.\n", colors); + + hr = IDirect3DRMTexture_SetColors(texture1, 256); + ok(hr == S_OK, "got %#lx.\n", hr); + + colors = IDirect3DRMTexture_GetColors(texture1); + ok(colors == 256, "got %ld.\n", colors); + + hr = IDirect3DRMTexture_SetColors(texture1, 8); + ok(hr == S_OK, "got %#lx.\n", hr); + d3drm_img = IDirect3DRMTexture_GetImage(texture1); ok(!!d3drm_img, "Failed to get image.\n"); ok(d3drm_img == &initimg, "Expected image returned == %p, got %p.\n", &initimg, d3drm_img); diff --git a/dlls/d3drm/texture.c b/dlls/d3drm/texture.c index 5e9dc37b3a6..86fc5cd1595 100644 --- a/dlls/d3drm/texture.c +++ b/dlls/d3drm/texture.c @@ -1173,9 +1173,12 @@ static HRESULT WINAPI d3drm_texture3_Changed(IDirect3DRMTexture3 *iface,
static HRESULT WINAPI d3drm_texture3_SetColors(IDirect3DRMTexture3 *iface, DWORD max_colors) { - FIXME("iface %p, max_colors %lu stub!\n", iface, max_colors); + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + TRACE("iface %p, max_colors %lu\n", iface, max_colors);
- return E_NOTIMPL; + texture->max_colors= max_colors; + + return S_OK; }
static HRESULT WINAPI d3drm_texture3_SetShades(IDirect3DRMTexture3 *iface, DWORD max_shades) @@ -1262,9 +1265,9 @@ static DWORD WINAPI d3drm_texture3_GetShades(IDirect3DRMTexture3 *iface)
static DWORD WINAPI d3drm_texture3_GetColors(IDirect3DRMTexture3 *iface) { - FIXME("iface %p stub!\n", iface); - - return 0; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + TRACE("iface %p\n", iface); + return texture->max_colors; }
static DWORD WINAPI d3drm_texture3_GetDecalScale(IDirect3DRMTexture3 *iface) @@ -1433,6 +1436,7 @@ HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm) object->IDirect3DRMTexture2_iface.lpVtbl = &d3drm_texture2_vtbl; object->IDirect3DRMTexture3_iface.lpVtbl = &d3drm_texture3_vtbl; object->d3drm = d3drm; + object->max_colors = 8;
d3drm_object_init(&object->obj, classname);
From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/d3drm/d3drm_private.h | 1 + dlls/d3drm/tests/d3drm.c | 20 +++++++++++++++++++- dlls/d3drm/texture.c | 14 +++++++++----- 3 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/dlls/d3drm/d3drm_private.h b/dlls/d3drm/d3drm_private.h index 9cebefb955a..44bf41fdabf 100644 --- a/dlls/d3drm/d3drm_private.h +++ b/dlls/d3drm/d3drm_private.h @@ -67,6 +67,7 @@ struct d3drm_texture LONG decal_x; LONG decal_y; DWORD max_colors; + DWORD max_shades; };
struct d3drm_frame diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 0244892cdcf..426aa1fd28d 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -2707,7 +2707,7 @@ static void test_Texture(void) IDirect3DRMTexture3 *texture3; IDirectDrawSurface *surface; LONG decalx, decaly; - DWORD colors; + DWORD colors, shades;
D3DRMIMAGE initimg = { @@ -2897,6 +2897,24 @@ static void test_Texture(void) hr = IDirect3DRMTexture_SetColors(texture1, 8); ok(hr == S_OK, "got %#lx.\n", hr);
+ shades = IDirect3DRMTexture_GetShades(texture1); + ok(shades == 16, "got %ld.\n", shades); + + hr = IDirect3DRMTexture_SetShades(texture1, 8); + ok(hr == S_OK, "got %#lx.\n", hr); + + shades = IDirect3DRMTexture_GetShades(texture1); + ok(shades == 8, "got %ld.\n", shades); + + hr = IDirect3DRMTexture_SetShades(texture1, 11); + ok(hr == S_OK, "got %#lx.\n", hr); + + shades = IDirect3DRMTexture_GetShades(texture1); + ok(shades == 11, "got %ld.\n", shades); + + hr = IDirect3DRMTexture_SetShades(texture1, 8); + ok(hr == S_OK, "got %#lx.\n", hr); + d3drm_img = IDirect3DRMTexture_GetImage(texture1); ok(!!d3drm_img, "Failed to get image.\n"); ok(d3drm_img == &initimg, "Expected image returned == %p, got %p.\n", &initimg, d3drm_img); diff --git a/dlls/d3drm/texture.c b/dlls/d3drm/texture.c index 86fc5cd1595..76f82671811 100644 --- a/dlls/d3drm/texture.c +++ b/dlls/d3drm/texture.c @@ -1183,9 +1183,12 @@ static HRESULT WINAPI d3drm_texture3_SetColors(IDirect3DRMTexture3 *iface, DWORD
static HRESULT WINAPI d3drm_texture3_SetShades(IDirect3DRMTexture3 *iface, DWORD max_shades) { - FIXME("iface %p, max_shades %lu stub!\n", iface, max_shades); + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + TRACE("iface %p, max_shades %lu\n", iface, max_shades);
- return E_NOTIMPL; + texture->max_shades = max_shades; + + return S_OK; }
static HRESULT WINAPI d3drm_texture3_SetDecalSize(IDirect3DRMTexture3 *iface, D3DVALUE width, D3DVALUE height) @@ -1258,9 +1261,9 @@ static D3DRMIMAGE * WINAPI d3drm_texture3_GetImage(IDirect3DRMTexture3 *iface)
static DWORD WINAPI d3drm_texture3_GetShades(IDirect3DRMTexture3 *iface) { - FIXME("iface %p stub!\n", iface); - - return 0; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface); + TRACE("iface %p\n", iface); + return texture->max_shades; }
static DWORD WINAPI d3drm_texture3_GetColors(IDirect3DRMTexture3 *iface) @@ -1437,6 +1440,7 @@ HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm) object->IDirect3DRMTexture3_iface.lpVtbl = &d3drm_texture3_vtbl; object->d3drm = d3drm; object->max_colors = 8; + object->max_shades = 16;
d3drm_object_init(&object->obj, classname);
This merge request was approved by Jan Sikorski.