1999-01-03 17:00:19 +00:00
|
|
|
/* Direct3D private include file
|
2002-03-09 23:29:33 +00:00
|
|
|
* Copyright (c) 1998 Lionel ULMER
|
|
|
|
*
|
|
|
|
* This file contains all the structure that are not exported
|
|
|
|
* through d3d.h and all common macros.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
1999-01-03 17:00:19 +00:00
|
|
|
|
1999-03-27 16:53:09 +00:00
|
|
|
#ifndef __GRAPHICS_WINE_D3D_PRIVATE_H
|
|
|
|
#define __GRAPHICS_WINE_D3D_PRIVATE_H
|
1999-01-03 17:00:19 +00:00
|
|
|
|
2000-04-09 14:30:50 +00:00
|
|
|
/* THIS FILE MUST NOT CONTAIN X11 or MESA DEFINES */
|
1999-05-13 18:53:05 +00:00
|
|
|
|
2000-04-09 14:30:50 +00:00
|
|
|
#include "d3d.h"
|
1999-05-13 18:53:05 +00:00
|
|
|
|
1999-03-27 16:53:09 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
* Predeclare the interface implementation structures
|
|
|
|
*/
|
|
|
|
typedef struct IDirect3DImpl IDirect3DImpl;
|
|
|
|
typedef struct IDirect3DLightImpl IDirect3DLightImpl;
|
2002-11-21 21:04:16 +00:00
|
|
|
typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl;
|
|
|
|
typedef struct IDirect3DViewportImpl IDirect3DViewportImpl;
|
1999-03-27 16:53:09 +00:00
|
|
|
typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
|
|
|
|
typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl;
|
2002-11-21 21:04:16 +00:00
|
|
|
typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
|
1999-03-27 16:53:09 +00:00
|
|
|
|
1999-04-06 07:10:48 +00:00
|
|
|
#include "ddraw_private.h"
|
1999-03-27 16:53:09 +00:00
|
|
|
|
|
|
|
/*****************************************************************************
|
2002-11-21 21:04:16 +00:00
|
|
|
* IDirect3D implementation structure.
|
|
|
|
* This is common for interfaces 1, 2, 3 and 7.
|
1999-03-27 16:53:09 +00:00
|
|
|
*/
|
|
|
|
struct IDirect3DImpl
|
|
|
|
{
|
2002-11-21 21:04:16 +00:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3D7);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3D3);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3D2);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3D);
|
1999-03-27 16:53:09 +00:00
|
|
|
DWORD ref;
|
|
|
|
/* IDirect3D fields */
|
2000-04-09 14:30:50 +00:00
|
|
|
IDirectDrawImpl* ddraw;
|
2002-12-15 01:17:59 +00:00
|
|
|
|
|
|
|
/* Used as a callback function to create a texture */
|
2003-01-02 19:39:57 +00:00
|
|
|
HRESULT (*create_texture)(IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *tex, BOOLEAN at_creation, IDirectDrawSurfaceImpl *main);
|
|
|
|
|
|
|
|
/* Used as a callback for Devices to tell to the D3D object it's been created */
|
|
|
|
HRESULT (*added_device)(IDirect3DImpl *d3d, IDirect3DDeviceImpl *device);
|
|
|
|
HRESULT (*removed_device)(IDirect3DImpl *d3d, IDirect3DDeviceImpl *device);
|
2003-01-02 19:58:21 +00:00
|
|
|
|
|
|
|
/* This is needed for delayed texture creation and Z buffer blits */
|
|
|
|
IDirect3DDeviceImpl *current_device;
|
1999-03-27 16:53:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DLight implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirect3DLightImpl
|
|
|
|
{
|
2002-11-21 21:04:16 +00:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3DLight);
|
|
|
|
DWORD ref;
|
1999-03-27 16:53:09 +00:00
|
|
|
/* IDirect3DLight fields */
|
2002-11-21 21:04:16 +00:00
|
|
|
IDirect3DImpl *d3d;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
D3DLIGHT2 light;
|
1999-03-27 16:53:09 +00:00
|
|
|
|
|
|
|
/* Chained list used for adding / removing from viewports */
|
2002-11-21 21:04:16 +00:00
|
|
|
IDirect3DLightImpl *next;
|
1999-03-27 16:53:09 +00:00
|
|
|
|
|
|
|
/* Activation function */
|
|
|
|
void (*activate)(IDirect3DLightImpl*);
|
2002-11-21 21:04:16 +00:00
|
|
|
void (*desactivate)(IDirect3DLightImpl*);
|
|
|
|
void (*update)(IDirect3DLightImpl*);
|
1999-03-27 16:53:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
2002-11-21 21:04:16 +00:00
|
|
|
* IDirect3DMaterial implementation structure
|
1999-03-27 16:53:09 +00:00
|
|
|
*/
|
2002-11-21 21:04:16 +00:00
|
|
|
struct IDirect3DMaterialImpl
|
1999-03-27 16:53:09 +00:00
|
|
|
{
|
2002-11-21 21:04:16 +00:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3DMaterial3);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3DMaterial2);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3DMaterial);
|
|
|
|
DWORD ref;
|
1999-03-27 16:53:09 +00:00
|
|
|
/* IDirect3DMaterial2 fields */
|
2002-11-21 21:04:16 +00:00
|
|
|
IDirect3DImpl *d3d;
|
|
|
|
IDirect3DDeviceImpl *active_device;
|
1999-03-27 16:53:09 +00:00
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
D3DMATERIAL mat;
|
1999-03-27 16:53:09 +00:00
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
void (*activate)(IDirect3DMaterialImpl* this);
|
1999-03-27 16:53:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
2002-11-21 21:04:16 +00:00
|
|
|
* IDirect3DViewport implementation structure
|
1999-03-27 16:53:09 +00:00
|
|
|
*/
|
2002-11-21 21:04:16 +00:00
|
|
|
struct IDirect3DViewportImpl
|
1999-03-27 16:53:09 +00:00
|
|
|
{
|
2002-11-21 21:04:16 +00:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3DViewport3);
|
|
|
|
DWORD ref;
|
|
|
|
/* IDirect3DViewport fields */
|
|
|
|
IDirect3DImpl *d3d;
|
1999-03-27 16:53:09 +00:00
|
|
|
/* If this viewport is active for one device, put the device here */
|
2002-11-21 21:04:16 +00:00
|
|
|
IDirect3DDeviceImpl *active_device;
|
1999-03-27 16:53:09 +00:00
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
int use_vp2;
|
1999-03-27 16:53:09 +00:00
|
|
|
union {
|
2002-11-21 21:04:16 +00:00
|
|
|
D3DVIEWPORT vp1;
|
|
|
|
D3DVIEWPORT2 vp2;
|
|
|
|
} viewports;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
/* Activation function */
|
|
|
|
void (*activate)(IDirect3DViewportImpl*);
|
1999-03-27 16:53:09 +00:00
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
/* Field used to chain viewports together */
|
|
|
|
IDirect3DViewportImpl *next;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
/* Lights list */
|
|
|
|
IDirect3DLightImpl *lights;
|
2002-12-24 01:07:21 +00:00
|
|
|
|
|
|
|
/* Background material */
|
|
|
|
IDirect3DMaterialImpl *background;
|
1999-03-27 16:53:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DExecuteBuffer implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirect3DExecuteBufferImpl
|
|
|
|
{
|
2002-11-21 21:04:16 +00:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3DExecuteBuffer);
|
|
|
|
DWORD ref;
|
1999-03-27 16:53:09 +00:00
|
|
|
/* IDirect3DExecuteBuffer fields */
|
2002-11-21 21:04:16 +00:00
|
|
|
IDirect3DImpl *d3d;
|
1999-03-27 16:53:09 +00:00
|
|
|
IDirect3DDeviceImpl* d3ddev;
|
|
|
|
|
|
|
|
D3DEXECUTEBUFFERDESC desc;
|
|
|
|
D3DEXECUTEDATA data;
|
|
|
|
|
|
|
|
/* This buffer will store the transformed vertices */
|
|
|
|
void* vertex_data;
|
|
|
|
D3DVERTEXTYPE vertex_type;
|
|
|
|
|
|
|
|
/* This flags is set to TRUE if we allocated ourselves the
|
|
|
|
data buffer */
|
|
|
|
BOOL need_free;
|
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
void (*execute)(IDirect3DExecuteBufferImpl* this,
|
|
|
|
IDirect3DDeviceImpl* dev,
|
|
|
|
IDirect3DViewportImpl* vp);
|
1999-03-27 16:53:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DDevice implementation structure
|
|
|
|
*/
|
2002-12-02 18:59:11 +00:00
|
|
|
|
|
|
|
#define MAX_TEXTURES 8
|
2003-01-02 20:01:54 +00:00
|
|
|
#define MAX_LIGHTS 16
|
2002-12-02 18:59:11 +00:00
|
|
|
|
2003-01-03 21:05:38 +00:00
|
|
|
#define WORLDMAT_CHANGED (0x00000001 << 0)
|
|
|
|
#define VIEWMAT_CHANGED (0x00000001 << 1)
|
|
|
|
#define PROJMAT_CHANGED (0x00000001 << 2)
|
|
|
|
|
1999-03-27 16:53:09 +00:00
|
|
|
struct IDirect3DDeviceImpl
|
|
|
|
{
|
2002-11-21 21:04:16 +00:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3DDevice7);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3DDevice3);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3DDevice2);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3DDevice);
|
|
|
|
DWORD ref;
|
1999-03-27 16:53:09 +00:00
|
|
|
/* IDirect3DDevice fields */
|
2002-11-21 21:04:16 +00:00
|
|
|
IDirect3DImpl *d3d;
|
|
|
|
IDirectDrawSurfaceImpl *surface;
|
1999-03-27 16:53:09 +00:00
|
|
|
|
2002-11-21 21:04:16 +00:00
|
|
|
IDirect3DViewportImpl *viewport_list;
|
|
|
|
IDirect3DViewportImpl *current_viewport;
|
2002-12-24 01:00:45 +00:00
|
|
|
D3DVIEWPORT7 active_viewport;
|
|
|
|
|
2002-12-15 01:17:59 +00:00
|
|
|
IDirectDrawSurfaceImpl *current_texture[MAX_TEXTURES];
|
1999-03-27 16:53:09 +00:00
|
|
|
|
2003-01-02 19:53:43 +00:00
|
|
|
/* Current transformation matrices */
|
|
|
|
D3DMATRIX *world_mat;
|
|
|
|
D3DMATRIX *view_mat;
|
|
|
|
D3DMATRIX *proj_mat;
|
|
|
|
|
2003-01-02 20:01:54 +00:00
|
|
|
/* Current material used in D3D7 mode */
|
|
|
|
D3DMATERIAL7 current_material;
|
|
|
|
|
|
|
|
/* Light parameters */
|
|
|
|
DWORD active_lights, set_lights;
|
|
|
|
D3DLIGHT7 light_parameters[MAX_LIGHTS];
|
|
|
|
|
1999-03-27 16:53:09 +00:00
|
|
|
void (*set_context)(IDirect3DDeviceImpl*);
|
2002-12-24 01:03:04 +00:00
|
|
|
HRESULT (*clear)(IDirect3DDeviceImpl *This,
|
|
|
|
DWORD dwCount,
|
|
|
|
LPD3DRECT lpRects,
|
|
|
|
DWORD dwFlags,
|
|
|
|
DWORD dwColor,
|
|
|
|
D3DVALUE dvZ,
|
|
|
|
DWORD dwStencil);
|
2003-01-03 21:05:38 +00:00
|
|
|
void (*matrices_updated)(IDirect3DDeviceImpl *This, DWORD matrices);
|
|
|
|
void (*set_matrices)(IDirect3DDeviceImpl *This, DWORD matrices,
|
|
|
|
D3DMATRIX *world_mat, D3DMATRIX *view_mat, D3DMATRIX *proj_mat);
|
1999-03-27 16:53:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
2002-11-21 21:04:16 +00:00
|
|
|
* IDirect3DVertexBuffer implementation structure
|
1999-03-27 16:53:09 +00:00
|
|
|
*/
|
2002-11-21 21:04:16 +00:00
|
|
|
struct IDirect3DVertexBufferImpl
|
1999-03-27 16:53:09 +00:00
|
|
|
{
|
2002-11-21 21:04:16 +00:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3DVertexBuffer7);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3DVertexBuffer);
|
|
|
|
DWORD ref;
|
|
|
|
IDirect3DImpl *d3d;
|
2002-11-30 19:27:19 +00:00
|
|
|
D3DVERTEXBUFFERDESC desc;
|
|
|
|
LPVOID *vertices;
|
|
|
|
DWORD vertex_buffer_size;
|
2003-01-03 21:07:22 +00:00
|
|
|
|
|
|
|
BOOLEAN processed;
|
1999-03-27 16:53:09 +00:00
|
|
|
};
|
1999-01-03 17:00:19 +00:00
|
|
|
|
2003-01-03 21:05:38 +00:00
|
|
|
/* Various dump and helper functions */
|
2002-10-10 22:47:02 +00:00
|
|
|
extern const char *_get_renderstate(D3DRENDERSTATETYPE type);
|
2003-01-02 20:01:54 +00:00
|
|
|
extern void dump_D3DMATERIAL7(LPD3DMATERIAL7 lpMat);
|
|
|
|
extern void dump_D3DCOLORVALUE(D3DCOLORVALUE *lpCol);
|
|
|
|
extern void dump_D3DLIGHT7(LPD3DLIGHT7 lpLight);
|
2003-01-03 19:10:48 +00:00
|
|
|
extern void dump_DPFLAGS(DWORD dwFlags);
|
2003-01-03 21:05:38 +00:00
|
|
|
extern void dump_D3DMATRIX(D3DMATRIX *mat);
|
|
|
|
extern void dump_D3DVECTOR(D3DVECTOR *lpVec);
|
|
|
|
extern void dump_flexible_vertex(DWORD d3dvtVertexType);
|
2003-01-03 21:07:22 +00:00
|
|
|
extern DWORD get_flexible_vertex_size(DWORD d3dvtVertexType);
|
|
|
|
extern void convert_FVF_to_strided_data(DWORD d3dvtVertexType, LPVOID lpvVertices, D3DDRAWPRIMITIVESTRIDEDDATA *strided);
|
|
|
|
extern void dump_D3DVOP(DWORD dwVertexOp);
|
|
|
|
extern void dump_D3DPV(DWORD dwFlags);
|
|
|
|
|
|
|
|
extern const float id_mat[16];
|
2000-04-09 14:30:50 +00:00
|
|
|
|
1999-03-27 16:53:09 +00:00
|
|
|
#endif /* __GRAPHICS_WINE_D3D_PRIVATE_H */
|