Commit bf26c2c8 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Add a separate function for material initialization.

parent c892ed49
......@@ -4432,11 +4432,7 @@ static HRESULT WINAPI d3d3_CreateMaterial(IDirect3D3 *iface, IDirect3DMaterial3
return DDERR_OUTOFMEMORY;
}
object->lpVtbl = &IDirect3DMaterial3_Vtbl;
object->IDirect3DMaterial2_vtbl = &IDirect3DMaterial2_Vtbl;
object->IDirect3DMaterial_vtbl = &IDirect3DMaterial_Vtbl;
object->ref = 1;
object->ddraw = ddraw_from_d3d3(iface);
d3d_material_init(object, ddraw_from_d3d3(iface));
TRACE("Created material %p.\n", object);
*material = (IDirect3DMaterial3 *)object;
......
......@@ -548,13 +548,9 @@ struct IDirect3DMaterialImpl
DWORD Handle;
};
/* VTables in various versions */
extern const IDirect3DMaterialVtbl IDirect3DMaterial_Vtbl DECLSPEC_HIDDEN;
extern const IDirect3DMaterial2Vtbl IDirect3DMaterial2_Vtbl DECLSPEC_HIDDEN;
extern const IDirect3DMaterial3Vtbl IDirect3DMaterial3_Vtbl DECLSPEC_HIDDEN;
/* Helper functions */
void material_activate(IDirect3DMaterialImpl* This) DECLSPEC_HIDDEN;
void d3d_material_init(IDirect3DMaterialImpl *material, IDirectDrawImpl *ddraw) DECLSPEC_HIDDEN;
/*****************************************************************************
* IDirect3DViewport - Wraps to D3D7
......
......@@ -448,7 +448,7 @@ void material_activate(IDirect3DMaterialImpl* This)
IDirect3DDevice7_SetMaterial((IDirect3DDevice7 *)This->active_device, &d3d7mat);
}
const IDirect3DMaterial3Vtbl IDirect3DMaterial3_Vtbl =
static const struct IDirect3DMaterial3Vtbl d3d_material3_vtbl =
{
/*** IUnknown Methods ***/
IDirect3DMaterialImpl_QueryInterface,
......@@ -460,7 +460,7 @@ const IDirect3DMaterial3Vtbl IDirect3DMaterial3_Vtbl =
IDirect3DMaterialImpl_GetHandle,
};
const IDirect3DMaterial2Vtbl IDirect3DMaterial2_Vtbl =
static const struct IDirect3DMaterial2Vtbl d3d_material2_vtbl =
{
/*** IUnknown Methods ***/
Thunk_IDirect3DMaterialImpl_2_QueryInterface,
......@@ -472,7 +472,7 @@ const IDirect3DMaterial2Vtbl IDirect3DMaterial2_Vtbl =
Thunk_IDirect3DMaterialImpl_2_GetHandle,
};
const IDirect3DMaterialVtbl IDirect3DMaterial_Vtbl =
static const struct IDirect3DMaterialVtbl d3d_material1_vtbl =
{
/*** IUnknown Methods ***/
Thunk_IDirect3DMaterialImpl_1_QueryInterface,
......@@ -486,3 +486,12 @@ const IDirect3DMaterialVtbl IDirect3DMaterial_Vtbl =
IDirect3DMaterialImpl_Reserve,
IDirect3DMaterialImpl_Unreserve
};
void d3d_material_init(IDirect3DMaterialImpl *material, IDirectDrawImpl *ddraw)
{
material->lpVtbl = &d3d_material3_vtbl;
material->IDirect3DMaterial2_vtbl = &d3d_material2_vtbl;
material->IDirect3DMaterial_vtbl = &d3d_material1_vtbl;
material->ref = 1;
material->ddraw = ddraw;
}
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