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, DWORD mipmap_level);
60 /*****************************************************************************
61 * IDirect3DLight implementation structure
63 struct IDirect3DLightImpl
65 ICOM_VFIELD_MULTI(IDirect3DLight);
67 /* IDirect3DLight fields */
72 /* Chained list used for adding / removing from viewports */
73 IDirect3DLightImpl *next;
75 /* Activation function */
76 void (*activate)(IDirect3DLightImpl*);
77 void (*desactivate)(IDirect3DLightImpl*);
78 void (*update)(IDirect3DLightImpl*);
81 /*****************************************************************************
82 * IDirect3DMaterial implementation structure
84 struct IDirect3DMaterialImpl
86 ICOM_VFIELD_MULTI(IDirect3DMaterial3);
87 ICOM_VFIELD_MULTI(IDirect3DMaterial2);
88 ICOM_VFIELD_MULTI(IDirect3DMaterial);
90 /* IDirect3DMaterial2 fields */
92 IDirect3DDeviceImpl *active_device;
96 void (*activate)(IDirect3DMaterialImpl* this);
99 /*****************************************************************************
100 * IDirect3DViewport implementation structure
102 struct IDirect3DViewportImpl
104 ICOM_VFIELD_MULTI(IDirect3DViewport3);
106 /* IDirect3DViewport fields */
108 /* If this viewport is active for one device, put the device here */
109 IDirect3DDeviceImpl *active_device;
117 /* Activation function */
118 void (*activate)(IDirect3DViewportImpl*);
120 /* Field used to chain viewports together */
121 IDirect3DViewportImpl *next;
124 IDirect3DLightImpl *lights;
127 /*****************************************************************************
128 * IDirect3DExecuteBuffer implementation structure
130 struct IDirect3DExecuteBufferImpl
132 ICOM_VFIELD_MULTI(IDirect3DExecuteBuffer);
134 /* IDirect3DExecuteBuffer fields */
136 IDirect3DDeviceImpl* d3ddev;
138 D3DEXECUTEBUFFERDESC desc;
141 /* This buffer will store the transformed vertices */
143 D3DVERTEXTYPE vertex_type;
145 /* This flags is set to TRUE if we allocated ourselves the
149 void (*execute)(IDirect3DExecuteBufferImpl* this,
150 IDirect3DDeviceImpl* dev,
151 IDirect3DViewportImpl* vp);
154 /*****************************************************************************
155 * IDirect3DDevice implementation structure
158 #define MAX_TEXTURES 8
160 struct IDirect3DDeviceImpl
162 ICOM_VFIELD_MULTI(IDirect3DDevice7);
163 ICOM_VFIELD_MULTI(IDirect3DDevice3);
164 ICOM_VFIELD_MULTI(IDirect3DDevice2);
165 ICOM_VFIELD_MULTI(IDirect3DDevice);
167 /* IDirect3DDevice fields */
169 IDirectDrawSurfaceImpl *surface;
171 IDirect3DViewportImpl *viewport_list;
172 IDirect3DViewportImpl *current_viewport;
173 IDirectDrawSurfaceImpl *current_texture[MAX_TEXTURES];
175 void (*set_context)(IDirect3DDeviceImpl*);
178 /*****************************************************************************
179 * IDirect3DVertexBuffer implementation structure
181 struct IDirect3DVertexBufferImpl
183 ICOM_VFIELD_MULTI(IDirect3DVertexBuffer7);
184 ICOM_VFIELD_MULTI(IDirect3DVertexBuffer);
187 D3DVERTEXBUFFERDESC desc;
189 DWORD vertex_buffer_size;
192 /* Various dump functions */
193 extern const char *_get_renderstate(D3DRENDERSTATETYPE type);
195 #define dump_mat(mat) \
196 TRACE("%f %f %f %f\n", (mat)->_11, (mat)->_12, (mat)->_13, (mat)->_14); \
197 TRACE("%f %f %f %f\n", (mat)->_21, (mat)->_22, (mat)->_23, (mat)->_24); \
198 TRACE("%f %f %f %f\n", (mat)->_31, (mat)->_32, (mat)->_33, (mat)->_34); \
199 TRACE("%f %f %f %f\n", (mat)->_41, (mat)->_42, (mat)->_43, (mat)->_44);
201 #endif /* __GRAPHICS_WINE_D3D_PRIVATE_H */