d3drm: Avoid LPDIRECT3DRMMATERIAL2.

This commit is contained in:
Henri Verbeet 2013-05-29 09:45:39 +02:00 committed by Alexandre Julliard
parent 74c5a22daa
commit 735e69f94e
6 changed files with 42 additions and 51 deletions

View File

@ -997,20 +997,17 @@ static HRESULT WINAPI IDirect3DRM3Impl_CreateLightRGB(IDirect3DRM3 *iface, D3DRM
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DRM3Impl_CreateMaterial(IDirect3DRM3* iface, D3DVALUE power, static HRESULT WINAPI IDirect3DRM3Impl_CreateMaterial(IDirect3DRM3 *iface,
LPDIRECT3DRMMATERIAL2* material) D3DVALUE power, IDirect3DRMMaterial2 **material)
{ {
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface); HRESULT hr;
HRESULT ret;
TRACE("(%p/%p)->(%f,%p)\n", iface, This, power, material); TRACE("iface %p, power %.8e, material %p.\n", iface, power, material);
ret = Direct3DRMMaterial_create(material); if (SUCCEEDED(hr = Direct3DRMMaterial_create(material)))
if (SUCCEEDED(ret))
IDirect3DRMMaterial2_SetPower(*material, power); IDirect3DRMMaterial2_SetPower(*material, power);
return ret; return hr;
} }
static HRESULT WINAPI IDirect3DRM3Impl_CreateDevice(IDirect3DRM3 *iface, static HRESULT WINAPI IDirect3DRM3Impl_CreateDevice(IDirect3DRM3 *iface,

View File

@ -2280,12 +2280,9 @@ static HRESULT WINAPI IDirect3DRMFrame3Impl_GetAxes(IDirect3DRMFrame3 *iface, D3
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IDirect3DRMFrame3Impl_GetMaterial(IDirect3DRMFrame3* iface, static HRESULT WINAPI IDirect3DRMFrame3Impl_GetMaterial(IDirect3DRMFrame3 *iface, IDirect3DRMMaterial2 **material)
LPDIRECT3DRMMATERIAL2 *material)
{ {
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface); FIXME("iface %p, material %p stub!\n", iface, material);
FIXME("(%p/%p)->(%p): stub\n", iface, This, material);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -2347,12 +2344,9 @@ static HRESULT WINAPI IDirect3DRMFrame3Impl_SetInheritAxes(IDirect3DRMFrame3* if
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IDirect3DRMFrame3Impl_SetMaterial(IDirect3DRMFrame3* iface, static HRESULT WINAPI IDirect3DRMFrame3Impl_SetMaterial(IDirect3DRMFrame3 *iface, IDirect3DRMMaterial2 *material)
LPDIRECT3DRMMATERIAL2 material)
{ {
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface); FIXME("iface %p, material %p stub!\n", iface, material);
FIXME("(%p/%p)->(%p): stub\n", iface, This, material);
return E_NOTIMPL; return E_NOTIMPL;
} }

View File

@ -1832,18 +1832,18 @@ static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetTexture(IDirect3DRMMeshBuil
return D3DRM_OK; return D3DRM_OK;
} }
static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetMaterial(IDirect3DRMMeshBuilder3* iface, static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_SetMaterial(IDirect3DRMMeshBuilder3 *iface,
LPDIRECT3DRMMATERIAL2 material) IDirect3DRMMaterial2 *material)
{ {
IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface); IDirect3DRMMeshBuilderImpl *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface);
TRACE("(%p)->(%p)\n", This, material); TRACE("iface %p, material %p.\n", iface, material);
if (material) if (material)
IDirect3DRMTexture2_AddRef(material); IDirect3DRMTexture2_AddRef(material);
if (This->material) if (mesh_builder->material)
IDirect3DRMTexture2_Release(This->material); IDirect3DRMTexture2_Release(mesh_builder->material);
This->material = material; mesh_builder->material = material;
return D3DRM_OK; return D3DRM_OK;
} }

View File

@ -1356,7 +1356,7 @@ static void test_Material2(void)
HRESULT hr; HRESULT hr;
IDirect3DRM *d3drm; IDirect3DRM *d3drm;
IDirect3DRM3 *d3drm3; IDirect3DRM3 *d3drm3;
LPDIRECT3DRMMATERIAL2 pMaterial2; IDirect3DRMMaterial2 *material2;
D3DVALUE r, g, b; D3DVALUE r, g, b;
DWORD size; DWORD size;
CHAR cname[64] = {0}; CHAR cname[64] = {0};
@ -1371,61 +1371,61 @@ static void test_Material2(void)
return; return;
} }
hr = IDirect3DRM3_CreateMaterial(d3drm3, 18.5f, &pMaterial2); hr = IDirect3DRM3_CreateMaterial(d3drm3, 18.5f, &material2);
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMaterial2 interface (hr = %x)\n", hr); ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMaterial2 interface (hr = %x)\n", hr);
hr = IDirect3DRMMaterial2_GetClassName(pMaterial2, NULL, cname); hr = IDirect3DRMMaterial2_GetClassName(material2, NULL, cname);
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
hr = IDirect3DRMMaterial2_GetClassName(pMaterial2, NULL, NULL); hr = IDirect3DRMMaterial2_GetClassName(material2, NULL, NULL);
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
size = 1; size = 1;
hr = IDirect3DRMMaterial2_GetClassName(pMaterial2, &size, cname); hr = IDirect3DRMMaterial2_GetClassName(material2, &size, cname);
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
size = sizeof(cname); size = sizeof(cname);
hr = IDirect3DRMMaterial2_GetClassName(pMaterial2, &size, cname); hr = IDirect3DRMMaterial2_GetClassName(material2, &size, cname);
ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr); ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr);
ok(size == sizeof("Material"), "wrong size: %u\n", size); ok(size == sizeof("Material"), "wrong size: %u\n", size);
ok(!strcmp(cname, "Material"), "Expected cname to be \"Material\", but got \"%s\"\n", cname); ok(!strcmp(cname, "Material"), "Expected cname to be \"Material\", but got \"%s\"\n", cname);
r = IDirect3DRMMaterial2_GetPower(pMaterial2); r = IDirect3DRMMaterial2_GetPower(material2);
ok(r == 18.5f, "wrong power (%f)\n", r); ok(r == 18.5f, "wrong power (%f)\n", r);
hr = IDirect3DRMMaterial2_GetEmissive(pMaterial2, &r, &g, &b); hr = IDirect3DRMMaterial2_GetEmissive(material2, &r, &g, &b);
ok(hr == D3DRM_OK, "Cannot get emissive (hr = %x)\n", hr); ok(hr == D3DRM_OK, "Cannot get emissive (hr = %x)\n", hr);
ok(r == 0.0f && g == 0.0f && b == 0.0f, "wrong emissive r=%f g=%f b=%f, expected r=0.0 g=0.0 b=0.0\n", r, g, b); ok(r == 0.0f && g == 0.0f && b == 0.0f, "wrong emissive r=%f g=%f b=%f, expected r=0.0 g=0.0 b=0.0\n", r, g, b);
hr = IDirect3DRMMaterial2_GetSpecular(pMaterial2, &r, &g, &b); hr = IDirect3DRMMaterial2_GetSpecular(material2, &r, &g, &b);
ok(hr == D3DRM_OK, "Cannot get emissive (hr = %x)\n", hr); ok(hr == D3DRM_OK, "Cannot get emissive (hr = %x)\n", hr);
ok(r == 1.0f && g == 1.0f && b == 1.0f, "wrong specular r=%f g=%f b=%f, expected r=1.0 g=1.0 b=1.0\n", r, g, b); ok(r == 1.0f && g == 1.0f && b == 1.0f, "wrong specular r=%f g=%f b=%f, expected r=1.0 g=1.0 b=1.0\n", r, g, b);
hr = IDirect3DRMMaterial2_GetAmbient(pMaterial2, &r, &g, &b); hr = IDirect3DRMMaterial2_GetAmbient(material2, &r, &g, &b);
ok(hr == D3DRM_OK, "Cannot get emissive (hr = %x)\n", hr); ok(hr == D3DRM_OK, "Cannot get emissive (hr = %x)\n", hr);
ok(r == 0.0f && g == 0.0f && b == 0.0f, "wrong ambient r=%f g=%f b=%f, expected r=0.0 g=0.0 b=0.0\n", r, g, b); ok(r == 0.0f && g == 0.0f && b == 0.0f, "wrong ambient r=%f g=%f b=%f, expected r=0.0 g=0.0 b=0.0\n", r, g, b);
hr = IDirect3DRMMaterial2_SetPower(pMaterial2, 5.87f); hr = IDirect3DRMMaterial2_SetPower(material2, 5.87f);
ok(hr == D3DRM_OK, "Cannot set power (hr = %x)\n", hr); ok(hr == D3DRM_OK, "Cannot set power (hr = %x)\n", hr);
r = IDirect3DRMMaterial2_GetPower(pMaterial2); r = IDirect3DRMMaterial2_GetPower(material2);
ok(r == 5.87f, "wrong power (%f)\n", r); ok(r == 5.87f, "wrong power (%f)\n", r);
hr = IDirect3DRMMaterial2_SetEmissive(pMaterial2, 0.5f, 0.5f, 0.5f); hr = IDirect3DRMMaterial2_SetEmissive(material2, 0.5f, 0.5f, 0.5f);
ok(hr == D3DRM_OK, "Cannot set emissive (hr = %x)\n", hr); ok(hr == D3DRM_OK, "Cannot set emissive (hr = %x)\n", hr);
hr = IDirect3DRMMaterial2_GetEmissive(pMaterial2, &r, &g, &b); hr = IDirect3DRMMaterial2_GetEmissive(material2, &r, &g, &b);
ok(hr == D3DRM_OK, "Cannot get emissive (hr = %x)\n", hr); ok(hr == D3DRM_OK, "Cannot get emissive (hr = %x)\n", hr);
ok(r == 0.5f && g == 0.5f && b == 0.5f, "wrong emissive r=%f g=%f b=%f, expected r=0.5 g=0.5 b=0.5\n", r, g, b); ok(r == 0.5f && g == 0.5f && b == 0.5f, "wrong emissive r=%f g=%f b=%f, expected r=0.5 g=0.5 b=0.5\n", r, g, b);
hr = IDirect3DRMMaterial2_SetSpecular(pMaterial2, 0.6f, 0.6f, 0.6f); hr = IDirect3DRMMaterial2_SetSpecular(material2, 0.6f, 0.6f, 0.6f);
ok(hr == D3DRM_OK, "Cannot set specular (hr = %x)\n", hr); ok(hr == D3DRM_OK, "Cannot set specular (hr = %x)\n", hr);
hr = IDirect3DRMMaterial2_GetSpecular(pMaterial2, &r, &g, &b); hr = IDirect3DRMMaterial2_GetSpecular(material2, &r, &g, &b);
ok(hr == D3DRM_OK, "Cannot get specular (hr = %x)\n", hr); ok(hr == D3DRM_OK, "Cannot get specular (hr = %x)\n", hr);
ok(r == 0.6f && g == 0.6f && b == 0.6f, "wrong specular r=%f g=%f b=%f, expected r=0.6 g=0.6 b=0.6\n", r, g, b); ok(r == 0.6f && g == 0.6f && b == 0.6f, "wrong specular r=%f g=%f b=%f, expected r=0.6 g=0.6 b=0.6\n", r, g, b);
hr = IDirect3DRMMaterial2_SetAmbient(pMaterial2, 0.7f, 0.7f, 0.7f); hr = IDirect3DRMMaterial2_SetAmbient(material2, 0.7f, 0.7f, 0.7f);
ok(hr == D3DRM_OK, "Cannot set ambient (hr = %x)\n", hr); ok(hr == D3DRM_OK, "Cannot set ambient (hr = %x)\n", hr);
hr = IDirect3DRMMaterial2_GetAmbient(pMaterial2, &r, &g, &b); hr = IDirect3DRMMaterial2_GetAmbient(material2, &r, &g, &b);
ok(hr == D3DRM_OK, "Cannot get ambient (hr = %x)\n", hr); ok(hr == D3DRM_OK, "Cannot get ambient (hr = %x)\n", hr);
ok(r == 0.7f && g == 0.7f && b == 0.7f, "wrong ambient r=%f g=%f b=%f, expected r=0.7 g=0.7 b=0.7\n", r, g, b); ok(r == 0.7f && g == 0.7f && b == 0.7f, "wrong ambient r=%f g=%f b=%f, expected r=0.7 g=0.7 b=0.7\n", r, g, b);
IDirect3DRMMaterial2_Release(pMaterial2); IDirect3DRMMaterial2_Release(material2);
IDirect3DRM3_Release(d3drm3); IDirect3DRM3_Release(d3drm3);
IDirect3DRM_Release(d3drm); IDirect3DRM_Release(d3drm);

