Exemplo n.º 1
0
/*****************************************************************************
 * 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 d3d_material3_SetMaterial(IDirect3DMaterial3 *iface, D3DMATERIAL *mat)
{
    struct d3d_material *material = impl_from_IDirect3DMaterial3(iface);

    TRACE("iface %p, mat %p.\n", iface, mat);
    if (TRACE_ON(ddraw))
        dump_material(mat);

    /* Stores the material */
    wined3d_mutex_lock();
    memset(&material->mat, 0, sizeof(material->mat));
    memcpy(&material->mat, mat, mat->dwSize);
    wined3d_mutex_unlock();

    return DD_OK;
}
Exemplo n.º 2
0
/*****************************************************************************
 * 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 d3d_material3_GetMaterial(IDirect3DMaterial3 *iface, D3DMATERIAL *mat)
{
    struct d3d_material *material = impl_from_IDirect3DMaterial3(iface);
    DWORD dwSize;

    TRACE("iface %p, mat %p.\n", iface, mat);
    if (TRACE_ON(ddraw))
    {
        TRACE("  Returning material : ");
        dump_material(&material->mat);
    }

    /* Copies the material structure */
    wined3d_mutex_lock();
    dwSize = mat->dwSize;
    memcpy(mat, &material->mat, dwSize);
    wined3d_mutex_unlock();

    return DD_OK;
}