Commit 3d6154aa authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

Implement Begin/Vertex/End rendering functions.

parent 240e7624
/* Direct3D private include file
* Copyright (c) 1998-2004 Lionel ULMER
* Copyright (c) 2002-2004 Christian Costa
/*
* Direct3D private include file
*
* Copyright (c) 1998-2004 Lionel Ulmer
* Copyright (c) 2002-2005 Christian Costa
*
* This file contains all the structure that are not exported
* through d3d.h and all common macros.
......@@ -230,7 +232,7 @@ struct IDirect3DDeviceImpl
LPD3DLIGHT7 light_parameters;
DWORD *active_lights;
/* clipping planes */
/* Clipping planes */
DWORD max_clipping_planes;
d3d7clippingplane *clipping_planes;
......@@ -251,6 +253,15 @@ struct IDirect3DDeviceImpl
/* Used to prevent locks and rendering to overlap */
CRITICAL_SECTION crit;
/* Rendering functions */
D3DPRIMITIVETYPE primitive_type;
DWORD vertex_type;
DWORD render_flags;
DWORD nb_vertices;
LPBYTE vertex_buffer;
DWORD vertex_size;
DWORD buffer_size;
};
/*****************************************************************************
......
/* Direct3D Device
* Copyright (c) 1998-2004 Lionel ULMER
* Copyright (c) 2002-2004 Christian Costa
/*
* Direct3D Device
*
* Copyright (c) 1998-2004 Lionel Ulmer
* Copyright (c) 2002-2005 Christian Costa
*
* This file contains all the common stuff for D3D devices.
*
......@@ -284,7 +286,7 @@ Main_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
if (This->current_texture[i] != NULL)
IDirect3DTexture2_Release(ICOM_INTERFACE(This->current_texture[i], IDirect3DTexture2));
}
HeapFree(GetProcessHeap(), 0, This->vertex_buffer);
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
......@@ -1175,8 +1177,15 @@ Main_IDirect3DDeviceImpl_3_Begin(LPDIRECT3DDEVICE3 iface,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
FIXME("(%p/%p)->(%08x,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, dwVertexTypeDesc, dwFlags);
return DD_OK;
TRACE("(%p/%p)->(%08x,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, dwVertexTypeDesc, dwFlags);
This->primitive_type = d3dptPrimitiveType;
This->vertex_type = dwVertexTypeDesc;
This->render_flags = dwFlags;
This->vertex_size = get_flexible_vertex_size(This->vertex_type);
This->nb_vertices = 0;
return D3D_OK;
}
HRESULT WINAPI
......@@ -1197,8 +1206,24 @@ Main_IDirect3DDeviceImpl_3_2T_Vertex(LPDIRECT3DDEVICE3 iface,
LPVOID lpVertexType)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpVertexType);
return DD_OK;
TRACE("(%p/%p)->(%p)\n", This, iface, lpVertexType);
if ((This->nb_vertices+1)*This->vertex_size > This->buffer_size)
{
LPBYTE old_buffer;
This->buffer_size = This->buffer_size ? This->buffer_size * 2 : This->vertex_size * 3;
old_buffer = This->vertex_buffer;
This->vertex_buffer = HeapAlloc(GetProcessHeap(), 0, This->buffer_size);
if (old_buffer)
{
CopyMemory(This->vertex_buffer, old_buffer, This->nb_vertices * This->vertex_size);
HeapFree(GetProcessHeap(), 0, old_buffer);
}
}
CopyMemory(This->vertex_buffer + This->nb_vertices++ * This->vertex_size, lpVertexType, This->vertex_size);
return D3D_OK;
}
HRESULT WINAPI
......@@ -1215,8 +1240,11 @@ Main_IDirect3DDeviceImpl_3_2T_End(LPDIRECT3DDEVICE3 iface,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface);
FIXME("(%p/%p)->(%08lx): stub!\n", This, iface, dwFlags);
return DD_OK;
TRACE("(%p/%p)->(%08lx)\n", This, iface, dwFlags);
IDirect3DDevice3_DrawPrimitive(iface, This->primitive_type, This->vertex_type, This->vertex_buffer, This->nb_vertices, This->render_flags);
return D3D_OK;
}
HRESULT WINAPI
......
/* Direct3D Device
* Copyright (c) 1998-2004 Lionel ULMER
* Copyright (c) 2002-2004 Christian Costa
/*
* Direct3D Device
*
* Copyright (c) 1998-2004 Lionel Ulmer
* Copyright (c) 2002-2005 Christian Costa
*
* This file contains the MESA implementation of all the D3D devices that
* Wine supports.
......@@ -427,7 +429,6 @@ GL_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
This->d3d->d3d_removed_device(This->d3d, This);
/* Free light arrays */
if (This->light_parameters)
HeapFree(GetProcessHeap(), 0, This->light_parameters);
HeapFree(GetProcessHeap(), 0, This->active_lights);
......@@ -435,7 +436,6 @@ GL_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
HeapFree(GetProcessHeap(), 0, This->view_mat);
HeapFree(GetProcessHeap(), 0, This->proj_mat);
if (glThis->surface_ptr)
HeapFree(GetProcessHeap(), 0, glThis->surface_ptr);
DeleteCriticalSection(&(This->crit));
......@@ -446,6 +446,7 @@ GL_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
glXDestroyContext(glThis->display, glThis->gl_context);
LEAVE_GL();
HeapFree(GetProcessHeap(), 0, This->clipping_planes);
HeapFree(GetProcessHeap(), 0, This->vertex_buffer);
HeapFree(GetProcessHeap(), 0, This);
return 0;
......
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