View File

@ -350,7 +350,7 @@ DECLARE_INTERFACE_(IDirect3DRM3,IUnknown)
STDMETHOD(CreateLight)(THIS_ D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light) PURE; STDMETHOD(CreateLight)(THIS_ D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light) PURE;
STDMETHOD(CreateLightRGB)(THIS_ D3DRMLIGHTTYPE type, D3DVALUE r, D3DVALUE g, D3DVALUE b, STDMETHOD(CreateLightRGB)(THIS_ D3DRMLIGHTTYPE type, D3DVALUE r, D3DVALUE g, D3DVALUE b,
IDirect3DRMLight **light) PURE; IDirect3DRMLight **light) PURE;
STDMETHOD(CreateMaterial)(THIS_ D3DVALUE, LPDIRECT3DRMMATERIAL2 *) PURE; STDMETHOD(CreateMaterial)(THIS_ D3DVALUE, IDirect3DRMMaterial2 **material) PURE;
STDMETHOD(CreateDevice)(THIS_ DWORD width, DWORD height, IDirect3DRMDevice3 **device) PURE; STDMETHOD(CreateDevice)(THIS_ DWORD width, DWORD height, IDirect3DRMDevice3 **device) PURE;
STDMETHOD(CreateDeviceFromSurface)(THIS_ GUID *guid, IDirectDraw *ddraw, STDMETHOD(CreateDeviceFromSurface)(THIS_ GUID *guid, IDirectDraw *ddraw,
IDirectDrawSurface *surface, IDirect3DRMDevice3 **device) PURE; IDirectDrawSurface *surface, IDirect3DRMDevice3 **device) PURE;

