Index: ddraw/glDirect3D.cpp |
— | — | @@ -88,7 +88,8 @@ |
89 | 89 | D3DTEXOPCAPS_SELECTARG1 | D3DTEXOPCAPS_SELECTARG2 | D3DTEXOPCAPS_MODULATE |
|
90 | 90 | D3DTEXOPCAPS_MODULATE2X | D3DTEXOPCAPS_MODULATE4X | D3DTEXOPCAPS_ADD |
|
91 | 91 | D3DTEXOPCAPS_ADDSIGNED | D3DTEXOPCAPS_ADDSIGNED2X | D3DTEXOPCAPS_SUBTRACT |
|
92 | | - D3DTEXOPCAPS_ADDSMOOTH, //dwTextureOpCaps
|
| 92 | + D3DTEXOPCAPS_ADDSMOOTH | D3DTEXOPCAPS_BLENDDIFFUSEALPHA | D3DTEXOPCAPS_BLENDTEXTUREALPHA |
|
| 93 | + D3DTEXOPCAPS_BLENDTEXTUREALPHAPM | D3DTEXOPCAPS_BLENDCURRENTALPHA, //dwTextureOpCaps
|
93 | 94 | 8, //wMaxTextureBlendStages
|
94 | 95 | 8, //wMaxSimultaneousTextures
|
95 | 96 | 8, //dwMaxActiveLights
|
Index: ddraw/shadergen.cpp |
— | — | @@ -603,6 +603,7 @@ |
604 | 604 | fsrc->append(mainstart);
|
605 | 605 | fsrc->append(op_colorfragin);
|
606 | 606 | string arg1,arg2;
|
| 607 | + string texarg;
|
607 | 608 | int args[4];
|
608 | 609 | bool texfail;
|
609 | 610 | const string blendargs[] = {"color","gl_Color","texture2DProj(texX,gl_TexCoord[Y])",
|
— | — | @@ -707,6 +708,28 @@ |
708 | 709 | case D3DTOP_ADDSMOOTH:
|
709 | 710 | fsrc->append("color.rgb = " + arg1 + " + " + arg2 + " - " + arg1 + " * " + arg2 + ";\n");
|
710 | 711 | break;
|
| 712 | + case D3DTOP_BLENDDIFFUSEALPHA:
|
| 713 | + fsrc->append("color.rgb = " + arg1 + " * gl_Color.a + " + arg2 + " * (1.0-gl_Color.a);\n");
|
| 714 | + break;
|
| 715 | + case D3DTOP_BLENDTEXTUREALPHA:
|
| 716 | + texarg = blendargs[2];
|
| 717 | + texarg.replace(17,1,_itoa(i,idstring,10));
|
| 718 | + texarg.replace(31,1,_itoa((texstate[i].shaderid>>54)&7,idstring,10));
|
| 719 | + fsrc->append("color.rgb = " + arg1 + " * " + texarg + ".a + " + arg2 + " * (1.0-"
|
| 720 | + + texarg + ".a);\n");
|
| 721 | + break;
|
| 722 | + case D3DTOP_BLENDFACTORALPHA:
|
| 723 | + fsrc->append("color.rgb = " + arg1 + " * texfactor.a + " + arg2 + " * (1.0-texfactor.a);\n");
|
| 724 | + break;
|
| 725 | + case D3DTOP_BLENDTEXTUREALPHAPM:
|
| 726 | + texarg = blendargs[2];
|
| 727 | + texarg.replace(17,1,_itoa(i,idstring,10));
|
| 728 | + texarg.replace(31,1,_itoa((texstate[i].shaderid>>54)&7,idstring,10));
|
| 729 | + fsrc->append("color.rgb = " + arg1 + " + " + arg2 + " * (1.0-" + texarg + ".a);\n");
|
| 730 | + break;
|
| 731 | + case D3DTOP_BLENDCURRENTALPHA:
|
| 732 | + fsrc->append("color.rgb = " + arg1 + " * color.a + " + arg2 + " * (1.0-color.a);\n");
|
| 733 | + break;
|
711 | 734 | }
|
712 | 735 | if(((texstate[i].shaderid>>17) & 31) == D3DTOP_DISABLE)break;
|
713 | 736 | // Alpha stage
|
— | — | @@ -804,6 +827,28 @@ |
805 | 828 | case D3DTOP_ADDSMOOTH:
|
806 | 829 | fsrc->append("color.a = " + arg1 + " + " + arg2 + " - " + arg1 + " * " + arg2 + ";\n");
|
807 | 830 | break;
|
| 831 | + case D3DTOP_BLENDDIFFUSEALPHA:
|
| 832 | + fsrc->append("color.a = " + arg1 + " * gl_Color.a + " + arg2 + " * (1.0-gl_Color.a);\n");
|
| 833 | + break;
|
| 834 | + case D3DTOP_BLENDTEXTUREALPHA:
|
| 835 | + texarg = blendargs[2];
|
| 836 | + texarg.replace(17,1,_itoa(i,idstring,10));
|
| 837 | + texarg.replace(31,1,_itoa((texstate[i].shaderid>>54)&7,idstring,10));
|
| 838 | + fsrc->append("color.a = " + arg1 + " * " + texarg + ".a + " + arg2 + " * (1.0-"
|
| 839 | + + texarg + ".a);\n");
|
| 840 | + break;
|
| 841 | + case D3DTOP_BLENDFACTORALPHA:
|
| 842 | + fsrc->append("color.a = " + arg1 + " * texfactor.a + " + arg2 + " * (1.0-texfactor.a);\n");
|
| 843 | + break;
|
| 844 | + case D3DTOP_BLENDTEXTUREALPHAPM:
|
| 845 | + texarg = blendargs[2];
|
| 846 | + texarg.replace(17,1,_itoa(i,idstring,10));
|
| 847 | + texarg.replace(31,1,_itoa((texstate[i].shaderid>>54)&7,idstring,10));
|
| 848 | + fsrc->append("color.a = " + arg1 + " + " + arg2 + " * (1.0-" + texarg + ".a);\n");
|
| 849 | + break;
|
| 850 | + case D3DTOP_BLENDCURRENTALPHA:
|
| 851 | + fsrc->append("color.a = " + arg1 + " * color.a + " + arg2 + " * (1.0-color.a);\n");
|
| 852 | + break;
|
808 | 853 | }
|
809 | 854 | }
|
810 | 855 | fsrc->append(op_colorfragout);
|