/***************************************************************************** * IDirect3DLight::GetLight * * Returns the parameters currently assigned to the IDirect3DLight object * * Params: * Light: Pointer to an D3DLIGHT structure to store the parameters * * Returns: * D3D_OK on success * DDERR_INVALIDPARAMS if Light is NULL *****************************************************************************/ static HRESULT WINAPI IDirect3DLightImpl_GetLight(IDirect3DLight *iface, D3DLIGHT *lpLight) { ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface); TRACE("(%p/%p)->(%p)\n", This, iface, lpLight); if (TRACE_ON(d3d7)) { TRACE(" Returning light definition :\n"); dump_light(&This->light); } memcpy(lpLight, &This->light, lpLight->dwSize); return DD_OK; }
static HRESULT WINAPI IDirect3DLightImpl_SetLight(IDirect3DLight *iface, D3DLIGHT *lpLight) { IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface); LPD3DLIGHT7 light7 = &This->light7; TRACE("iface %p, light %p.\n", iface, lpLight); if (TRACE_ON(ddraw)) { TRACE(" Light definition :\n"); dump_light((LPD3DLIGHT2) lpLight); } if ( (lpLight->dltType == 0) || (lpLight->dltType > D3DLIGHT_PARALLELPOINT) ) return DDERR_INVALIDPARAMS; if ( lpLight->dltType == D3DLIGHT_PARALLELPOINT ) FIXME("D3DLIGHT_PARALLELPOINT no supported\n"); /* Translate D3DLIGH2 structure to D3DLIGHT7 */ light7->dltType = lpLight->dltType; light7->dcvDiffuse = lpLight->dcvColor; if ((((LPD3DLIGHT2)lpLight)->dwFlags & D3DLIGHT_NO_SPECULAR) != 0) light7->dcvSpecular = lpLight->dcvColor; else light7->dcvSpecular = *(const D3DCOLORVALUE*)zero_value; light7->dcvAmbient = lpLight->dcvColor; light7->dvPosition = lpLight->dvPosition; light7->dvDirection = lpLight->dvDirection; light7->dvRange = lpLight->dvRange; light7->dvFalloff = lpLight->dvFalloff; light7->dvAttenuation0 = lpLight->dvAttenuation0; light7->dvAttenuation1 = lpLight->dvAttenuation1; light7->dvAttenuation2 = lpLight->dvAttenuation2; light7->dvTheta = lpLight->dvTheta; light7->dvPhi = lpLight->dvPhi; wined3d_mutex_lock(); memcpy(&This->light, lpLight, lpLight->dwSize); if (This->light.dwFlags & D3DLIGHT_ACTIVE) light_update(This); wined3d_mutex_unlock(); return D3D_OK; }
/***************************************************************************** * IDirect3DLight::GetLight * * Returns the parameters currently assigned to the IDirect3DLight object * * Params: * Light: Pointer to an D3DLIGHT structure to store the parameters * * Returns: * D3D_OK on success * DDERR_INVALIDPARAMS if Light is NULL *****************************************************************************/ static HRESULT WINAPI IDirect3DLightImpl_GetLight(IDirect3DLight *iface, D3DLIGHT *lpLight) { IDirect3DLightImpl *This = impl_from_IDirect3DLight(iface); TRACE("iface %p, light %p.\n", iface, lpLight); if (TRACE_ON(ddraw)) { TRACE(" Returning light definition :\n"); dump_light(&This->light); } wined3d_mutex_lock(); memcpy(lpLight, &This->light, lpLight->dwSize); wined3d_mutex_unlock(); return DD_OK; }
static HRESULT WINAPI IDirect3DLightImpl_SetLight(IDirect3DLight *iface, D3DLIGHT *lpLight) { ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface); LPD3DLIGHT7 light7 = &(This->light7); TRACE("(%p)->(%p)\n", This, lpLight); if (TRACE_ON(d3d7)) { TRACE(" Light definition :\n"); dump_light((LPD3DLIGHT2) lpLight); } if ( (lpLight->dltType == 0) || (lpLight->dltType > D3DLIGHT_PARALLELPOINT) ) return DDERR_INVALIDPARAMS; if ( lpLight->dltType == D3DLIGHT_PARALLELPOINT ) FIXME("D3DLIGHT_PARALLELPOINT no supported\n"); /* Translate D3DLIGH2 structure to D3DLIGHT7 */ light7->dltType = lpLight->dltType; light7->dcvDiffuse = lpLight->dcvColor; if ((((LPD3DLIGHT2)lpLight)->dwFlags & D3DLIGHT_NO_SPECULAR) != 0) light7->dcvSpecular = lpLight->dcvColor; else light7->dcvSpecular = *(const D3DCOLORVALUE*)zero_value; light7->dcvAmbient = lpLight->dcvColor; light7->dvPosition = lpLight->dvPosition; light7->dvDirection = lpLight->dvDirection; light7->dvRange = lpLight->dvRange; light7->dvFalloff = lpLight->dvFalloff; light7->dvAttenuation0 = lpLight->dvAttenuation0; light7->dvAttenuation1 = lpLight->dvAttenuation1; light7->dvAttenuation2 = lpLight->dvAttenuation2; light7->dvTheta = lpLight->dvTheta; light7->dvPhi = lpLight->dvPhi; memcpy(&This->light, lpLight, lpLight->dwSize); if ((This->light.dwFlags & D3DLIGHT_ACTIVE) != 0) { This->update(This); } return D3D_OK; }