1 /* Direct3D private include file
2 * Copyright (c) 1998 Lionel ULMER
4 * This file contains all the structure that are not exported
5 * through d3d.h and all common macros.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __GRAPHICS_WINE_D3D_PRIVATE_H
23 #define __GRAPHICS_WINE_D3D_PRIVATE_H
25 /* THIS FILE MUST NOT CONTAIN X11 or MESA DEFINES */
29 /*****************************************************************************
30 * Predeclare the interface implementation structures
32 typedef struct IDirect3DImpl IDirect3DImpl
;
33 typedef struct IDirect3DLightImpl IDirect3DLightImpl
;
34 typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl
;
35 typedef struct IDirect3DViewportImpl IDirect3DViewportImpl
;
36 typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl
;
37 typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl
;
38 typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl
;
40 #include "ddraw_private.h"
42 /*****************************************************************************
43 * IDirect3D implementation structure.
44 * This is common for interfaces 1, 2, 3 and 7.
48 ICOM_VFIELD_MULTI(IDirect3D7
);
49 ICOM_VFIELD_MULTI(IDirect3D3
);
50 ICOM_VFIELD_MULTI(IDirect3D2
);
51 ICOM_VFIELD_MULTI(IDirect3D
);
53 /* IDirect3D fields */
54 IDirectDrawImpl
* ddraw
;
56 /* Used as a callback function to create a texture */
57 HRESULT (*create_texture
)(IDirect3DImpl
*d3d
, IDirectDrawSurfaceImpl
*tex
, BOOLEAN at_creation
, IDirectDrawSurfaceImpl
*main
);
59 /* Used as a callback for Devices to tell to the D3D object it's been created */
60 HRESULT (*added_device
)(IDirect3DImpl
*d3d
, IDirect3DDeviceImpl
*device
);
61 HRESULT (*removed_device
)(IDirect3DImpl
*d3d
, IDirect3DDeviceImpl
*device
);
63 /* This is needed for delayed texture creation and Z buffer blits */
64 IDirect3DDeviceImpl
*current_device
;
67 /*****************************************************************************
68 * IDirect3DLight implementation structure
70 struct IDirect3DLightImpl
72 ICOM_VFIELD_MULTI(IDirect3DLight
);
74 /* IDirect3DLight fields */
79 /* Chained list used for adding / removing from viewports */
80 IDirect3DLightImpl
*next
;
82 /* Activation function */
83 void (*activate
)(IDirect3DLightImpl
*);
84 void (*desactivate
)(IDirect3DLightImpl
*);
85 void (*update
)(IDirect3DLightImpl
*);
88 /*****************************************************************************
89 * IDirect3DMaterial implementation structure
91 struct IDirect3DMaterialImpl
93 ICOM_VFIELD_MULTI(IDirect3DMaterial3
);
94 ICOM_VFIELD_MULTI(IDirect3DMaterial2
);
95 ICOM_VFIELD_MULTI(IDirect3DMaterial
);
97 /* IDirect3DMaterial2 fields */
99 IDirect3DDeviceImpl
*active_device
;
103 void (*activate
)(IDirect3DMaterialImpl
* this);
106 /*****************************************************************************
107 * IDirect3DViewport implementation structure
109 struct IDirect3DViewportImpl
111 ICOM_VFIELD_MULTI(IDirect3DViewport3
);
113 /* IDirect3DViewport fields */
115 /* If this viewport is active for one device, put the device here */
116 IDirect3DDeviceImpl
*active_device
;
124 /* Activation function */
125 void (*activate
)(IDirect3DViewportImpl
*);
127 /* Field used to chain viewports together */
128 IDirect3DViewportImpl
*next
;
131 IDirect3DLightImpl
*lights
;
133 /* Background material */
134 IDirect3DMaterialImpl
*background
;
137 /*****************************************************************************
138 * IDirect3DExecuteBuffer implementation structure
140 struct IDirect3DExecuteBufferImpl
142 ICOM_VFIELD_MULTI(IDirect3DExecuteBuffer
);
144 /* IDirect3DExecuteBuffer fields */
146 IDirect3DDeviceImpl
* d3ddev
;
148 D3DEXECUTEBUFFERDESC desc
;
151 /* This buffer will store the transformed vertices */
153 D3DVERTEXTYPE vertex_type
;
155 /* This flags is set to TRUE if we allocated ourselves the
159 void (*execute
)(IDirect3DExecuteBufferImpl
* this,
160 IDirect3DDeviceImpl
* dev
,
161 IDirect3DViewportImpl
* vp
);
164 /*****************************************************************************
165 * IDirect3DDevice implementation structure
168 #define MAX_TEXTURES 8
169 #define MAX_LIGHTS 16
171 #define WORLDMAT_CHANGED (0x00000001 << 0)
172 #define VIEWMAT_CHANGED (0x00000001 << 1)
173 #define PROJMAT_CHANGED (0x00000001 << 2)
175 struct IDirect3DDeviceImpl
177 ICOM_VFIELD_MULTI(IDirect3DDevice7
);
178 ICOM_VFIELD_MULTI(IDirect3DDevice3
);
179 ICOM_VFIELD_MULTI(IDirect3DDevice2
);
180 ICOM_VFIELD_MULTI(IDirect3DDevice
);
182 /* IDirect3DDevice fields */
184 IDirectDrawSurfaceImpl
*surface
;
186 IDirect3DViewportImpl
*viewport_list
;
187 IDirect3DViewportImpl
*current_viewport
;
188 D3DVIEWPORT7 active_viewport
;
190 IDirectDrawSurfaceImpl
*current_texture
[MAX_TEXTURES
];
192 /* Current transformation matrices */
193 D3DMATRIX
*world_mat
;
197 /* Current material used in D3D7 mode */
198 D3DMATERIAL7 current_material
;
200 /* Light parameters */
201 DWORD active_lights
, set_lights
;
202 D3DLIGHT7 light_parameters
[MAX_LIGHTS
];
204 void (*set_context
)(IDirect3DDeviceImpl
*);
205 HRESULT (*clear
)(IDirect3DDeviceImpl
*This
,
212 void (*matrices_updated
)(IDirect3DDeviceImpl
*This
, DWORD matrices
);
213 void (*set_matrices
)(IDirect3DDeviceImpl
*This
, DWORD matrices
,
214 D3DMATRIX
*world_mat
, D3DMATRIX
*view_mat
, D3DMATRIX
*proj_mat
);
217 /*****************************************************************************
218 * IDirect3DVertexBuffer implementation structure
220 struct IDirect3DVertexBufferImpl
222 ICOM_VFIELD_MULTI(IDirect3DVertexBuffer7
);
223 ICOM_VFIELD_MULTI(IDirect3DVertexBuffer
);
226 D3DVERTEXBUFFERDESC desc
;
228 DWORD vertex_buffer_size
;
233 /* Various dump and helper functions */
234 extern const char *_get_renderstate(D3DRENDERSTATETYPE type
);
235 extern void dump_D3DMATERIAL7(LPD3DMATERIAL7 lpMat
);
236 extern void dump_D3DCOLORVALUE(D3DCOLORVALUE
*lpCol
);
237 extern void dump_D3DLIGHT7(LPD3DLIGHT7 lpLight
);
238 extern void dump_DPFLAGS(DWORD dwFlags
);
239 extern void dump_D3DMATRIX(D3DMATRIX
*mat
);
240 extern void dump_D3DVECTOR(D3DVECTOR
*lpVec
);
241 extern void dump_flexible_vertex(DWORD d3dvtVertexType
);
242 extern DWORD
get_flexible_vertex_size(DWORD d3dvtVertexType
);
243 extern void convert_FVF_to_strided_data(DWORD d3dvtVertexType
, LPVOID lpvVertices
, D3DDRAWPRIMITIVESTRIDEDDATA
*strided
);
244 extern void dump_D3DVOP(DWORD dwVertexOp
);
245 extern void dump_D3DPV(DWORD dwFlags
);
247 extern const float id_mat
[16];
249 #endif /* __GRAPHICS_WINE_D3D_PRIVATE_H */