[D3D] Implemented IDirect3DDevice{2,3}::GetLightState
Christian Costa
titan.costa at wanadoo.fr
Thu Aug 5 05:04:54 CDT 2004
Hi,
Changelog:
Implemented IDirect3DDevice{2,3}::GetLightState.
Fixed traces in execute buffers.
Updated copyright info.
-------------- next part --------------
Index: d3d_private.h
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/d3d_private.h,v
retrieving revision 1.40
diff -u -r1.40 d3d_private.h
--- d3d_private.h 2 Aug 2004 18:24:40 -0000 1.40
+++ d3d_private.h 5 Aug 2004 08:52:29 -0000
@@ -1,5 +1,6 @@
/* 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
* through d3d.h and all common macros.
@@ -195,6 +196,7 @@
ICOM_VFIELD_MULTI(IDirect3DDevice2);
ICOM_VFIELD_MULTI(IDirect3DDevice);
DWORD ref;
+
/* IDirect3DDevice fields */
IDirectDrawImpl *d3d;
IDirectDrawSurfaceImpl *surface;
@@ -215,6 +217,9 @@
/* Current material used in D3D7 mode */
D3DMATERIAL7 current_material;
+
+ /* Light state */
+ DWORD material;
/* Light parameters */
DWORD active_lights, set_lights;
Index: d3dexecutebuffer.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/d3dexecutebuffer.c,v
retrieving revision 1.37
diff -u -r1.37 d3dexecutebuffer.c
--- d3dexecutebuffer.c 2 Aug 2004 18:26:53 -0000 1.37
+++ d3dexecutebuffer.c 5 Aug 2004 08:52:33 -0000
@@ -331,8 +331,8 @@
dump_D3DMATRIX(lpDevice->proj_mat);
TRACE(" View Matrix : (%p)\n", lpDevice->view_mat);
dump_D3DMATRIX(lpDevice->view_mat);
- TRACE(" World Matrix : (%p)\n", &mat);
- dump_D3DMATRIX(&mat);
+ TRACE(" World Matrix : (%p)\n", lpDevice->world_mat);
+ dump_D3DMATRIX(lpDevice->world_mat);
}
multiply_matrix(&mat,lpDevice->view_mat,lpDevice->world_mat);
Index: d3ddevice/main.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/d3ddevice/main.c,v
retrieving revision 1.50
diff -u -r1.50 main.c
--- d3ddevice/main.c 14 Oct 2003 01:16:42 -0000 1.50
+++ d3ddevice/main.c 5 Aug 2004 08:52:46 -0000
@@ -1,5 +1,6 @@
/* 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.
*
Index: d3ddevice/mesa.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/d3ddevice/mesa.c,v
retrieving revision 1.156
diff -u -r1.156 mesa.c
--- d3ddevice/mesa.c 30 Jul 2004 18:54:32 -0000 1.156
+++ d3ddevice/mesa.c 5 Aug 2004 08:53:10 -0000
@@ -1,5 +1,6 @@
/* 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
* Wine supports.
@@ -724,6 +725,57 @@
}
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
GL_IDirect3DDeviceImpl_3_2T_SetLightState(LPDIRECT3DDEVICE3 iface,
D3DLIGHTSTATETYPE dwLightStateType,
DWORD dwLightState)
@@ -746,6 +798,7 @@
} else {
FIXME(" D3DLIGHTSTATE_MATERIAL called with NULL material !!!\n");
}
+ This->material = dwLightState;
} else if (dwLightStateType == D3DLIGHTSTATE_COLORMODEL /* 3 */) {
switch (dwLightState) {
case D3DCOLOR_MONO:
@@ -2608,7 +2661,7 @@
XCAST(End) Main_IDirect3DDeviceImpl_3_2T_End,
XCAST(GetRenderState) Thunk_IDirect3DDeviceImpl_3_GetRenderState,
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(SetTransform) Thunk_IDirect3DDeviceImpl_3_SetTransform,
XCAST(GetTransform) Thunk_IDirect3DDeviceImpl_3_GetTransform,
More information about the wine-patches
mailing list