Add a couple of missing spec files.
[wine.git] / dlls / ddraw / d3d_private.h
blob37b10b2bdbd2e00cd08023640c37b5a260e05ad8
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 */
27 #include <stdarg.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "d3d.h"
34 #define MAX_TEXTURES 8
35 #define MAX_LIGHTS 16
37 #define HIGHEST_RENDER_STATE 152
38 #define HIGHEST_TEXTURE_STAGE_STATE 24
40 /*****************************************************************************
41 * Predeclare the interface implementation structures
43 typedef struct IDirect3DLightImpl IDirect3DLightImpl;
44 typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl;
45 typedef struct IDirect3DViewportImpl IDirect3DViewportImpl;
46 typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
47 typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
49 #include "ddraw_private.h"
51 typedef struct STATEBLOCKFLAGS {
52 BOOL render_state[HIGHEST_RENDER_STATE];
53 BOOL texture_stage_state[MAX_TEXTURES][HIGHEST_TEXTURE_STAGE_STATE];
54 } STATEBLOCKFLAGS;
56 typedef struct STATEBLOCK {
57 STATEBLOCKFLAGS set_flags;
58 DWORD render_state[HIGHEST_RENDER_STATE];
59 DWORD texture_stage_state[MAX_TEXTURES][HIGHEST_TEXTURE_STAGE_STATE];
60 } STATEBLOCK;
63 /*****************************************************************************
64 * IDirect3DLight implementation structure
66 struct IDirect3DLightImpl
68 ICOM_VFIELD_MULTI(IDirect3DLight);
69 DWORD ref;
70 /* IDirect3DLight fields */
71 IDirectDrawImpl *d3d;
72 /* If this light is active for one viewport, put the viewport here */
73 IDirect3DViewportImpl *active_viewport;
75 D3DLIGHT2 light;
76 D3DLIGHT7 light7;
78 DWORD dwLightIndex;
80 /* Chained list used for adding / removing from viewports */
81 IDirect3DLightImpl *next;
83 /* Activation function */
84 void (*activate)(IDirect3DLightImpl*);
85 void (*desactivate)(IDirect3DLightImpl*);
86 void (*update)(IDirect3DLightImpl*);
89 /*****************************************************************************
90 * IDirect3DMaterial implementation structure
92 struct IDirect3DMaterialImpl
94 ICOM_VFIELD_MULTI(IDirect3DMaterial3);
95 ICOM_VFIELD_MULTI(IDirect3DMaterial2);
96 ICOM_VFIELD_MULTI(IDirect3DMaterial);
97 DWORD ref;
98 /* IDirect3DMaterial2 fields */
99 IDirectDrawImpl *d3d;
100 IDirect3DDeviceImpl *active_device;
102 D3DMATERIAL mat;
104 void (*activate)(IDirect3DMaterialImpl* this);
107 /*****************************************************************************
108 * IDirect3DViewport implementation structure
110 struct IDirect3DViewportImpl
112 ICOM_VFIELD_MULTI(IDirect3DViewport3);
113 DWORD ref;
114 /* IDirect3DViewport fields */
115 IDirectDrawImpl *d3d;
116 /* If this viewport is active for one device, put the device here */
117 IDirect3DDeviceImpl *active_device;
119 DWORD num_lights;
120 DWORD map_lights;
122 int use_vp2;
123 union {
124 D3DVIEWPORT vp1;
125 D3DVIEWPORT2 vp2;
126 } viewports;
128 /* Activation function */
129 void (*activate)(IDirect3DViewportImpl*);
131 /* Field used to chain viewports together */
132 IDirect3DViewportImpl *next;
134 /* Lights list */
135 IDirect3DLightImpl *lights;
137 /* Background material */
138 IDirect3DMaterialImpl *background;
141 /*****************************************************************************
142 * IDirect3DExecuteBuffer implementation structure
144 struct IDirect3DExecuteBufferImpl
146 ICOM_VFIELD_MULTI(IDirect3DExecuteBuffer);
147 DWORD ref;
148 /* IDirect3DExecuteBuffer fields */
149 IDirectDrawImpl *d3d;
150 IDirect3DDeviceImpl* d3ddev;
152 D3DEXECUTEBUFFERDESC desc;
153 D3DEXECUTEDATA data;
155 /* This buffer will store the transformed vertices */
156 void* vertex_data;
157 WORD* indices;
158 int nb_indices;
160 /* This flags is set to TRUE if we allocated ourselves the
161 data buffer */
162 BOOL need_free;
164 void (*execute)(IDirect3DExecuteBufferImpl* this,
165 IDirect3DDeviceImpl* dev,
166 IDirect3DViewportImpl* vp);
169 /* Internal structure to store the state of the clipping planes */
170 typedef struct d3d7clippingplane
172 D3DVALUE plane[4];
173 } d3d7clippingplane;
175 /*****************************************************************************
176 * IDirect3DDevice implementation structure
179 #define WORLDMAT_CHANGED (0x00000001 << 0)
180 #define VIEWMAT_CHANGED (0x00000001 << 1)
181 #define PROJMAT_CHANGED (0x00000001 << 2)
182 #define TEXMAT0_CHANGED (0x00000001 << 3)
183 #define TEXMAT1_CHANGED (0x00000001 << 4)
184 #define TEXMAT2_CHANGED (0x00000001 << 5)
185 #define TEXMAT3_CHANGED (0x00000001 << 6)
186 #define TEXMAT4_CHANGED (0x00000001 << 7)
187 #define TEXMAT5_CHANGED (0x00000001 << 8)
188 #define TEXMAT6_CHANGED (0x00000001 << 9)
189 #define TEXMAT7_CHANGED (0x00000001 << 10)
191 struct IDirect3DDeviceImpl
193 ICOM_VFIELD_MULTI(IDirect3DDevice7);
194 ICOM_VFIELD_MULTI(IDirect3DDevice3);
195 ICOM_VFIELD_MULTI(IDirect3DDevice2);
196 ICOM_VFIELD_MULTI(IDirect3DDevice);
197 DWORD ref;
198 /* IDirect3DDevice fields */
199 IDirectDrawImpl *d3d;
200 IDirectDrawSurfaceImpl *surface;
202 IDirect3DViewportImpl *viewport_list;
203 IDirect3DViewportImpl *current_viewport;
204 D3DVIEWPORT7 active_viewport;
206 IDirectDrawSurfaceImpl *current_texture[MAX_TEXTURES];
207 IDirectDrawSurfaceImpl *current_zbuffer;
209 /* Current transformation matrices */
210 D3DMATRIX *world_mat;
211 D3DMATRIX *view_mat;
212 D3DMATRIX *proj_mat;
213 D3DMATRIX *tex_mat[MAX_TEXTURES];
214 BOOLEAN tex_mat_is_identity[MAX_TEXTURES];
216 /* Current material used in D3D7 mode */
217 D3DMATERIAL7 current_material;
219 /* Light parameters */
220 DWORD active_lights, set_lights;
221 D3DLIGHT7 light_parameters[MAX_LIGHTS];
223 /* clipping planes */
224 DWORD max_clipping_planes;
225 d3d7clippingplane *clipping_planes;
227 void (*set_context)(IDirect3DDeviceImpl*);
228 HRESULT (*clear)(IDirect3DDeviceImpl *This,
229 DWORD dwCount,
230 LPD3DRECT lpRects,
231 DWORD dwFlags,
232 DWORD dwColor,
233 D3DVALUE dvZ,
234 DWORD dwStencil);
235 void (*matrices_updated)(IDirect3DDeviceImpl *This, DWORD matrices);
236 void (*set_matrices)(IDirect3DDeviceImpl *This, DWORD matrices,
237 D3DMATRIX *world_mat, D3DMATRIX *view_mat, D3DMATRIX *proj_mat);
238 void (*flush_to_framebuffer)(IDirect3DDeviceImpl *This, LPCRECT pRect, IDirectDrawSurfaceImpl *surf);
240 STATEBLOCK state_block;
242 /* Used to prevent locks and rendering to overlap */
243 CRITICAL_SECTION crit;
246 /*****************************************************************************
247 * IDirect3DVertexBuffer implementation structure
249 struct IDirect3DVertexBufferImpl
251 ICOM_VFIELD_MULTI(IDirect3DVertexBuffer7);
252 ICOM_VFIELD_MULTI(IDirect3DVertexBuffer);
253 DWORD ref;
254 IDirectDrawImpl *d3d;
255 D3DVERTEXBUFFERDESC desc;
256 LPVOID *vertices;
257 DWORD vertex_buffer_size;
259 BOOLEAN processed;
262 /* Various dump and helper functions */
263 extern const char *_get_renderstate(D3DRENDERSTATETYPE type);
264 extern void dump_D3DMATERIAL7(LPD3DMATERIAL7 lpMat);
265 extern void dump_D3DCOLORVALUE(D3DCOLORVALUE *lpCol);
266 extern void dump_D3DLIGHT7(LPD3DLIGHT7 lpLight);
267 extern void dump_DPFLAGS(DWORD dwFlags);
268 extern void dump_D3DMATRIX(D3DMATRIX *mat);
269 extern void dump_D3DVECTOR(D3DVECTOR *lpVec);
270 extern void dump_flexible_vertex(DWORD d3dvtVertexType);
271 extern DWORD get_flexible_vertex_size(DWORD d3dvtVertexType);
272 extern void convert_FVF_to_strided_data(DWORD d3dvtVertexType, LPVOID lpvVertices, D3DDRAWPRIMITIVESTRIDEDDATA *strided, DWORD dwStartVertex);
273 extern void dump_D3DVOP(DWORD dwVertexOp);
274 extern void dump_D3DPV(DWORD dwFlags);
275 extern void multiply_matrix(LPD3DMATRIX,LPD3DMATRIX,LPD3DMATRIX);
277 extern const float id_mat[16];
279 #endif /* __GRAPHICS_WINE_D3D_PRIVATE_H */