View File

@ -1676,14 +1676,14 @@ DECLARE_INTERFACE_(IDirect3DRMFrame3,IDirect3DRMVisual)
STDMETHOD(GetBox)(THIS_ D3DRMBOX *box) PURE; STDMETHOD(GetBox)(THIS_ D3DRMBOX *box) PURE;
STDMETHOD_(BOOL, GetBoxEnable)(THIS) PURE; STDMETHOD_(BOOL, GetBoxEnable)(THIS) PURE;
STDMETHOD(GetAxes)(THIS_ D3DVECTOR *dir, D3DVECTOR *up); STDMETHOD(GetAxes)(THIS_ D3DVECTOR *dir, D3DVECTOR *up);
STDMETHOD(GetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2 *) PURE; STDMETHOD(GetMaterial)(THIS_ struct IDirect3DRMMaterial2 **material) PURE;
STDMETHOD_(BOOL, GetInheritAxes)(THIS); STDMETHOD_(BOOL, GetInheritAxes)(THIS);
STDMETHOD(GetHierarchyBox)(THIS_ D3DRMBOX *box) PURE; STDMETHOD(GetHierarchyBox)(THIS_ D3DRMBOX *box) PURE;
STDMETHOD(SetBox)(THIS_ D3DRMBOX *box) PURE; STDMETHOD(SetBox)(THIS_ D3DRMBOX *box) PURE;
STDMETHOD(SetBoxEnable)(THIS_ BOOL) PURE; STDMETHOD(SetBoxEnable)(THIS_ BOOL) PURE;
STDMETHOD(SetAxes)(THIS_ D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz); STDMETHOD(SetAxes)(THIS_ D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz);
STDMETHOD(SetInheritAxes)(THIS_ BOOL inherit_from_parent); STDMETHOD(SetInheritAxes)(THIS_ BOOL inherit_from_parent);
STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2) PURE; STDMETHOD(SetMaterial)(THIS_ struct IDirect3DRMMaterial2 *material) PURE;
STDMETHOD(SetQuaternion)(THIS_ IDirect3DRMFrame3 *reference, D3DRMQUATERNION *q) PURE; STDMETHOD(SetQuaternion)(THIS_ IDirect3DRMFrame3 *reference, D3DRMQUATERNION *q) PURE;
STDMETHOD(RayPick)(THIS_ IDirect3DRMFrame3 *reference, D3DRMRAY *ray, DWORD flags, STDMETHOD(RayPick)(THIS_ IDirect3DRMFrame3 *reference, D3DRMRAY *ray, DWORD flags,
struct IDirect3DRMPicked2Array **return_visuals) PURE; struct IDirect3DRMPicked2Array **return_visuals) PURE;
@ -2397,7 +2397,7 @@ DECLARE_INTERFACE_(IDirect3DRMFace2,IDirect3DRMObject)
STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE;
STDMETHOD(SetTexture)(THIS_ struct IDirect3DRMTexture3 *texture) PURE; STDMETHOD(SetTexture)(THIS_ struct IDirect3DRMTexture3 *texture) PURE;
STDMETHOD(SetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE u, D3DVALUE v) PURE; STDMETHOD(SetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE u, D3DVALUE v) PURE;
STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2) PURE; STDMETHOD(SetMaterial)(THIS_ struct IDirect3DRMMaterial2 *material) PURE;
STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE;
STDMETHOD(GetVertex)(THIS_ DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal) PURE; STDMETHOD(GetVertex)(THIS_ DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal) PURE;
STDMETHOD(GetVertices)(THIS_ DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals); STDMETHOD(GetVertices)(THIS_ DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals);
@ -2405,7 +2405,7 @@ DECLARE_INTERFACE_(IDirect3DRMFace2,IDirect3DRMObject)
STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE;
STDMETHOD(GetNormal)(THIS_ D3DVECTOR *) PURE; STDMETHOD(GetNormal)(THIS_ D3DVECTOR *) PURE;
STDMETHOD(GetTexture)(THIS_ struct IDirect3DRMTexture3 **texture) PURE; STDMETHOD(GetTexture)(THIS_ struct IDirect3DRMTexture3 **texture) PURE;
STDMETHOD(GetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2 *) PURE; STDMETHOD(GetMaterial)(THIS_ struct IDirect3DRMMaterial2 **material) PURE;
STDMETHOD_(int, GetVertexCount)(THIS) PURE; STDMETHOD_(int, GetVertexCount)(THIS) PURE;
STDMETHOD_(int, GetVertexIndex)(THIS_ DWORD which) PURE; STDMETHOD_(int, GetVertexIndex)(THIS_ DWORD which) PURE;
STDMETHOD_(int, GetTextureCoordinateIndex)(THIS_ DWORD which) PURE; STDMETHOD_(int, GetTextureCoordinateIndex)(THIS_ DWORD which) PURE;
@ -2870,7 +2870,7 @@ DECLARE_INTERFACE_(IDirect3DRMMeshBuilder3,IDirect3DRMVisual)
STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE;
STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE;
STDMETHOD(SetTexture)(THIS_ struct IDirect3DRMTexture3 *texture) PURE; STDMETHOD(SetTexture)(THIS_ struct IDirect3DRMTexture3 *texture) PURE;
STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2) PURE; STDMETHOD(SetMaterial)(THIS_ struct IDirect3DRMMaterial2 *material) PURE;
STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE;
STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE;
STDMETHOD(SetPerspective)(THIS_ BOOL) PURE; STDMETHOD(SetPerspective)(THIS_ BOOL) PURE;