comparison src/video/win32/SDL_d3drender.c @ 1916:c773b0c0ac89

Implemented blend modes in the D3D renderer
author Sam Lantinga <slouken@libsdl.org>
date Wed, 19 Jul 2006 05:03:21 +0000
parents 83420da906a5
children 3f54b3ec5a07
comparison
equal deleted inserted replaced
1915:a228436a2404 1916:c773b0c0ac89
357 IDirect3DDevice9_SetVertexShader(data->device, NULL); 357 IDirect3DDevice9_SetVertexShader(data->device, NULL);
358 IDirect3DDevice9_SetFVF(data->device, D3DFVF_XYZRHW | D3DFVF_TEX1); 358 IDirect3DDevice9_SetFVF(data->device, D3DFVF_XYZRHW | D3DFVF_TEX1);
359 IDirect3DDevice9_SetRenderState(data->device, D3DRS_CULLMODE, 359 IDirect3DDevice9_SetRenderState(data->device, D3DRS_CULLMODE,
360 D3DCULL_NONE); 360 D3DCULL_NONE);
361 IDirect3DDevice9_SetRenderState(data->device, D3DRS_LIGHTING, FALSE); 361 IDirect3DDevice9_SetRenderState(data->device, D3DRS_LIGHTING, FALSE);
362 IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
363 TRUE);
364 IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
365 D3DBLEND_SRCALPHA);
366 IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
367 D3DBLEND_INVSRCALPHA);
368 362
369 return renderer; 363 return renderer;
370 } 364 }
371 365
372 static int 366 static int
625 vertices[3].z = 0.0f; 619 vertices[3].z = 0.0f;
626 vertices[3].rhw = 1.0f; 620 vertices[3].rhw = 1.0f;
627 vertices[3].u = minu; 621 vertices[3].u = minu;
628 vertices[3].v = maxv; 622 vertices[3].v = maxv;
629 623
624 switch (blendMode) {
625 case SDL_TextureBlendMode_None:
626 IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
627 FALSE);
628 break;
629 case SDL_TextureBlendMode_Mask:
630 case SDL_TextureBlendMode_Blend:
631 IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
632 TRUE);
633 IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
634 D3DBLEND_SRCALPHA);
635 IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
636 D3DBLEND_INVSRCALPHA);
637 break;
638 case SDL_TextureBlendMode_Add:
639 IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
640 TRUE);
641 IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
642 D3DBLEND_SRCALPHA);
643 IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
644 D3DBLEND_ONE);
645 break;
646 case SDL_TextureBlendMode_Mod:
647 IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
648 TRUE);
649 IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
650 D3DBLEND_ZERO);
651 IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
652 D3DBLEND_SRCCOLOR);
653 break;
654 }
655
630 result = 656 result =
631 IDirect3DDevice9_SetTexture(data->device, 0, 657 IDirect3DDevice9_SetTexture(data->device, 0,
632 (IDirect3DBaseTexture9 *) texturedata-> 658 (IDirect3DBaseTexture9 *) texturedata->
633 texture); 659 texture);
634 if (FAILED(result)) { 660 if (FAILED(result)) {