2 * Copyright 2000 Marcus Meissner
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "wine/debug.h"
34 #include "d3d_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
38 static ICOM_VTABLE(IDirect3D) d3dvt;
39 static ICOM_VTABLE(IDirect3D2) d3d2vt;
41 /*******************************************************************************
44 HRESULT WINAPI IDirect3DImpl_QueryInterface(
45 LPDIRECT3D iface,REFIID refiid,LPVOID *obj
47 ICOM_THIS(IDirect3DImpl,iface);
48 /* FIXME: Not sure if this is correct */
50 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(refiid),obj);
51 if (( IsEqualGUID( &IID_IDirectDraw, refiid ) ) ||
52 ( IsEqualGUID (&IID_IDirectDraw2, refiid ) ) ||
53 ( IsEqualGUID( &IID_IDirectDraw4, refiid ) )
56 IDirect3D_AddRef(iface);
57 TRACE(" Creating IDirectDrawX interface (%p)\n", *obj);
60 if (( IsEqualGUID( &IID_IDirect3D, refiid ) ) ||
61 ( IsEqualGUID( &IID_IUnknown, refiid ) ) ) {
63 IDirect3D_AddRef(iface);
64 TRACE(" Creating IDirect3D interface (%p)\n", *obj);
67 if ( IsEqualGUID( &IID_IDirect3D2, refiid ) ) {
70 d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d));
72 d3d->ddraw = This->ddraw;
73 IDirect3D_AddRef(iface);
74 ICOM_VTBL(d3d) = &d3d2vt;
76 TRACE(" Creating IDirect3D2 interface (%p)\n", *obj);
79 FIXME("(%p):interface for IID %s NOT found!\n",This,debugstr_guid(refiid));
80 return OLE_E_ENUM_NOMORE;
83 ULONG WINAPI IDirect3DImpl_AddRef(LPDIRECT3D iface) {
84 ICOM_THIS(IDirect3DImpl,iface);
85 TRACE("(%p)->() incrementing from %lu.\n", This, This->ref );
90 ULONG WINAPI IDirect3DImpl_Release(LPDIRECT3D iface)
92 ICOM_THIS(IDirect3DImpl,iface);
93 TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
96 IDirectDraw2_Release((IDirectDraw2*)This->ddraw);
97 HeapFree(GetProcessHeap(),0,This);
103 HRESULT WINAPI IDirect3DImpl_Initialize(LPDIRECT3D iface,REFIID refiid) {
104 ICOM_THIS(IDirect3DImpl,iface);
105 /* FIXME: Not sure if this is correct */
106 FIXME("(%p)->(%s):stub.\n",This,debugstr_guid(refiid));
107 return DDERR_ALREADYINITIALIZED;
110 HRESULT WINAPI IDirect3DImpl_EnumDevices(
111 LPDIRECT3D iface, LPD3DENUMDEVICESCALLBACK cb, LPVOID context
113 ICOM_THIS(IDirect3DImpl,iface);
114 FIXME("(%p)->(%p,%p),stub!\n",This,cb,context);
118 HRESULT WINAPI IDirect3DImpl_CreateLight(
119 LPDIRECT3D iface, LPDIRECT3DLIGHT *lplight, IUnknown *lpunk
121 ICOM_THIS(IDirect3DImpl,iface);
122 FIXME("(%p)->(%p,%p): stub\n", This, lplight, lpunk);
126 HRESULT WINAPI IDirect3DImpl_CreateMaterial(
127 LPDIRECT3D iface, LPDIRECT3DMATERIAL *lpmaterial, IUnknown *lpunk
129 ICOM_THIS(IDirect3DImpl,iface);
130 FIXME("(%p)->(%p,%p): stub\n", This, lpmaterial, lpunk);
134 HRESULT WINAPI IDirect3DImpl_CreateViewport(
135 LPDIRECT3D iface, LPDIRECT3DVIEWPORT *lpviewport, IUnknown *lpunk
137 ICOM_THIS(IDirect3DImpl,iface);
138 FIXME("(%p)->(%p,%p): stub\n", This, lpviewport, lpunk);
143 HRESULT WINAPI IDirect3DImpl_FindDevice(
144 LPDIRECT3D iface, LPD3DFINDDEVICESEARCH lpfinddevsrc,
145 LPD3DFINDDEVICERESULT lpfinddevrst)
147 ICOM_THIS(IDirect3DImpl,iface);
148 FIXME("(%p)->(%p,%p): stub\n", This, lpfinddevsrc, lpfinddevrst);
152 /* This is for checking the correctness of the prototypes/functions.
155 static ICOM_VTABLE(IDirect3D) WINE_UNUSED d3dvt = {
156 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
157 IDirect3DImpl_QueryInterface,
158 IDirect3DImpl_AddRef,
159 IDirect3DImpl_Release,
160 IDirect3DImpl_Initialize,
161 IDirect3DImpl_EnumDevices,
162 IDirect3DImpl_CreateLight,
163 IDirect3DImpl_CreateMaterial,
164 IDirect3DImpl_CreateViewport,
165 IDirect3DImpl_FindDevice
168 /*******************************************************************************
171 HRESULT WINAPI IDirect3D2Impl_QueryInterface(
172 LPDIRECT3D2 iface,REFIID refiid,LPVOID *obj) {
173 ICOM_THIS(IDirect3D2Impl,iface);
175 /* FIXME: Not sure if this is correct */
177 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(refiid),obj);
178 if ( ( IsEqualGUID( &IID_IDirectDraw, refiid ) ) ||
179 ( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) ||
180 ( IsEqualGUID( &IID_IDirectDraw4, refiid ) ) ) {
182 IDirect3D2_AddRef(iface);
184 TRACE(" Creating IDirectDrawX interface (%p)\n", *obj);
188 if ( ( IsEqualGUID( &IID_IDirect3D2, refiid ) ) ||
189 ( IsEqualGUID( &IID_IUnknown, refiid ) ) ) {
191 IDirect3D2_AddRef(iface);
193 TRACE(" Creating IDirect3D2 interface (%p)\n", *obj);
197 if ( IsEqualGUID( &IID_IDirect3D, refiid ) ) {
200 d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d));
202 d3d->ddraw = This->ddraw;
203 IDirect3D2_AddRef(iface);
204 ICOM_VTBL(d3d) = &d3dvt;
206 TRACE(" Creating IDirect3D interface (%p)\n", *obj);
209 FIXME("(%p):interface for IID %s NOT found!\n",This,debugstr_guid(refiid));
210 return OLE_E_ENUM_NOMORE;
213 ULONG WINAPI IDirect3D2Impl_AddRef(LPDIRECT3D2 iface) {
214 ICOM_THIS(IDirect3D2Impl,iface);
215 TRACE("(%p)->() incrementing from %lu.\n", This, This->ref );
217 return ++(This->ref);
220 ULONG WINAPI IDirect3D2Impl_Release(LPDIRECT3D2 iface) {
221 ICOM_THIS(IDirect3D2Impl,iface);
222 TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
224 if (!--(This->ref)) {
225 IDirectDraw2_Release((IDirectDraw2*)This->ddraw);
226 HeapFree(GetProcessHeap(),0,This);
232 HRESULT WINAPI IDirect3D2Impl_EnumDevices(
233 LPDIRECT3D2 iface,LPD3DENUMDEVICESCALLBACK cb, LPVOID context
235 ICOM_THIS(IDirect3D2Impl,iface);
236 FIXME("(%p)->(%p,%p),stub!\n",This,cb,context);
240 HRESULT WINAPI IDirect3D2Impl_CreateLight(
241 LPDIRECT3D2 iface, LPDIRECT3DLIGHT *lplight, IUnknown *lpunk
243 ICOM_THIS(IDirect3D2Impl,iface);
244 FIXME("(%p)->(%p,%p): stub\n", This, lplight, lpunk);
248 HRESULT WINAPI IDirect3D2Impl_CreateMaterial(
249 LPDIRECT3D2 iface, LPDIRECT3DMATERIAL2 *lpmaterial, IUnknown *lpunk
251 ICOM_THIS(IDirect3D2Impl,iface);
252 FIXME("(%p)->(%p,%p): stub\n", This, lpmaterial, lpunk);
256 HRESULT WINAPI IDirect3D2Impl_CreateViewport(
257 LPDIRECT3D2 iface, LPDIRECT3DVIEWPORT2 *lpviewport, IUnknown *lpunk
259 ICOM_THIS(IDirect3D2Impl,iface);
260 FIXME("(%p)->(%p,%p): stub\n", This, lpviewport, lpunk);
264 HRESULT WINAPI IDirect3D2Impl_FindDevice(
265 LPDIRECT3D2 iface, LPD3DFINDDEVICESEARCH lpfinddevsrc,
266 LPD3DFINDDEVICERESULT lpfinddevrst)
268 ICOM_THIS(IDirect3D2Impl,iface);
269 FIXME("(%p)->(%p,%p): stub\n", This, lpfinddevsrc, lpfinddevrst);
273 HRESULT WINAPI IDirect3D2Impl_CreateDevice(
274 LPDIRECT3D2 iface, REFCLSID rguid, LPDIRECTDRAWSURFACE surface,
275 LPDIRECT3DDEVICE2 *device)
277 ICOM_THIS(IDirect3D2Impl,iface);
278 FIXME("(%p)->(%s,%p,%p): stub\n",This,debugstr_guid(rguid),surface,device);
279 return DDERR_INVALIDPARAMS;
282 /* This is for checking the correctness of the prototypes/functions.
285 static ICOM_VTABLE(IDirect3D2) WINE_UNUSED d3d2vt =
287 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
288 IDirect3D2Impl_QueryInterface,
289 IDirect3D2Impl_AddRef,
290 IDirect3D2Impl_Release,
291 IDirect3D2Impl_EnumDevices,
292 IDirect3D2Impl_CreateLight,
293 IDirect3D2Impl_CreateMaterial,
294 IDirect3D2Impl_CreateViewport,
295 IDirect3D2Impl_FindDevice,
296 IDirect3D2Impl_CreateDevice