src/video/win32/SDL_d3drender.c
changeset 1916 c773b0c0ac89
parent 1913 83420da906a5
child 1917 3f54b3ec5a07
     1.1 --- a/src/video/win32/SDL_d3drender.c	Wed Jul 19 04:24:41 2006 +0000
     1.2 +++ b/src/video/win32/SDL_d3drender.c	Wed Jul 19 05:03:21 2006 +0000
     1.3 @@ -359,12 +359,6 @@
     1.4      IDirect3DDevice9_SetRenderState(data->device, D3DRS_CULLMODE,
     1.5                                      D3DCULL_NONE);
     1.6      IDirect3DDevice9_SetRenderState(data->device, D3DRS_LIGHTING, FALSE);
     1.7 -    IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
     1.8 -                                    TRUE);
     1.9 -    IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
    1.10 -                                    D3DBLEND_SRCALPHA);
    1.11 -    IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
    1.12 -                                    D3DBLEND_INVSRCALPHA);
    1.13  
    1.14      return renderer;
    1.15  }
    1.16 @@ -627,6 +621,38 @@
    1.17      vertices[3].u = minu;
    1.18      vertices[3].v = maxv;
    1.19  
    1.20 +    switch (blendMode) {
    1.21 +    case SDL_TextureBlendMode_None:
    1.22 +        IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
    1.23 +                                        FALSE);
    1.24 +        break;
    1.25 +    case SDL_TextureBlendMode_Mask:
    1.26 +    case SDL_TextureBlendMode_Blend:
    1.27 +        IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
    1.28 +                                        TRUE);
    1.29 +        IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
    1.30 +                                        D3DBLEND_SRCALPHA);
    1.31 +        IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
    1.32 +                                        D3DBLEND_INVSRCALPHA);
    1.33 +        break;
    1.34 +    case SDL_TextureBlendMode_Add:
    1.35 +        IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
    1.36 +                                        TRUE);
    1.37 +        IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
    1.38 +                                        D3DBLEND_SRCALPHA);
    1.39 +        IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
    1.40 +                                        D3DBLEND_ONE);
    1.41 +        break;
    1.42 +    case SDL_TextureBlendMode_Mod:
    1.43 +        IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
    1.44 +                                        TRUE);
    1.45 +        IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
    1.46 +                                        D3DBLEND_ZERO);
    1.47 +        IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
    1.48 +                                        D3DBLEND_SRCCOLOR);
    1.49 +        break;
    1.50 +    }
    1.51 +
    1.52      result =
    1.53          IDirect3DDevice9_SetTexture(data->device, 0,
    1.54                                      (IDirect3DBaseTexture9 *) texturedata->