1999-01-03 18:00:19 +01:00
|
|
|
/* Direct3D private include file
|
2002-03-10 00:29:33 +01: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 18:00:19 +01:00
|
|
|
|
1999-03-27 17:53:09 +01:00
|
|
|
#ifndef __GRAPHICS_WINE_D3D_PRIVATE_H
|
|
|
|
#define __GRAPHICS_WINE_D3D_PRIVATE_H
|
1999-01-03 18:00:19 +01:00
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
/* THIS FILE MUST NOT CONTAIN X11 or MESA DEFINES */
|
1999-05-13 20:53:05 +02:00
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
#include "d3d.h"
|
1999-05-13 20:53:05 +02:00
|
|
|
|
2003-01-08 00:08:31 +01:00
|
|
|
#define MAX_TEXTURES 8
|
|
|
|
#define MAX_LIGHTS 16
|
|
|
|
|
2003-01-03 22:08:50 +01:00
|
|
|
#define HIGHEST_RENDER_STATE 152
|
|
|
|
#define HIGHEST_TEXTURE_STAGE_STATE 24
|
|
|
|
|
1999-03-27 17:53:09 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* Predeclare the interface implementation structures
|
|
|
|
*/
|
|
|
|
typedef struct IDirect3DImpl IDirect3DImpl;
|
|
|
|
typedef struct IDirect3DLightImpl IDirect3DLightImpl;
|
2002-11-21 22:04:16 +01:00
|
|
|
typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl;
|
|
|
|
typedef struct IDirect3DViewportImpl IDirect3DViewportImpl;
|
1999-03-27 17:53:09 +01:00
|
|
|
typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
|
|
|
|
typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl;
|
2002-11-21 22:04:16 +01:00
|
|
|
typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
|
1999-03-27 17:53:09 +01:00
|
|
|
|
1999-04-06 09:10:48 +02:00
|
|
|
#include "ddraw_private.h"
|
1999-03-27 17:53:09 +01:00
|
|
|
|
2003-01-03 22:08:50 +01:00
|
|
|
typedef struct STATEBLOCKFLAGS {
|
|
|
|
BOOL render_state[HIGHEST_RENDER_STATE];
|
2003-01-08 00:08:31 +01:00
|
|
|
BOOL texture_stage_state[MAX_TEXTURES][HIGHEST_TEXTURE_STAGE_STATE];
|
2003-01-03 22:08:50 +01:00
|
|
|
} STATEBLOCKFLAGS;
|
|
|
|
|
|
|
|
typedef struct STATEBLOCK {
|
|
|
|
STATEBLOCKFLAGS set_flags;
|
|
|
|
DWORD render_state[HIGHEST_RENDER_STATE];
|
2003-01-08 00:08:31 +01:00
|
|
|
DWORD texture_stage_state[MAX_TEXTURES][HIGHEST_TEXTURE_STAGE_STATE];
|
2003-01-03 22:08:50 +01:00
|
|
|
} STATEBLOCK;
|
|
|
|
|
1999-03-27 17:53:09 +01:00
|
|
|
/*****************************************************************************
|
2002-11-21 22:04:16 +01:00
|
|
|
* IDirect3D implementation structure.
|
|
|
|
* This is common for interfaces 1, 2, 3 and 7.
|
1999-03-27 17:53:09 +01:00
|
|
|
*/
|
|
|
|
struct IDirect3DImpl
|
|
|
|
{
|
2002-11-21 22:04:16 +01:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3D7);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3D3);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3D2);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3D);
|
1999-03-27 17:53:09 +01:00
|
|
|
DWORD ref;
|
|
|
|
/* IDirect3D fields */
|
2000-04-09 16:30:50 +02:00
|
|
|
IDirectDrawImpl* ddraw;
|
2002-12-15 02:17:59 +01:00
|
|
|
|
|
|
|
/* Used as a callback function to create a texture */
|
2003-01-02 20:39:57 +01: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 20:58:21 +01:00
|
|
|
|
|
|
|
/* This is needed for delayed texture creation and Z buffer blits */
|
|
|
|
IDirect3DDeviceImpl *current_device;
|
1999-03-27 17:53:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DLight implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirect3DLightImpl
|
|
|
|
{
|
2002-11-21 22:04:16 +01:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3DLight);
|
|
|
|
DWORD ref;
|
1999-03-27 17:53:09 +01:00
|
|
|
/* IDirect3DLight fields */
|
2002-11-21 22:04:16 +01:00
|
|
|
IDirect3DImpl *d3d;
|
2003-01-21 00:24:05 +01:00
|
|
|
/* If this light is active for one viewport, put the viewport here */
|
|
|
|
IDirect3DViewportImpl *active_viewport;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-11-21 22:04:16 +01:00
|
|
|
D3DLIGHT2 light;
|
2003-01-21 00:24:05 +01:00
|
|
|
D3DLIGHT7 light7;
|
|
|
|
|
|
|
|
DWORD dwLightIndex;
|
1999-03-27 17:53:09 +01:00
|
|
|
|
|
|
|
/* Chained list used for adding / removing from viewports */
|
2002-11-21 22:04:16 +01:00
|
|
|
IDirect3DLightImpl *next;
|
1999-03-27 17:53:09 +01:00
|
|
|
|
|
|
|
/* Activation function */
|
|
|
|
void (*activate)(IDirect3DLightImpl*);
|
2002-11-21 22:04:16 +01:00
|
|
|
void (*desactivate)(IDirect3DLightImpl*);
|
|
|
|
void (*update)(IDirect3DLightImpl*);
|
1999-03-27 17:53:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
2002-11-21 22:04:16 +01:00
|
|
|
* IDirect3DMaterial implementation structure
|
1999-03-27 17:53:09 +01:00
|
|
|
*/
|
2002-11-21 22:04:16 +01:00
|
|
|
struct IDirect3DMaterialImpl
|
1999-03-27 17:53:09 +01:00
|
|
|
{
|
2002-11-21 22:04:16 +01:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3DMaterial3);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3DMaterial2);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3DMaterial);
|
|
|
|
DWORD ref;
|
1999-03-27 17:53:09 +01:00
|
|
|
/* IDirect3DMaterial2 fields */
|
2002-11-21 22:04:16 +01:00
|
|
|
IDirect3DImpl *d3d;
|
|
|
|
IDirect3DDeviceImpl *active_device;
|
1999-03-27 17:53:09 +01:00
|
|
|
|
2002-11-21 22:04:16 +01:00
|
|
|
D3DMATERIAL mat;
|
1999-03-27 17:53:09 +01:00
|
|
|
|
2002-11-21 22:04:16 +01:00
|
|
|
void (*activate)(IDirect3DMaterialImpl* this);
|
1999-03-27 17:53:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
2002-11-21 22:04:16 +01:00
|
|
|
* IDirect3DViewport implementation structure
|
1999-03-27 17:53:09 +01:00
|
|
|
*/
|
2002-11-21 22:04:16 +01:00
|
|
|
struct IDirect3DViewportImpl
|
1999-03-27 17:53:09 +01:00
|
|
|
{
|
2002-11-21 22:04:16 +01:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3DViewport3);
|
|
|
|
DWORD ref;
|
|
|
|
/* IDirect3DViewport fields */
|
|
|
|
IDirect3DImpl *d3d;
|
1999-03-27 17:53:09 +01:00
|
|
|
/* If this viewport is active for one device, put the device here */
|
2002-11-21 22:04:16 +01:00
|
|
|
IDirect3DDeviceImpl *active_device;
|
1999-03-27 17:53:09 +01:00
|
|
|
|
2003-01-21 00:24:05 +01:00
|
|
|
DWORD num_lights;
|
|
|
|
DWORD map_lights;
|
|
|
|
|
2002-11-21 22:04:16 +01:00
|
|
|
int use_vp2;
|
1999-03-27 17:53:09 +01:00
|
|
|
union {
|
2002-11-21 22:04:16 +01:00
|
|
|
D3DVIEWPORT vp1;
|
|
|
|
D3DVIEWPORT2 vp2;
|
|
|
|
} viewports;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-11-21 22:04:16 +01:00
|
|
|
/* Activation function */
|
|
|
|
void (*activate)(IDirect3DViewportImpl*);
|
1999-03-27 17:53:09 +01:00
|
|
|
|
2002-11-21 22:04:16 +01:00
|
|
|
/* Field used to chain viewports together */
|
|
|
|
IDirect3DViewportImpl *next;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-11-21 22:04:16 +01:00
|
|
|
/* Lights list */
|
|
|
|
IDirect3DLightImpl *lights;
|
2002-12-24 02:07:21 +01:00
|
|
|
|
|
|
|
/* Background material */
|
|
|
|
IDirect3DMaterialImpl *background;
|
1999-03-27 17:53:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DExecuteBuffer implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirect3DExecuteBufferImpl
|
|
|
|
{
|
2002-11-21 22:04:16 +01:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3DExecuteBuffer);
|
|
|
|
DWORD ref;
|
1999-03-27 17:53:09 +01:00
|
|
|
/* IDirect3DExecuteBuffer fields */
|
2002-11-21 22:04:16 +01:00
|
|
|
IDirect3DImpl *d3d;
|
1999-03-27 17:53:09 +01: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 22:04:16 +01:00
|
|
|
void (*execute)(IDirect3DExecuteBufferImpl* this,
|
|
|
|
IDirect3DDeviceImpl* dev,
|
|
|
|
IDirect3DViewportImpl* vp);
|
1999-03-27 17:53:09 +01:00
|
|
|
};
|
|
|
|
|
2003-01-07 20:42:26 +01:00
|
|
|
/* Internal structure to store the state of the clipping planes */
|
|
|
|
typedef struct d3d7clippingplane
|
|
|
|
{
|
|
|
|
D3DVALUE plane[4];
|
|
|
|
} d3d7clippingplane;
|
|
|
|
|
1999-03-27 17:53:09 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DDevice implementation structure
|
|
|
|
*/
|
2002-12-02 19:59:11 +01:00
|
|
|
|
2003-01-03 22:05:38 +01:00
|
|
|
#define WORLDMAT_CHANGED (0x00000001 << 0)
|
|
|
|
#define VIEWMAT_CHANGED (0x00000001 << 1)
|
|
|
|
#define PROJMAT_CHANGED (0x00000001 << 2)
|
|
|
|
|
1999-03-27 17:53:09 +01:00
|
|
|
struct IDirect3DDeviceImpl
|
|
|
|
{
|
2002-11-21 22:04:16 +01:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3DDevice7);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3DDevice3);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3DDevice2);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3DDevice);
|
|
|
|
DWORD ref;
|
1999-03-27 17:53:09 +01:00
|
|
|
/* IDirect3DDevice fields */
|
2002-11-21 22:04:16 +01:00
|
|
|
IDirect3DImpl *d3d;
|
|
|
|
IDirectDrawSurfaceImpl *surface;
|
1999-03-27 17:53:09 +01:00
|
|
|
|
2002-11-21 22:04:16 +01:00
|
|
|
IDirect3DViewportImpl *viewport_list;
|
|
|
|
IDirect3DViewportImpl *current_viewport;
|
2002-12-24 02:00:45 +01:00
|
|
|
D3DVIEWPORT7 active_viewport;
|
|
|
|
|
2002-12-15 02:17:59 +01:00
|
|
|
IDirectDrawSurfaceImpl *current_texture[MAX_TEXTURES];
|
1999-03-27 17:53:09 +01:00
|
|
|
|
2003-01-02 20:53:43 +01:00
|
|
|
/* Current transformation matrices */
|
|
|
|
D3DMATRIX *world_mat;
|
|
|
|
D3DMATRIX *view_mat;
|
|
|
|
D3DMATRIX *proj_mat;
|
|
|
|
|
2003-01-02 21:01:54 +01:00
|
|
|
/* Current material used in D3D7 mode */
|
|
|
|
D3DMATERIAL7 current_material;
|
|
|
|
|
|
|
|
/* Light parameters */
|
|
|
|
DWORD active_lights, set_lights;
|
|
|
|
D3DLIGHT7 light_parameters[MAX_LIGHTS];
|
|
|
|
|
2003-01-07 20:42:26 +01:00
|
|
|
/* clipping planes */
|
|
|
|
DWORD max_clipping_planes;
|
|
|
|
d3d7clippingplane *clipping_planes;
|
|
|
|
|
1999-03-27 17:53:09 +01:00
|
|
|
void (*set_context)(IDirect3DDeviceImpl*);
|
2002-12-24 02:03:04 +01:00
|
|
|
HRESULT (*clear)(IDirect3DDeviceImpl *This,
|
|
|
|
DWORD dwCount,
|
|
|
|
LPD3DRECT lpRects,
|
|
|
|
DWORD dwFlags,
|
|
|
|
DWORD dwColor,
|
|
|
|
D3DVALUE dvZ,
|
|
|
|
DWORD dwStencil);
|
2003-01-03 22:05:38 +01:00
|
|
|
void (*matrices_updated)(IDirect3DDeviceImpl *This, DWORD matrices);
|
|
|
|
void (*set_matrices)(IDirect3DDeviceImpl *This, DWORD matrices,
|
|
|
|
D3DMATRIX *world_mat, D3DMATRIX *view_mat, D3DMATRIX *proj_mat);
|
2003-01-03 22:08:50 +01:00
|
|
|
|
|
|
|
STATEBLOCK state_block;
|
1999-03-27 17:53:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************
|
2002-11-21 22:04:16 +01:00
|
|
|
* IDirect3DVertexBuffer implementation structure
|
1999-03-27 17:53:09 +01:00
|
|
|
*/
|
2002-11-21 22:04:16 +01:00
|
|
|
struct IDirect3DVertexBufferImpl
|
1999-03-27 17:53:09 +01:00
|
|
|
{
|
2002-11-21 22:04:16 +01:00
|
|
|
ICOM_VFIELD_MULTI(IDirect3DVertexBuffer7);
|
|
|
|
ICOM_VFIELD_MULTI(IDirect3DVertexBuffer);
|
|
|
|
DWORD ref;
|
|
|
|
IDirect3DImpl *d3d;
|
2002-11-30 20:27:19 +01:00
|
|
|
D3DVERTEXBUFFERDESC desc;
|
|
|
|
LPVOID *vertices;
|
|
|
|
DWORD vertex_buffer_size;
|
2003-01-03 22:07:22 +01:00
|
|
|
|
|
|
|
BOOLEAN processed;
|
1999-03-27 17:53:09 +01:00
|
|
|
};
|
1999-01-03 18:00:19 +01:00
|
|
|
|
2003-01-03 22:05:38 +01:00
|
|
|
/* Various dump and helper functions */
|
2002-10-11 00:47:02 +02:00
|
|
|
extern const char *_get_renderstate(D3DRENDERSTATETYPE type);
|
2003-01-02 21:01:54 +01:00
|
|
|
extern void dump_D3DMATERIAL7(LPD3DMATERIAL7 lpMat);
|
|
|
|
extern void dump_D3DCOLORVALUE(D3DCOLORVALUE *lpCol);
|
|
|
|
extern void dump_D3DLIGHT7(LPD3DLIGHT7 lpLight);
|
2003-01-03 20:10:48 +01:00
|
|
|
extern void dump_DPFLAGS(DWORD dwFlags);
|
2003-01-03 22:05:38 +01:00
|
|
|
extern void dump_D3DMATRIX(D3DMATRIX *mat);
|
|
|
|
extern void dump_D3DVECTOR(D3DVECTOR *lpVec);
|
|
|
|
extern void dump_flexible_vertex(DWORD d3dvtVertexType);
|
2003-01-03 22:07:22 +01:00
|
|
|
extern DWORD get_flexible_vertex_size(DWORD d3dvtVertexType);
|
2003-02-12 22:40:25 +01:00
|
|
|
extern void convert_FVF_to_strided_data(DWORD d3dvtVertexType, LPVOID lpvVertices, D3DDRAWPRIMITIVESTRIDEDDATA *strided, DWORD dwStartVertex);
|
2003-01-03 22:07:22 +01:00
|
|
|
extern void dump_D3DVOP(DWORD dwVertexOp);
|
|
|
|
extern void dump_D3DPV(DWORD dwFlags);
|
|
|
|
|
|
|
|
extern const float id_mat[16];
|
2000-04-09 16:30:50 +02:00
|
|
|
|
1999-03-27 17:53:09 +01:00
|
|
|
#endif /* __GRAPHICS_WINE_D3D_PRIVATE_H */
|