| Index: ddraw/glDirect3D.cpp |
| — | — | @@ -52,8 +52,10 @@ |
| 53 | 53 | D3DPTFILTERCAPS_MIPLINEAR | D3DPTFILTERCAPS_LINEARMIPNEAREST | D3DPTFILTERCAPS_LINEARMIPLINEAR |
|
| 54 | 54 | D3DPTFILTERCAPS_MAGFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MINFLINEAR |
|
| 55 | 55 | D3DPTFILTERCAPS_MINFPOINT, //dwTextureFilterCaps
|
| 56 | | - 0, //dwTextureBlendCaps
|
| 57 | | - 0, //dwTextureAddressCaps
|
| | 56 | + D3DPTBLENDCAPS_ADD | D3DPTBLENDCAPS_COPY | D3DPTBLENDCAPS_DECAL | D3DPTBLENDCAPS_DECALALPHA |
|
| | 57 | + D3DPTBLENDCAPS_MODULATE | D3DPTBLENDCAPS_MODULATEALPHA, //dwTextureBlendCaps
|
| | 58 | + D3DPTADDRESSCAPS_CLAMP | D3DPTADDRESSCAPS_INDEPENDENTUV |D3DPTADDRESSCAPS_MIRROR |
|
| | 59 | + D3DPTADDRESSCAPS_WRAP, //dwTextureAddressCaps
|
| 58 | 60 | 0, //dwStippleWidth
|
| 59 | 61 | 0 //dwStippleHeight
|
| 60 | 62 | },
|
| — | — | @@ -77,8 +79,10 @@ |
| 78 | 80 | D3DPTFILTERCAPS_MIPLINEAR | D3DPTFILTERCAPS_LINEARMIPNEAREST | D3DPTFILTERCAPS_LINEARMIPLINEAR |
|
| 79 | 81 | D3DPTFILTERCAPS_MAGFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MINFLINEAR |
|
| 80 | 82 | D3DPTFILTERCAPS_MINFPOINT, //dwTextureFilterCaps
|
| 81 | | - 0, //dwTextureBlendCaps
|
| 82 | | - 0, //dwTextureAddressCaps
|
| | 83 | + D3DPTBLENDCAPS_ADD | D3DPTBLENDCAPS_COPY | D3DPTBLENDCAPS_DECAL | D3DPTBLENDCAPS_DECALALPHA |
|
| | 84 | + D3DPTBLENDCAPS_MODULATE | D3DPTBLENDCAPS_MODULATEALPHA, //dwTextureBlendCaps
|
| | 85 | + D3DPTADDRESSCAPS_CLAMP | D3DPTADDRESSCAPS_INDEPENDENTUV |D3DPTADDRESSCAPS_MIRROR |
|
| | 86 | + D3DPTADDRESSCAPS_WRAP, //dwTextureAddressCaps
|
| 83 | 87 | 0, //dwStippleWidth
|
| 84 | 88 | 0 //dwStippleHeight
|
| 85 | 89 | },
|
| Index: ddraw/glDirect3DDevice.cpp |
| — | — | @@ -256,6 +256,8 @@ |
| 257 | 257 | memset(gltextures,0,8*sizeof(GLuint));
|
| 258 | 258 | d3ddesc.dwMaxTextureWidth = d3ddesc.dwMaxTextureHeight =
|
| 259 | 259 | d3ddesc.dwMaxTextureRepeat = d3ddesc.dwMaxTextureAspectRatio = renderer->gl_caps.TextureMax;
|
| | 260 | + d3ddesc3.dwMaxTextureWidth = d3ddesc3.dwMaxTextureHeight =
|
| | 261 | + d3ddesc3.dwMaxTextureRepeat = d3ddesc3.dwMaxTextureAspectRatio = renderer->gl_caps.TextureMax;
|
| 260 | 262 | renderer->InitD3D(zbuffer);
|
| 261 | 263 | }
|
| 262 | 264 | glDirect3DDevice7::~glDirect3DDevice7()
|
| — | — | @@ -486,7 +488,16 @@ |
| 487 | 489 | shader |= (__int64)blendweights << 46;
|
| 488 | 490 | if(renderstate[D3DRENDERSTATE_NORMALIZENORMALS]) shader |= (1i64 << 49);
|
| 489 | 491 | if(VertexType[1].data) shader |= (1i64 << 50);
|
| 490 | | - //TODO: Implement texture stages.
|
| | 492 | + if(renderstate[D3DRENDERSTATE_TEXTUREMAPBLEND] == D3DTBLEND_MODULATE)
|
| | 493 | + {
|
| | 494 | + bool noalpha = false;;
|
| | 495 | + if(!texstages[0].texture) noalpha = true;
|
| | 496 | + if(texstages[0].texture)
|
| | 497 | + if(!(texstages[0].texture->ddsd.ddpfPixelFormat.dwFlags & DDPF_ALPHAPIXELS))
|
| | 498 | + noalpha = true;
|
| | 499 | + if(noalpha) texstages[0].alphaop = D3DTOP_SELECTARG2;
|
| | 500 | + else texstages[0].alphaop = D3DTOP_MODULATE;
|
| | 501 | + }
|
| 491 | 502 | for(i = 0; i < 8; i++)
|
| 492 | 503 | {
|
| 493 | 504 | if(!texstages[i].dirty) continue;
|
| — | — | @@ -1039,8 +1050,12 @@ |
| 1040 | 1051 | SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG1);
|
| 1041 | 1052 | break;
|
| 1042 | 1053 | case D3DTBLEND_MODULATE:
|
| 1043 | | - FIXME("DX5 modulate not yet supported.");
|
| 1044 | | - ERR(DDERR_GENERIC);
|
| | 1054 | + SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
|
| | 1055 | + SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURRENT);
|
| | 1056 | + SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE);
|
| | 1057 | + SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_CURRENT);
|
| | 1058 | + SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);
|
| | 1059 | + break; // Automatically selected based on texture
|
| 1045 | 1060 | case D3DTBLEND_DECALALPHA:
|
| 1046 | 1061 | SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
|
| 1047 | 1062 | SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURRENT);
|
| — | — | @@ -1113,6 +1128,7 @@ |
| 1114 | 1129 | {
|
| 1115 | 1130 | case D3DTSS_COLOROP:
|
| 1116 | 1131 | if(!dwValue || (dwValue > 24)) return DDERR_INVALIDPARAMS;
|
| | 1132 | + if(dwStage == 0)renderstate[D3DRENDERSTATE_TEXTUREMAPBLEND] = 0;
|
| 1117 | 1133 | texstages[dwStage].colorop = (D3DTEXTUREOP)dwValue;
|
| 1118 | 1134 | texstages[dwStage].dirty = true;
|
| 1119 | 1135 | return D3D_OK;
|
| — | — | @@ -1130,6 +1146,7 @@ |
| 1131 | 1147 | return D3D_OK;
|
| 1132 | 1148 | case D3DTSS_ALPHAOP:
|
| 1133 | 1149 | if(!dwValue || (dwValue > 24)) return DDERR_INVALIDPARAMS;
|
| | 1150 | + if(dwStage == 0)renderstate[D3DRENDERSTATE_TEXTUREMAPBLEND] = 0;
|
| 1134 | 1151 | texstages[dwStage].alphaop = (D3DTEXTUREOP )dwValue;
|
| 1135 | 1152 | texstages[dwStage].dirty = true;
|
| 1136 | 1153 | return D3D_OK;
|