Implemented IDirect3DDevice{2,3}::GetLightState.
Fixed traces in execute buffers. Updated copyright info.
This commit is contained in:
parent
4604e66094
commit
479c13b84e
|
@ -1,5 +1,6 @@
|
||||||
/* Direct3D private include file
|
/* Direct3D private include file
|
||||||
* Copyright (c) 1998 Lionel ULMER
|
* Copyright (c) 1998-2004 Lionel ULMER
|
||||||
|
* Copyright (c) 2002-2004 Christian Costa
|
||||||
*
|
*
|
||||||
* This file contains all the structure that are not exported
|
* This file contains all the structure that are not exported
|
||||||
* through d3d.h and all common macros.
|
* through d3d.h and all common macros.
|
||||||
|
@ -195,6 +196,7 @@ struct IDirect3DDeviceImpl
|
||||||
ICOM_VFIELD_MULTI(IDirect3DDevice2);
|
ICOM_VFIELD_MULTI(IDirect3DDevice2);
|
||||||
ICOM_VFIELD_MULTI(IDirect3DDevice);
|
ICOM_VFIELD_MULTI(IDirect3DDevice);
|
||||||
DWORD ref;
|
DWORD ref;
|
||||||
|
|
||||||
/* IDirect3DDevice fields */
|
/* IDirect3DDevice fields */
|
||||||
IDirectDrawImpl *d3d;
|
IDirectDrawImpl *d3d;
|
||||||
IDirectDrawSurfaceImpl *surface;
|
IDirectDrawSurfaceImpl *surface;
|
||||||
|
@ -216,6 +218,9 @@ struct IDirect3DDeviceImpl
|
||||||
/* Current material used in D3D7 mode */
|
/* Current material used in D3D7 mode */
|
||||||
D3DMATERIAL7 current_material;
|
D3DMATERIAL7 current_material;
|
||||||
|
|
||||||
|
/* Light state */
|
||||||
|
DWORD material;
|
||||||
|
|
||||||
/* Light parameters */
|
/* Light parameters */
|
||||||
DWORD active_lights, set_lights;
|
DWORD active_lights, set_lights;
|
||||||
D3DLIGHT7 light_parameters[MAX_LIGHTS];
|
D3DLIGHT7 light_parameters[MAX_LIGHTS];
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* Direct3D Device
|
/* Direct3D Device
|
||||||
* Copyright (c) 1998 Lionel ULMER
|
* Copyright (c) 1998-2004 Lionel ULMER
|
||||||
|
* Copyright (c) 2002-2004 Christian Costa
|
||||||
*
|
*
|
||||||
* This file contains all the common stuff for D3D devices.
|
* This file contains all the common stuff for D3D devices.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* Direct3D Device
|
/* Direct3D Device
|
||||||
* Copyright (c) 1998 Lionel ULMER
|
* Copyright (c) 1998-2004 Lionel ULMER
|
||||||
|
* Copyright (c) 2002-2004 Christian Costa
|
||||||
*
|
*
|
||||||
* This file contains the MESA implementation of all the D3D devices that
|
* This file contains the MESA implementation of all the D3D devices that
|
||||||
* Wine supports.
|
* Wine supports.
|
||||||
|
@ -723,6 +724,57 @@ GL_IDirect3DDeviceImpl_7_3T_2T_GetRenderState(LPDIRECT3DDEVICE7 iface,
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI
|
||||||
|
GL_IDirect3DDeviceImpl_3_2T_GetLightState(LPDIRECT3DDEVICE3 iface,
|
||||||
|
D3DLIGHTSTATETYPE dwLightStateType,
|
||||||
|
LPDWORD lpdwLightState)
|
||||||
|
{
|
||||||
|
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
|
||||||
|
|
||||||
|
TRACE("(%p/%p)->(%08x,%p)\n", This, iface, dwLightStateType, lpdwLightState);
|
||||||
|
|
||||||
|
if (!dwLightStateType && (dwLightStateType > D3DLIGHTSTATE_COLORVERTEX)) {
|
||||||
|
TRACE("Unexpected Light State Type\n");
|
||||||
|
return DDERR_INVALIDPARAMS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dwLightStateType == D3DLIGHTSTATE_MATERIAL /* 1 */) {
|
||||||
|
*lpdwLightState = This->material;
|
||||||
|
} else if (dwLightStateType == D3DLIGHTSTATE_COLORMODEL /* 3 */) {
|
||||||
|
*lpdwLightState = D3DCOLOR_RGB;
|
||||||
|
} else {
|
||||||
|
D3DRENDERSTATETYPE rs;
|
||||||
|
switch (dwLightStateType) {
|
||||||
|
case D3DLIGHTSTATE_AMBIENT: /* 2 */
|
||||||
|
rs = D3DRENDERSTATE_AMBIENT;
|
||||||
|
break;
|
||||||
|
case D3DLIGHTSTATE_FOGMODE: /* 4 */
|
||||||
|
rs = D3DRENDERSTATE_FOGVERTEXMODE;
|
||||||
|
break;
|
||||||
|
case D3DLIGHTSTATE_FOGSTART: /* 5 */
|
||||||
|
rs = D3DRENDERSTATE_FOGSTART;
|
||||||
|
break;
|
||||||
|
case D3DLIGHTSTATE_FOGEND: /* 6 */
|
||||||
|
rs = D3DRENDERSTATE_FOGEND;
|
||||||
|
break;
|
||||||
|
case D3DLIGHTSTATE_FOGDENSITY: /* 7 */
|
||||||
|
rs = D3DRENDERSTATE_FOGDENSITY;
|
||||||
|
break;
|
||||||
|
case D3DLIGHTSTATE_COLORVERTEX: /* 8 */
|
||||||
|
rs = D3DRENDERSTATE_COLORVERTEX;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ERR("Unknown D3DLIGHTSTATETYPE %d.\n", dwLightStateType);
|
||||||
|
return DDERR_INVALIDPARAMS;
|
||||||
|
}
|
||||||
|
|
||||||
|
IDirect3DDevice7_GetRenderState(ICOM_INTERFACE(This, IDirect3DDevice7),
|
||||||
|
rs,lpdwLightState);
|
||||||
|
}
|
||||||
|
|
||||||
|
return DD_OK;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT WINAPI
|
HRESULT WINAPI
|
||||||
GL_IDirect3DDeviceImpl_3_2T_SetLightState(LPDIRECT3DDEVICE3 iface,
|
GL_IDirect3DDeviceImpl_3_2T_SetLightState(LPDIRECT3DDEVICE3 iface,
|
||||||
D3DLIGHTSTATETYPE dwLightStateType,
|
D3DLIGHTSTATETYPE dwLightStateType,
|
||||||
|
@ -746,6 +798,7 @@ GL_IDirect3DDeviceImpl_3_2T_SetLightState(LPDIRECT3DDEVICE3 iface,
|
||||||
} else {
|
} else {
|
||||||
FIXME(" D3DLIGHTSTATE_MATERIAL called with NULL material !!!\n");
|
FIXME(" D3DLIGHTSTATE_MATERIAL called with NULL material !!!\n");
|
||||||
}
|
}
|
||||||
|
This->material = dwLightState;
|
||||||
} else if (dwLightStateType == D3DLIGHTSTATE_COLORMODEL /* 3 */) {
|
} else if (dwLightStateType == D3DLIGHTSTATE_COLORMODEL /* 3 */) {
|
||||||
switch (dwLightState) {
|
switch (dwLightState) {
|
||||||
case D3DCOLOR_MONO:
|
case D3DCOLOR_MONO:
|
||||||
|
@ -1119,7 +1172,7 @@ inline static void handle_xyz(D3DVALUE *coords) {
|
||||||
glVertex3fv(coords);
|
glVertex3fv(coords);
|
||||||
}
|
}
|
||||||
inline static void handle_xyzrhw(D3DVALUE *coords) {
|
inline static void handle_xyzrhw(D3DVALUE *coords) {
|
||||||
if (coords[3] < 1e-8)
|
if ((coords[3] < 1e-8) && (coords[3] > -1e-8))
|
||||||
glVertex3fv(coords);
|
glVertex3fv(coords);
|
||||||
else {
|
else {
|
||||||
GLfloat w = 1.0 / coords[3];
|
GLfloat w = 1.0 / coords[3];
|
||||||
|
@ -2608,7 +2661,7 @@ ICOM_VTABLE(IDirect3DDevice3) VTABLE_IDirect3DDevice3 =
|
||||||
XCAST(End) Main_IDirect3DDeviceImpl_3_2T_End,
|
XCAST(End) Main_IDirect3DDeviceImpl_3_2T_End,
|
||||||
XCAST(GetRenderState) Thunk_IDirect3DDeviceImpl_3_GetRenderState,
|
XCAST(GetRenderState) Thunk_IDirect3DDeviceImpl_3_GetRenderState,
|
||||||
XCAST(SetRenderState) Thunk_IDirect3DDeviceImpl_3_SetRenderState,
|
XCAST(SetRenderState) Thunk_IDirect3DDeviceImpl_3_SetRenderState,
|
||||||
XCAST(GetLightState) Main_IDirect3DDeviceImpl_3_2T_GetLightState,
|
XCAST(GetLightState) GL_IDirect3DDeviceImpl_3_2T_GetLightState,
|
||||||
XCAST(SetLightState) GL_IDirect3DDeviceImpl_3_2T_SetLightState,
|
XCAST(SetLightState) GL_IDirect3DDeviceImpl_3_2T_SetLightState,
|
||||||
XCAST(SetTransform) Thunk_IDirect3DDeviceImpl_3_SetTransform,
|
XCAST(SetTransform) Thunk_IDirect3DDeviceImpl_3_SetTransform,
|
||||||
XCAST(GetTransform) Thunk_IDirect3DDeviceImpl_3_GetTransform,
|
XCAST(GetTransform) Thunk_IDirect3DDeviceImpl_3_GetTransform,
|
||||||
|
|
|
@ -331,8 +331,8 @@ static void execute(IDirect3DExecuteBufferImpl *This,
|
||||||
dump_D3DMATRIX(lpDevice->proj_mat);
|
dump_D3DMATRIX(lpDevice->proj_mat);
|
||||||
TRACE(" View Matrix : (%p)\n", lpDevice->view_mat);
|
TRACE(" View Matrix : (%p)\n", lpDevice->view_mat);
|
||||||
dump_D3DMATRIX(lpDevice->view_mat);
|
dump_D3DMATRIX(lpDevice->view_mat);
|
||||||
TRACE(" World Matrix : (%p)\n", &mat);
|
TRACE(" World Matrix : (%p)\n", lpDevice->world_mat);
|
||||||
dump_D3DMATRIX(&mat);
|
dump_D3DMATRIX(lpDevice->world_mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
multiply_matrix(&mat,lpDevice->view_mat,lpDevice->world_mat);
|
multiply_matrix(&mat,lpDevice->view_mat,lpDevice->world_mat);
|
||||||
|
|
Loading…
Reference in New Issue