1999-01-03 18:00:19 +01:00
|
|
|
|
/* Direct3D Material
|
2002-11-21 22:04:16 +01:00
|
|
|
|
* Copyright (c) 2002 Lionel ULMER
|
2006-06-09 19:36:12 +02:00
|
|
|
|
* Copyright (c) 2006 Stefan D<EFBFBD>SINGER
|
2002-03-10 00:29:33 +01:00
|
|
|
|
*
|
2002-11-21 22:04:16 +01:00
|
|
|
|
* This file contains the implementation of Direct3DMaterial.
|
2002-03-10 00:29:33 +01:00
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
|
*/
|
1999-01-03 18:00:19 +01:00
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
|
#include "config.h"
|
2006-06-09 19:36:12 +02:00
|
|
|
|
#include "wine/port.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
#include <assert.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
|
#include <stdarg.h>
|
2006-06-09 19:36:12 +02:00
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
#define COBJMACROS
|
2003-01-07 21:36:20 +01:00
|
|
|
|
#define NONAMELESSUNION
|
2005-05-27 22:17:35 +02:00
|
|
|
|
|
1999-03-14 17:35:05 +01:00
|
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
|
#include "winbase.h"
|
1999-01-03 18:00:19 +01:00
|
|
|
|
#include "winerror.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
|
#include "wingdi.h"
|
2006-06-09 19:36:12 +02:00
|
|
|
|
#include "wine/exception.h"
|
|
|
|
|
|
1999-01-03 18:00:19 +01:00
|
|
|
|
#include "ddraw.h"
|
|
|
|
|
#include "d3d.h"
|
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
#include "ddraw_private.h"
|
|
|
|
|
#include "wine/debug.h"
|
1999-01-03 18:00:19 +01:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d7);
|
|
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(ddraw_thunk);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
|
2007-04-21 23:16:34 +02:00
|
|
|
|
static void dump_material(const D3DMATERIAL *mat)
|
2002-11-21 22:04:16 +01:00
|
|
|
|
{
|
2006-10-10 19:23:27 +02:00
|
|
|
|
DPRINTF(" dwSize : %d\n", mat->dwSize);
|
1999-01-03 18:00:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* IUnknown Methods.
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* IDirect3DMaterial3::QueryInterface
|
|
|
|
|
*
|
|
|
|
|
* QueryInterface for IDirect3DMaterial. Can query all IDirect3DMaterial
|
|
|
|
|
* versions.
|
|
|
|
|
*
|
|
|
|
|
* Params:
|
|
|
|
|
* riid: Interface id queried for
|
|
|
|
|
* obj: Address to pass the interface pointer back
|
|
|
|
|
*
|
|
|
|
|
* Returns:
|
|
|
|
|
* S_OK on success
|
|
|
|
|
* E_NOINTERFACE if the requested interface wasn't found
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
|
IDirect3DMaterialImpl_QueryInterface(IDirect3DMaterial3 *iface,
|
|
|
|
|
REFIID riid,
|
|
|
|
|
LPVOID* obp)
|
1999-01-03 18:00:19 +01:00
|
|
|
|
{
|
2002-11-21 22:04:16 +01:00
|
|
|
|
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obp);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
|
|
|
|
|
*obp = NULL;
|
|
|
|
|
|
|
|
|
|
if ( IsEqualGUID( &IID_IUnknown, riid ) ) {
|
|
|
|
|
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial));
|
|
|
|
|
*obp = iface;
|
|
|
|
|
TRACE(" Creating IUnknown interface at %p.\n", *obp);
|
|
|
|
|
return S_OK;
|
|
|
|
|
}
|
|
|
|
|
if ( IsEqualGUID( &IID_IDirect3DMaterial, riid ) ) {
|
|
|
|
|
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial));
|
|
|
|
|
*obp = ICOM_INTERFACE(This, IDirect3DMaterial);
|
|
|
|
|
TRACE(" Creating IDirect3DMaterial interface %p\n", *obp);
|
|
|
|
|
return S_OK;
|
|
|
|
|
}
|
|
|
|
|
if ( IsEqualGUID( &IID_IDirect3DMaterial2, riid ) ) {
|
|
|
|
|
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial));
|
|
|
|
|
*obp = ICOM_INTERFACE(This, IDirect3DMaterial2);
|
|
|
|
|
TRACE(" Creating IDirect3DMaterial2 interface %p\n", *obp);
|
|
|
|
|
return S_OK;
|
|
|
|
|
}
|
|
|
|
|
if ( IsEqualGUID( &IID_IDirect3DMaterial3, riid ) ) {
|
|
|
|
|
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial));
|
|
|
|
|
*obp = ICOM_INTERFACE(This, IDirect3DMaterial3);
|
|
|
|
|
TRACE(" Creating IDirect3DMaterial3 interface %p\n", *obp);
|
|
|
|
|
return S_OK;
|
|
|
|
|
}
|
|
|
|
|
FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
|
2006-06-09 19:36:12 +02:00
|
|
|
|
return E_NOINTERFACE;
|
2002-11-21 22:04:16 +01:00
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* IDirect3DMaterial3::AddRef
|
|
|
|
|
*
|
|
|
|
|
* Increases the refcount.
|
|
|
|
|
*
|
|
|
|
|
* Returns:
|
|
|
|
|
* The new refcount
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static ULONG WINAPI
|
|
|
|
|
IDirect3DMaterialImpl_AddRef(IDirect3DMaterial3 *iface)
|
2002-11-21 22:04:16 +01:00
|
|
|
|
{
|
|
|
|
|
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
|
2005-01-09 18:29:21 +01:00
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
2006-10-10 19:23:27 +02:00
|
|
|
|
TRACE("(%p)->() incrementing from %u.\n", This, ref - 1);
|
2005-01-09 18:29:21 +01:00
|
|
|
|
|
|
|
|
|
return ref;
|
1999-01-03 18:00:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* IDirect3DMaterial3::Release
|
|
|
|
|
*
|
|
|
|
|
* Reduces the refcount by one. If the refcount falls to 0, the object
|
|
|
|
|
* is destroyed
|
|
|
|
|
*
|
|
|
|
|
* Returns:
|
|
|
|
|
* The new refcount
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static ULONG WINAPI
|
|
|
|
|
IDirect3DMaterialImpl_Release(IDirect3DMaterial3 *iface)
|
1999-01-03 18:00:19 +01:00
|
|
|
|
{
|
2002-11-21 22:04:16 +01:00
|
|
|
|
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
|
2005-01-09 18:29:21 +01:00
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
2006-10-10 19:23:27 +02:00
|
|
|
|
TRACE("(%p)->() decrementing from %u.\n", This, ref + 1);
|
2005-01-09 18:29:21 +01:00
|
|
|
|
|
2006-06-16 23:44:33 +02:00
|
|
|
|
if (!ref)
|
|
|
|
|
{
|
|
|
|
|
if(This->Handle)
|
|
|
|
|
{
|
|
|
|
|
This->ddraw->d3ddevice->Handles[This->Handle - 1].ptr = NULL;
|
|
|
|
|
This->ddraw->d3ddevice->Handles[This->Handle - 1].type = DDrawHandle_Unknown;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-21 22:04:16 +01:00
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2006-06-16 23:44:33 +02:00
|
|
|
|
return 0;
|
2002-11-21 22:04:16 +01:00
|
|
|
|
}
|
2005-01-09 18:29:21 +01:00
|
|
|
|
return ref;
|
2002-11-21 22:04:16 +01:00
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* IDirect3DMaterial Methods
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* IDirect3DMaterial::Initialize
|
|
|
|
|
*
|
|
|
|
|
* A no-op initialization
|
|
|
|
|
*
|
|
|
|
|
* Params:
|
|
|
|
|
* Direct3D: Pointer to a Direct3D interface
|
|
|
|
|
*
|
|
|
|
|
* Returns:
|
|
|
|
|
* D3D_OK
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
|
IDirect3DMaterialImpl_Initialize(IDirect3DMaterial *iface,
|
|
|
|
|
IDirect3D *Direct3D)
|
2002-11-21 22:04:16 +01:00
|
|
|
|
{
|
|
|
|
|
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial, iface);
|
2006-06-09 19:36:12 +02:00
|
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p) no-op...!\n", This, Direct3D);
|
|
|
|
|
|
|
|
|
|
return D3D_OK;
|
2002-11-21 22:04:16 +01:00
|
|
|
|
}
|
1999-01-03 18:00:19 +01:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* IDirect3DMaterial::Reserve
|
|
|
|
|
*
|
|
|
|
|
* DirectX 5 sdk: "The IDirect3DMaterial2::Reserve method is not implemented"
|
|
|
|
|
* Odd. They seem to have mixed their interfaces.
|
|
|
|
|
*
|
|
|
|
|
* Returns:
|
|
|
|
|
* DDERR_UNSUPPORTED
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
|
IDirect3DMaterialImpl_Reserve(IDirect3DMaterial *iface)
|
2002-11-21 22:04:16 +01:00
|
|
|
|
{
|
|
|
|
|
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial, iface);
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE("(%p)->() not implemented\n", This);
|
|
|
|
|
|
|
|
|
|
return DDERR_UNSUPPORTED;
|
2002-11-21 22:04:16 +01:00
|
|
|
|
}
|
1999-01-03 18:00:19 +01:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* IDirect3DMaterial::Unreserve
|
|
|
|
|
*
|
|
|
|
|
* Not supported too
|
|
|
|
|
*
|
|
|
|
|
* Returns:
|
|
|
|
|
* DDERR_UNSUPPORTED
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
|
IDirect3DMaterialImpl_Unreserve(IDirect3DMaterial *iface)
|
2002-11-21 22:04:16 +01:00
|
|
|
|
{
|
|
|
|
|
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial, iface);
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE("(%p)->() not implemented.\n", This);
|
|
|
|
|
|
|
|
|
|
return DDERR_UNSUPPORTED;
|
2002-11-21 22:04:16 +01:00
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* IDirect3DMaterial3::SetMaterial
|
|
|
|
|
*
|
|
|
|
|
* Sets the material description
|
|
|
|
|
*
|
|
|
|
|
* Params:
|
|
|
|
|
* Mat: Material to set
|
|
|
|
|
*
|
|
|
|
|
* Returns:
|
|
|
|
|
* D3D_OK on success
|
|
|
|
|
* DDERR_INVALIDPARAMS if Mat is NULL
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
|
IDirect3DMaterialImpl_SetMaterial(IDirect3DMaterial3 *iface,
|
|
|
|
|
D3DMATERIAL *lpMat)
|
2002-11-21 22:04:16 +01:00
|
|
|
|
{
|
|
|
|
|
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE("(%p)->(%p)\n", This, lpMat);
|
|
|
|
|
if (TRACE_ON(d3d7))
|
2002-11-21 22:04:16 +01:00
|
|
|
|
dump_material(lpMat);
|
|
|
|
|
|
|
|
|
|
/* Stores the material */
|
|
|
|
|
memset(&This->mat, 0, sizeof(This->mat));
|
|
|
|
|
memcpy(&This->mat, lpMat, lpMat->dwSize);
|
|
|
|
|
|
|
|
|
|
return DD_OK;
|
1999-01-03 18:00:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* IDirect3DMaterial3::GetMaterial
|
|
|
|
|
*
|
|
|
|
|
* Returns the material assigned to this interface
|
|
|
|
|
*
|
|
|
|
|
* Params:
|
|
|
|
|
* Mat: Pointer to a D3DMATERIAL structure to store the material description
|
|
|
|
|
*
|
|
|
|
|
* Returns:
|
|
|
|
|
* D3D_OK on success
|
|
|
|
|
* DDERR_INVALIDPARAMS if Mat is NULL
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
|
IDirect3DMaterialImpl_GetMaterial(IDirect3DMaterial3 *iface,
|
|
|
|
|
D3DMATERIAL *lpMat)
|
2002-11-21 22:04:16 +01:00
|
|
|
|
{
|
|
|
|
|
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
|
|
|
|
|
DWORD dwSize;
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE("(%p)->(%p)\n", This, lpMat);
|
|
|
|
|
if (TRACE_ON(d3d7)) {
|
2002-11-21 22:04:16 +01:00
|
|
|
|
TRACE(" Returning material : ");
|
|
|
|
|
dump_material(&This->mat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Copies the material structure */
|
|
|
|
|
dwSize = lpMat->dwSize;
|
|
|
|
|
memset(lpMat, 0, dwSize);
|
|
|
|
|
memcpy(lpMat, &This->mat, dwSize);
|
|
|
|
|
|
|
|
|
|
return DD_OK;
|
|
|
|
|
}
|
1999-01-03 18:00:19 +01:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* IDirect3DMaterial3::GetHandle
|
|
|
|
|
*
|
|
|
|
|
* Returns a handle for the material interface. The handle is simply a
|
|
|
|
|
* pointer to the material implementation
|
|
|
|
|
*
|
|
|
|
|
* Params:
|
|
|
|
|
* Direct3DDevice3: The device this handle is assigned to
|
|
|
|
|
* Handle: Address to write the handle to
|
|
|
|
|
*
|
|
|
|
|
* Returns:
|
|
|
|
|
* D3D_OK on success
|
|
|
|
|
* DDERR_INVALIDPARAMS if Handle is NULL
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
|
IDirect3DMaterialImpl_GetHandle(IDirect3DMaterial3 *iface,
|
|
|
|
|
IDirect3DDevice3 *lpDirect3DDevice3,
|
|
|
|
|
D3DMATERIALHANDLE *lpHandle)
|
1999-01-03 18:00:19 +01:00
|
|
|
|
{
|
2002-11-21 22:04:16 +01:00
|
|
|
|
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
|
2006-06-16 23:44:33 +02:00
|
|
|
|
IDirect3DDeviceImpl *device = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, lpDirect3DDevice3);
|
|
|
|
|
TRACE("(%p/%p)->(%p,%p)\n", This, iface, device, lpHandle);
|
|
|
|
|
|
2006-06-29 14:20:39 +02:00
|
|
|
|
This->active_device = device;
|
2006-06-16 23:44:33 +02:00
|
|
|
|
if(!This->Handle)
|
|
|
|
|
{
|
|
|
|
|
This->Handle = IDirect3DDeviceImpl_CreateHandle(device);
|
|
|
|
|
if(!This->Handle)
|
|
|
|
|
{
|
|
|
|
|
ERR("Error creating a handle\n");
|
|
|
|
|
return DDERR_INVALIDPARAMS; /* Unchecked */
|
|
|
|
|
}
|
|
|
|
|
device->Handles[This->Handle - 1].ptr = This;
|
|
|
|
|
device->Handles[This->Handle - 1].type = DDrawHandle_Material;
|
|
|
|
|
}
|
|
|
|
|
*lpHandle = This->Handle;
|
2006-10-10 19:23:27 +02:00
|
|
|
|
TRACE(" returning handle %08x.\n", *lpHandle);
|
2006-06-16 23:44:33 +02:00
|
|
|
|
|
|
|
|
|
return D3D_OK;
|
1999-01-03 18:00:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-15 17:14:37 +02:00
|
|
|
|
static HRESULT WINAPI
|
2002-11-21 22:04:16 +01:00
|
|
|
|
Thunk_IDirect3DMaterialImpl_2_GetHandle(LPDIRECT3DMATERIAL2 iface,
|
|
|
|
|
LPDIRECT3DDEVICE2 lpDirect3DDevice2,
|
|
|
|
|
LPD3DMATERIALHANDLE lpHandle)
|
1999-01-03 18:00:19 +01:00
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE_(ddraw_thunk)("(%p)->(%p,%p) thunking to IDirect3DMaterial3 interface.\n", iface, lpDirect3DDevice2, lpHandle);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
return IDirect3DMaterial3_GetHandle(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial2, IDirect3DMaterial3, iface),
|
|
|
|
|
COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, lpDirect3DDevice2),
|
|
|
|
|
lpHandle);
|
1999-01-03 18:00:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-15 17:14:37 +02:00
|
|
|
|
static HRESULT WINAPI
|
2002-11-21 22:04:16 +01:00
|
|
|
|
Thunk_IDirect3DMaterialImpl_1_GetHandle(LPDIRECT3DMATERIAL iface,
|
|
|
|
|
LPDIRECT3DDEVICE lpDirect3DDevice,
|
|
|
|
|
LPD3DMATERIALHANDLE lpHandle)
|
1999-01-03 18:00:19 +01:00
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE_(ddraw_thunk)("(%p)->(%p,%p) thunking to IDirect3DMaterial3 interface.\n", iface, lpDirect3DDevice, lpHandle);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
return IDirect3DMaterial3_GetHandle(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial, IDirect3DMaterial3, iface),
|
|
|
|
|
COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice3, lpDirect3DDevice),
|
|
|
|
|
lpHandle);
|
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
2006-06-15 17:14:37 +02:00
|
|
|
|
static HRESULT WINAPI
|
2002-11-21 22:04:16 +01:00
|
|
|
|
Thunk_IDirect3DMaterialImpl_2_QueryInterface(LPDIRECT3DMATERIAL2 iface,
|
|
|
|
|
REFIID riid,
|
|
|
|
|
LPVOID* obp)
|
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE_(ddraw_thunk)("(%p)->(%s,%p) thunking to IDirect3DMaterial3 interface.\n", iface, debugstr_guid(riid), obp);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
return IDirect3DMaterial3_QueryInterface(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial2, IDirect3DMaterial3, iface),
|
|
|
|
|
riid,
|
|
|
|
|
obp);
|
1999-01-03 18:00:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-15 17:14:37 +02:00
|
|
|
|
static HRESULT WINAPI
|
2002-11-21 22:04:16 +01:00
|
|
|
|
Thunk_IDirect3DMaterialImpl_1_QueryInterface(LPDIRECT3DMATERIAL iface,
|
|
|
|
|
REFIID riid,
|
|
|
|
|
LPVOID* obp)
|
1999-01-03 18:00:19 +01:00
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE_(ddraw_thunk)("(%p)->(%s,%p) thunking to IDirect3DMaterial3 interface.\n", iface, debugstr_guid(riid), obp);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
return IDirect3DMaterial3_QueryInterface(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial, IDirect3DMaterial3, iface),
|
|
|
|
|
riid,
|
|
|
|
|
obp);
|
1999-01-03 18:00:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
static ULONG WINAPI
|
2002-11-21 22:04:16 +01:00
|
|
|
|
Thunk_IDirect3DMaterialImpl_2_AddRef(LPDIRECT3DMATERIAL2 iface)
|
1999-01-03 18:00:19 +01:00
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DMaterial3 interface.\n", iface);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
return IDirect3DMaterial3_AddRef(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial2, IDirect3DMaterial3, iface));
|
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
static ULONG WINAPI
|
2002-11-21 22:04:16 +01:00
|
|
|
|
Thunk_IDirect3DMaterialImpl_1_AddRef(LPDIRECT3DMATERIAL iface)
|
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DMaterial3 interface.\n", iface);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
return IDirect3DMaterial3_AddRef(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial, IDirect3DMaterial3, iface));
|
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
static ULONG WINAPI
|
2002-11-21 22:04:16 +01:00
|
|
|
|
Thunk_IDirect3DMaterialImpl_2_Release(LPDIRECT3DMATERIAL2 iface)
|
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DMaterial3 interface.\n", iface);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
return IDirect3DMaterial3_Release(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial2, IDirect3DMaterial3, iface));
|
1999-01-03 18:00:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
static ULONG WINAPI
|
2002-11-21 22:04:16 +01:00
|
|
|
|
Thunk_IDirect3DMaterialImpl_1_Release(LPDIRECT3DMATERIAL iface)
|
1999-01-03 18:00:19 +01:00
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE_(ddraw_thunk)("(%p)->() thunking to IDirect3DMaterial3 interface.\n", iface);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
return IDirect3DMaterial3_Release(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial, IDirect3DMaterial3, iface));
|
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
static HRESULT WINAPI
|
2002-11-21 22:04:16 +01:00
|
|
|
|
Thunk_IDirect3DMaterialImpl_2_SetMaterial(LPDIRECT3DMATERIAL2 iface,
|
|
|
|
|
LPD3DMATERIAL lpMat)
|
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DMaterial3 interface.\n", iface, lpMat);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
return IDirect3DMaterial3_SetMaterial(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial2, IDirect3DMaterial3, iface),
|
|
|
|
|
lpMat);
|
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
static HRESULT WINAPI
|
2002-11-21 22:04:16 +01:00
|
|
|
|
Thunk_IDirect3DMaterialImpl_1_SetMaterial(LPDIRECT3DMATERIAL iface,
|
|
|
|
|
LPD3DMATERIAL lpMat)
|
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DMaterial3 interface.\n", iface, lpMat);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
return IDirect3DMaterial3_SetMaterial(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial, IDirect3DMaterial3, iface),
|
|
|
|
|
lpMat);
|
1999-01-03 18:00:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
static HRESULT WINAPI
|
2002-11-21 22:04:16 +01:00
|
|
|
|
Thunk_IDirect3DMaterialImpl_2_GetMaterial(LPDIRECT3DMATERIAL2 iface,
|
|
|
|
|
LPD3DMATERIAL lpMat)
|
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DMaterial3 interface.\n", iface, lpMat);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
return IDirect3DMaterial3_GetMaterial(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial2, IDirect3DMaterial3, iface),
|
|
|
|
|
lpMat);
|
|
|
|
|
}
|
1999-01-03 18:00:19 +01:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
static HRESULT WINAPI
|
2002-11-21 22:04:16 +01:00
|
|
|
|
Thunk_IDirect3DMaterialImpl_1_GetMaterial(LPDIRECT3DMATERIAL iface,
|
|
|
|
|
LPD3DMATERIAL lpMat)
|
1999-01-03 18:00:19 +01:00
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DMaterial3 interface.\n", iface, lpMat);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
return IDirect3DMaterial3_GetMaterial(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial, IDirect3DMaterial3, iface),
|
|
|
|
|
lpMat);
|
|
|
|
|
}
|
1999-01-03 18:00:19 +01:00
|
|
|
|
|
2003-01-03 22:05:38 +01:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* material_activate
|
|
|
|
|
*
|
|
|
|
|
* Uses IDirect3DDevice7::SetMaterial to activate the material
|
|
|
|
|
*
|
|
|
|
|
* Params:
|
|
|
|
|
* This: Pointer to the material implementation to activate
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
void material_activate(IDirect3DMaterialImpl* This)
|
1999-01-03 18:00:19 +01:00
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
D3DMATERIAL7 d3d7mat;
|
1999-01-03 18:00:19 +01:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
TRACE("Activating material %p\n", This);
|
|
|
|
|
d3d7mat.u.diffuse = This->mat.u.diffuse;
|
|
|
|
|
d3d7mat.u1.ambient = This->mat.u1.ambient;
|
|
|
|
|
d3d7mat.u2.specular = This->mat.u2.specular;
|
|
|
|
|
d3d7mat.u3.emissive = This->mat.u3.emissive;
|
|
|
|
|
d3d7mat.u4.power = This->mat.u4.power;
|
|
|
|
|
|
|
|
|
|
IDirect3DDevice7_SetMaterial(ICOM_INTERFACE(This->active_device, IDirect3DDevice7),
|
|
|
|
|
&d3d7mat);
|
|
|
|
|
}
|
2002-11-21 22:04:16 +01:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
const IDirect3DMaterial3Vtbl IDirect3DMaterial3_Vtbl =
|
1999-01-03 18:00:19 +01:00
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*** IUnknown Methods ***/
|
|
|
|
|
IDirect3DMaterialImpl_QueryInterface,
|
|
|
|
|
IDirect3DMaterialImpl_AddRef,
|
|
|
|
|
IDirect3DMaterialImpl_Release,
|
|
|
|
|
/*** IDirect3DMaterial3 Methods ***/
|
|
|
|
|
IDirect3DMaterialImpl_SetMaterial,
|
|
|
|
|
IDirect3DMaterialImpl_GetMaterial,
|
|
|
|
|
IDirect3DMaterialImpl_GetHandle,
|
2002-11-21 22:04:16 +01:00
|
|
|
|
};
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
const IDirect3DMaterial2Vtbl IDirect3DMaterial2_Vtbl =
|
1999-05-22 13:41:38 +02:00
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*** IUnknown Methods ***/
|
|
|
|
|
Thunk_IDirect3DMaterialImpl_2_QueryInterface,
|
|
|
|
|
Thunk_IDirect3DMaterialImpl_2_AddRef,
|
|
|
|
|
Thunk_IDirect3DMaterialImpl_2_Release,
|
|
|
|
|
/*** IDirect3DMaterial2 Methods ***/
|
|
|
|
|
Thunk_IDirect3DMaterialImpl_2_SetMaterial,
|
|
|
|
|
Thunk_IDirect3DMaterialImpl_2_GetMaterial,
|
|
|
|
|
Thunk_IDirect3DMaterialImpl_2_GetHandle,
|
1999-01-03 18:00:19 +01:00
|
|
|
|
};
|
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
const IDirect3DMaterialVtbl IDirect3DMaterial_Vtbl =
|
1999-05-22 13:41:38 +02:00
|
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
|
/*** IUnknown Methods ***/
|
|
|
|
|
Thunk_IDirect3DMaterialImpl_1_QueryInterface,
|
|
|
|
|
Thunk_IDirect3DMaterialImpl_1_AddRef,
|
|
|
|
|
Thunk_IDirect3DMaterialImpl_1_Release,
|
|
|
|
|
/*** IDirect3DMaterial1 Methods ***/
|
|
|
|
|
IDirect3DMaterialImpl_Initialize,
|
|
|
|
|
Thunk_IDirect3DMaterialImpl_1_SetMaterial,
|
|
|
|
|
Thunk_IDirect3DMaterialImpl_1_GetMaterial,
|
|
|
|
|
Thunk_IDirect3DMaterialImpl_1_GetHandle,
|
|
|
|
|
IDirect3DMaterialImpl_Reserve,
|
|
|
|
|
IDirect3DMaterialImpl_Unreserve
|
|
|
|
|
};
|