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 IDirect3DTextureImpl IDirect3DTextureImpl;
36 typedef struct IDirect3DViewportImpl IDirect3DViewportImpl;
37 typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
38 typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl;
39 typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
41 #include "ddraw_private.h"
43 /*****************************************************************************
44 * IDirect3D implementation structure.
45 * This is common for interfaces 1, 2, 3 and 7.
49 ICOM_VFIELD_MULTI(IDirect3D7);
50 ICOM_VFIELD_MULTI(IDirect3D3);
51 ICOM_VFIELD_MULTI(IDirect3D2);
52 ICOM_VFIELD_MULTI(IDirect3D);
54 /* IDirect3D fields */
55 IDirectDrawImpl* ddraw;
58 /*****************************************************************************
59 * IDirect3DLight implementation structure
61 struct IDirect3DLightImpl
63 ICOM_VFIELD_MULTI(IDirect3DLight);
65 /* IDirect3DLight fields */
70 /* Chained list used for adding / removing from viewports */
71 IDirect3DLightImpl *next;
73 /* Activation function */
74 void (*activate)(IDirect3DLightImpl*);
75 void (*desactivate)(IDirect3DLightImpl*);
76 void (*update)(IDirect3DLightImpl*);
79 /*****************************************************************************
80 * IDirect3DMaterial implementation structure
82 struct IDirect3DMaterialImpl
84 ICOM_VFIELD_MULTI(IDirect3DMaterial3);
85 ICOM_VFIELD_MULTI(IDirect3DMaterial2);
86 ICOM_VFIELD_MULTI(IDirect3DMaterial);
88 /* IDirect3DMaterial2 fields */
90 IDirect3DDeviceImpl *active_device;
94 void (*activate)(IDirect3DMaterialImpl* this);
97 /*****************************************************************************
98 * IDirect3DTexture implementation structure
100 struct IDirect3DTextureImpl
102 ICOM_VFIELD_MULTI(IDirect3DTexture2);
103 ICOM_VFIELD_MULTI(IDirect3DTexture);
105 /* IDirect3DTexture fields */
107 IDirect3DDeviceImpl *d3ddevice;
108 IDirectDrawSurfaceImpl *surface;
112 /*****************************************************************************
113 * IDirect3DViewport implementation structure
115 struct IDirect3DViewportImpl
117 ICOM_VFIELD_MULTI(IDirect3DViewport3);
119 /* IDirect3DViewport fields */
121 /* If this viewport is active for one device, put the device here */
122 IDirect3DDeviceImpl *active_device;
130 /* Activation function */
131 void (*activate)(IDirect3DViewportImpl*);
133 /* Field used to chain viewports together */
134 IDirect3DViewportImpl *next;
137 IDirect3DLightImpl *lights;
140 /*****************************************************************************
141 * IDirect3DExecuteBuffer implementation structure
143 struct IDirect3DExecuteBufferImpl
145 ICOM_VFIELD_MULTI(IDirect3DExecuteBuffer);
147 /* IDirect3DExecuteBuffer fields */
149 IDirect3DDeviceImpl* d3ddev;
151 D3DEXECUTEBUFFERDESC desc;
154 /* This buffer will store the transformed vertices */
156 D3DVERTEXTYPE vertex_type;
158 /* This flags is set to TRUE if we allocated ourselves the
162 void (*execute)(IDirect3DExecuteBufferImpl* this,
163 IDirect3DDeviceImpl* dev,
164 IDirect3DViewportImpl* vp);
167 /*****************************************************************************
168 * IDirect3DDevice implementation structure
171 #define MAX_TEXTURES 8
173 struct IDirect3DDeviceImpl
175 ICOM_VFIELD_MULTI(IDirect3DDevice7);
176 ICOM_VFIELD_MULTI(IDirect3DDevice3);
177 ICOM_VFIELD_MULTI(IDirect3DDevice2);
178 ICOM_VFIELD_MULTI(IDirect3DDevice);
180 /* IDirect3DDevice fields */
182 IDirectDrawSurfaceImpl *surface;
184 IDirect3DViewportImpl *viewport_list;
185 IDirect3DViewportImpl *current_viewport;
186 IDirect3DTextureImpl *current_texture[MAX_TEXTURES];
188 void (*set_context)(IDirect3DDeviceImpl*);
191 /*****************************************************************************
192 * IDirect3DVertexBuffer implementation structure
194 struct IDirect3DVertexBufferImpl
196 ICOM_VFIELD_MULTI(IDirect3DVertexBuffer7);
197 ICOM_VFIELD_MULTI(IDirect3DVertexBuffer);
200 D3DVERTEXBUFFERDESC desc;
202 DWORD vertex_buffer_size;
205 /* Various dump functions */
206 extern const char *_get_renderstate(D3DRENDERSTATETYPE type);
208 #define dump_mat(mat) \
209 TRACE("%f %f %f %f\n", (mat)->_11, (mat)->_12, (mat)->_13, (mat)->_14); \
210 TRACE("%f %f %f %f\n", (mat)->_21, (mat)->_22, (mat)->_23, (mat)->_24); \
211 TRACE("%f %f %f %f\n", (mat)->_31, (mat)->_32, (mat)->_33, (mat)->_34); \
212 TRACE("%f %f %f %f\n", (mat)->_41, (mat)->_42, (mat)->_43, (mat)->_44);
214 #endif /* __GRAPHICS_WINE_D3D_PRIVATE_H */