d3drm: Implement IDirect3DRMMeshImpl_SetGroupMaterial and forward material from mesh builder to created mesh.

This commit is contained in:
Christian Costa 2012-05-31 18:47:58 +02:00 committed by Alexandre Julliard
parent 84f2e0e9ac
commit 38ba9bacd0
2 changed files with 17 additions and 4 deletions

View File

@ -2011,6 +2011,8 @@ static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_CreateMesh(IDirect3DRMMeshBuil
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
} }
} }
if (SUCCEEDED(hr))
hr = IDirect3DRMMesh_SetGroupMaterial(*mesh, 0, (LPDIRECT3DRMMATERIAL)This->material);
if (FAILED(hr)) if (FAILED(hr))
IDirect3DRMMesh_Release(*mesh); IDirect3DRMMesh_Release(*mesh);
} }
@ -2652,13 +2654,24 @@ static HRESULT WINAPI IDirect3DRMMeshImpl_SetGroupQuality(IDirect3DRMMesh* iface
} }
static HRESULT WINAPI IDirect3DRMMeshImpl_SetGroupMaterial(IDirect3DRMMesh* iface, static HRESULT WINAPI IDirect3DRMMeshImpl_SetGroupMaterial(IDirect3DRMMesh* iface,
D3DRMGROUPINDEX id, LPDIRECT3DRMMATERIAL value) D3DRMGROUPINDEX id, LPDIRECT3DRMMATERIAL material)
{ {
IDirect3DRMMeshImpl *This = impl_from_IDirect3DRMMesh(iface); IDirect3DRMMeshImpl *This = impl_from_IDirect3DRMMesh(iface);
FIXME("(%p)->(%u,%p): stub\n", This, id, value); TRACE("(%p)->(%u,%p)\n", This, id, material);
return E_NOTIMPL; if (id >= This->nb_groups)
return D3DRMERR_BADVALUE;
if (This->groups[id].material)
IDirect3DRMMaterial2_Release(This->groups[id].material);
This->groups[id].material = (LPDIRECT3DRMMATERIAL2)material;
if (material)
IDirect3DRMMaterial2_AddRef(This->groups[id].material);
return D3DRM_OK;
} }
static HRESULT WINAPI IDirect3DRMMeshImpl_SetGroupTexture(IDirect3DRMMesh* iface, static HRESULT WINAPI IDirect3DRMMeshImpl_SetGroupTexture(IDirect3DRMMesh* iface,

View File

@ -372,7 +372,7 @@ static void test_MeshBuilder(void)
ok(texture == NULL, "No texture should be present\n"); ok(texture == NULL, "No texture should be present\n");
hr = IDirect3DRMMesh_GetGroupMaterial(mesh, 0, &material); hr = IDirect3DRMMesh_GetGroupMaterial(mesh, 0, &material);
ok(hr == D3DRM_OK, "GetCroupMaterial failed returning hr = %x\n", hr); ok(hr == D3DRM_OK, "GetCroupMaterial failed returning hr = %x\n", hr);
todo_wine ok(material != NULL, "No material present\n"); ok(material != NULL, "No material present\n");
if ((hr == D3DRM_OK) && material) if ((hr == D3DRM_OK) && material)
{ {
hr = IDirect3DRMMaterial_GetEmissive(material, &values[0], &values[1], &values[2]); hr = IDirect3DRMMaterial_GetEmissive(material, &values[0], &values[1], &values[2]);