Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -962,10 +962,26 @@ |
963 | 963 | if(dwFlags & DDCKEY_COLORSPACE) key.colorspace = true;
|
964 | 964 | else key.colorspace = false;
|
965 | 965 | key.key = *lpDDColorKey;
|
966 | | - if(dwFlags & DDCKEY_SRCBLT) colorkey[0] = key;
|
967 | | - if(dwFlags & DDCKEY_DESTBLT) colorkey[1] = key;
|
968 | | - if(dwFlags & DDCKEY_SRCOVERLAY) colorkey[2] = key;
|
969 | | - if(dwFlags & DDCKEY_DESTOVERLAY) colorkey[3] = key;
|
| 966 | + if(dwFlags & DDCKEY_SRCBLT)
|
| 967 | + {
|
| 968 | + ddsd.dwFlags |= DDSD_CKSRCBLT;
|
| 969 | + colorkey[0] = key;
|
| 970 | + }
|
| 971 | + if(dwFlags & DDCKEY_DESTBLT)
|
| 972 | + {
|
| 973 | + ddsd.dwFlags |= DDSD_CKDESTBLT;
|
| 974 | + colorkey[1] = key;
|
| 975 | + }
|
| 976 | + if(dwFlags & DDCKEY_SRCOVERLAY)
|
| 977 | + {
|
| 978 | + ddsd.dwFlags |= DDSD_CKSRCOVERLAY;
|
| 979 | + colorkey[2] = key;
|
| 980 | + }
|
| 981 | + if(dwFlags & DDCKEY_DESTOVERLAY)
|
| 982 | + {
|
| 983 | + ddsd.dwFlags |= DDSD_CKDESTOVERLAY;
|
| 984 | + colorkey[3] = key;
|
| 985 | + }
|
970 | 986 | return DD_OK;
|
971 | 987 | }
|
972 | 988 | HRESULT WINAPI glDirectDrawSurface7::SetOverlayPosition(LONG lX, LONG lY)
|
Index: ddraw/shadergen.h |
— | — | @@ -37,6 +37,9 @@ |
38 | 38 | int texcoords[8];
|
39 | 39 | };
|
40 | 40 |
|
| 41 | +#define D3DTOP_DXGL_DECALMASK 0x101;
|
| 42 | +#define D3DTOP_DXGL_MODULATEMASK 0x102;
|
| 43 | +
|
41 | 44 | void ClearShaders();
|
42 | 45 | void SetShader(__int64 id, TEXTURESTAGE *texstate, int *texcoords, bool builtin);
|
43 | 46 | GLuint GetProgram();
|
Index: dxgltest/Resource.h |
— | — | @@ -27,6 +27,7 @@ |
28 | 28 | #define IDB_DXGLINV 118
|
29 | 29 | #define IDB_DXGLINV64 119
|
30 | 30 | #define IDD_TEXSHADER 121
|
| 31 | +#define IDD_VERTEXSHADER 123
|
31 | 32 | #define IDC_DXDIAG 1000
|
32 | 33 | #define IDC_SPINSTAGE 1000
|
33 | 34 | #define IDC_VIDMODES 1000
|
— | — | @@ -39,13 +40,20 @@ |
40 | 41 | #define IDC_TEXTUREPREVIEW 1003
|
41 | 42 | #define IDC_DISPLAY 1004
|
42 | 43 | #define IDC_TESTLIST 1004
|
| 44 | +#define IDC_FILLMODE 1005
|
43 | 45 | #define IDC_ALPHABLEND 1006
|
44 | 46 | #define IDC_BGCOLOR 1007
|
| 47 | +#define IDC_SHADEMODE 1008
|
45 | 48 | #define IDC_WINDOWED 1008
|
46 | 49 | #define IDC_FULLSCREEN 1009
|
| 50 | +#define IDC_CULLMODE 1010
|
| 51 | +#define IDC_FOGENABLE 1011
|
47 | 52 | #define IDC_APIVER 1012
|
48 | 53 | #define IDC_SPINAPI 1013
|
| 54 | +#define IDC_ENABLELIGHT 1014
|
| 55 | +#define IDC_ENABLESPECULAR 1015
|
49 | 56 | #define IDC_VSYNC 1015
|
| 57 | +#define IDC_AMBIENT 1017
|
50 | 58 | #define IDC_BUFFERS 1017
|
51 | 59 | #define IDC_SPINBACK 1019
|
52 | 60 | #define IDC_FRAMERATE 1023
|
— | — | @@ -114,3 +122,27 @@ |
115 | 123 | #define IDC_RANGEBASEDFOG 1101
|
116 | 124 | #define IDC_BGCOLORSELECT 1102
|
117 | 125 | #define IDC_ALPHATEST 1103
|
| 126 | +#define IDC_AMBIENTSELECT 1104
|
| 127 | +#define IDC_VERTEXCOLOR 1106
|
| 128 | +#define IDC_LOCALVIEWER 1108
|
| 129 | +#define IDC_EMISSIVE 1111
|
| 130 | +#define IDC_EMISSIVESELECT 1112
|
| 131 | +#define IDC_MATAMBIENT 1114
|
| 132 | +#define IDC_MATAMBIENTSELECT 1116
|
| 133 | +#define IDC_POWER 1118
|
| 134 | +#define IDC_LIGHTNUMBER 1120
|
| 135 | +#define IDC_SPIN1 1121
|
| 136 | +#define IDC_LIGHTTYPE 1123
|
| 137 | +#define IDC_LIGHTDIFFUSE 1126
|
| 138 | +#define IDC_LIGHTDIFFUSESELECT 1127
|
| 139 | +#define IDC_LIGHTSPECULAR 1129
|
| 140 | +#define IDC_LIGHTSPECULARSELECT 1131
|
| 141 | +#define IDC_LIGHTAMBIENT 1134
|
| 142 | +#define IDC_LIGHTAMBIENTSELECT 1135
|
| 143 | +#define IDC_LIGHTRANGE 1137
|
| 144 | +#define IDC_LIGHTFALLOFF 1139
|
| 145 | +#define IDC_LIGHTATTEN0 1143
|
| 146 | +#define IDC_LIGHTATTEN1 1144
|
| 147 | +#define IDC_LIGHTATTEN2 1145
|
| 148 | +#define IDC_LIGHTTHETA 1147
|
| 149 | +#define IDC_LIGHTPHI 1149
|
Index: dxgltest/Tests3D.cpp |
— | — | @@ -679,7 +679,7 @@ |
680 | 680 | material.ambient.b = 1.0f;
|
681 | 681 | material.ambient.a = 1.0f;
|
682 | 682 | error = d3d7dev->SetMaterial(&material);
|
683 | | - error = d3d7dev->SetRenderState(D3DRENDERSTATE_LIGHTING, TRUE);
|
| 683 | + error = d3d7dev->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE);
|
684 | 684 | error = d3d7dev->SetRenderState(D3DRENDERSTATE_AMBIENT, 0xffffffff);
|
685 | 685 | mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
|
686 | 686 | mat._12 = mat._13 = mat._14 = mat._41 = 0.0f;
|
— | — | @@ -924,7 +924,7 @@ |
925 | 925 | }
|
926 | 926 | }
|
927 | 927 |
|
928 | | -void SelectTexture(MultiDirectDrawSurface **surface, int type, DWORD colorkey, LPCTSTR file)
|
| 928 | +void SelectTexture(MultiDirectDrawSurface **surface, int type, DWORD colorkey, bool haskey, LPCTSTR file)
|
929 | 929 | {
|
930 | 930 | DDSURFACEDESC2 ddsd;
|
931 | 931 | ZeroMemory(&ddsd,sizeof(DDSURFACEDESC2));
|
— | — | @@ -948,6 +948,9 @@ |
949 | 949 | d3d7dev->EnumTextureFormats(SelectTextureFormatCallback,&ddsd.ddpfPixelFormat);
|
950 | 950 | ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
|
951 | 951 | ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT|DDSD_TEXTURESTAGE;
|
| 952 | + DDCOLORKEY ckey;
|
| 953 | + ckey.dwColorSpaceHighValue = ckey.dwColorSpaceLowValue = colorkey;
|
| 954 | + if(haskey) ddsd.dwFlags |= DDSD_CKSRCBLT;
|
952 | 955 | if(*surface)
|
953 | 956 | {
|
954 | 957 | d3d7dev->SetTexture(texshaderstate.currentstage,NULL);
|
— | — | @@ -974,6 +977,7 @@ |
975 | 978 | SelectObject(hmemdc,holdbmp);
|
976 | 979 | DeleteDC(hmemdc);
|
977 | 980 | DeleteObject(bitmap);
|
| 981 | + if(*surface && haskey) (*surface)->SetColorKey(DDCKEY_SRCBLT,&ckey);
|
978 | 982 | if(*surface) d3d7dev->SetTexture(texshaderstate.currentstage,(LPDIRECTDRAWSURFACE7)(*surface)->GetSurface());
|
979 | 983 | break;
|
980 | 984 | case 3:
|
— | — | @@ -989,6 +993,7 @@ |
990 | 994 | SelectObject(hmemdc,holdbmp);
|
991 | 995 | DeleteDC(hmemdc);
|
992 | 996 | DeleteObject(bitmap);
|
| 997 | + if(*surface && haskey) (*surface)->SetColorKey(DDCKEY_SRCBLT,&ckey);
|
993 | 998 | if(*surface) d3d7dev->SetTexture(texshaderstate.currentstage,(LPDIRECTDRAWSURFACE7)(*surface)->GetSurface());
|
994 | 999 | break;
|
995 | 1000 | case 4:
|
— | — | @@ -1067,7 +1072,7 @@ |
1068 | 1073 | SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("DXGL logo (large)"));
|
1069 | 1074 | SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("Texture file"));
|
1070 | 1075 | SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_SETCURSEL,0,0);
|
1071 | | - SendDlgItemMessage(hWnd,IDC_TEXCOLORKEY,WM_SETTEXT,0,(LPARAM)_T("00000000"));
|
| 1076 | + SendDlgItemMessage(hWnd,IDC_TEXCOLORKEY,WM_SETTEXT,0,(LPARAM)_T(""));
|
1072 | 1077 | PopulateArgCombo(GetDlgItem(hWnd,IDC_CARG1));
|
1073 | 1078 | PopulateArgCombo(GetDlgItem(hWnd,IDC_CARG2));
|
1074 | 1079 | PopulateArgCombo(GetDlgItem(hWnd,IDC_AARG1));
|
— | — | @@ -1116,6 +1121,7 @@ |
1117 | 1122 | _itot(texshaderstate.texstages[number].keycolor,tmpstring,16);
|
1118 | 1123 | strupper(tmpstring);
|
1119 | 1124 | paddwordzeroes(tmpstring);
|
| 1125 | + if(texshaderstate.texstages[number].colorkey == FALSE) tmpstring[0] = 0;
|
1120 | 1126 | SendDlgItemMessage(hWnd,IDC_TEXCOLORKEY,WM_SETTEXT,0,(LPARAM)tmpstring);
|
1121 | 1127 | SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_SETCURSEL,texshaderstate.texstages[number].texturetype,0);
|
1122 | 1128 | SendDlgItemMessage(hWnd,IDC_TEXTUREFILE,WM_SETTEXT,0,(LPARAM)texshaderstate.texstages[number].texturefile);
|
— | — | @@ -1158,7 +1164,8 @@ |
1159 | 1165 | texshaderstate.texstages[number].texturetype =
|
1160 | 1166 | SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_GETCURSEL,0,0);
|
1161 | 1167 | SelectTexture(&texshaderstate.texstages[number].texture,texshaderstate.texstages[number].texturetype,
|
1162 | | - texshaderstate.texstages[number].colorkey,texshaderstate.texstages[number].texturefile);
|
| 1168 | + texshaderstate.texstages[number].keycolor, texshaderstate.texstages[number].colorkey,
|
| 1169 | + texshaderstate.texstages[number].texturefile);
|
1163 | 1170 | }
|
1164 | 1171 | break;
|
1165 | 1172 | case IDC_TEXTUREFILE:
|
— | — | @@ -1168,7 +1175,8 @@ |
1169 | 1176 | SendDlgItemMessage(hWnd,IDC_TEXTUREFILE,WM_GETTEXT,MAX_PATH+1,
|
1170 | 1177 | (LPARAM)texshaderstate.texstages[number].texturefile);
|
1171 | 1178 | SelectTexture(&texshaderstate.texstages[number].texture,texshaderstate.texstages[number].texturetype,
|
1172 | | - texshaderstate.texstages[number].colorkey,texshaderstate.texstages[number].texturefile);
|
| 1179 | + texshaderstate.texstages[number].keycolor, texshaderstate.texstages[number].colorkey,
|
| 1180 | + texshaderstate.texstages[number].texturefile);
|
1173 | 1181 | }
|
1174 | 1182 | break;
|
1175 | 1183 | case IDC_CARG1:
|
— | — | @@ -1286,6 +1294,25 @@ |
1287 | 1295 | d3d7dev->SetRenderState(D3DRENDERSTATE_TEXTUREFACTOR,number);
|
1288 | 1296 | }
|
1289 | 1297 | break;
|
| 1298 | + case IDC_TEXCOLORKEY:
|
| 1299 | + if(HIWORD(wParam) == EN_CHANGE)
|
| 1300 | + {
|
| 1301 | + SendDlgItemMessage(hWnd,IDC_TEXCOLORKEY,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
|
| 1302 | + number = texshaderstate.currentstage;
|
| 1303 | + if(tmpstring[0] == 0)
|
| 1304 | + {
|
| 1305 | + texshaderstate.texstages[number].colorkey = FALSE;
|
| 1306 | + texshaderstate.texstages[number].keycolor = 0;
|
| 1307 | + }
|
| 1308 | + else
|
| 1309 | + {
|
| 1310 | + texshaderstate.texstages[number].colorkey = TRUE;
|
| 1311 | + _stscanf(tmpstring,_T("%x"),&texshaderstate.texstages[number].keycolor);
|
| 1312 | + }
|
| 1313 | + SelectTexture(&texshaderstate.texstages[number].texture,texshaderstate.texstages[number].texturetype,
|
| 1314 | + texshaderstate.texstages[number].keycolor, texshaderstate.texstages[number].colorkey,
|
| 1315 | + texshaderstate.texstages[number].texturefile);
|
| 1316 | + }
|
1290 | 1317 | case IDC_ALPHABLEND:
|
1291 | 1318 | if(HIWORD(wParam) == BN_CLICKED)
|
1292 | 1319 | {
|
— | — | @@ -1307,7 +1334,13 @@ |
1308 | 1335 | IDC_DESTBLEND,CB_GETCURSEL,0,0)+1);
|
1309 | 1336 | }
|
1310 | 1337 | break;
|
1311 | | -
|
| 1338 | + case IDC_COLORKEY:
|
| 1339 | + if(HIWORD(wParam) == BN_CLICKED)
|
| 1340 | + {
|
| 1341 | + if(SendDlgItemMessage(hWnd,IDC_COLORKEY,BM_GETCHECK,0,0) == BST_CHECKED)
|
| 1342 | + d3d7dev->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE,TRUE);
|
| 1343 | + else d3d7dev->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE,FALSE);
|
| 1344 | + }
|
1312 | 1345 | }
|
1313 | 1346 | break;
|
1314 | 1347 | case WM_CLOSE:
|
Index: dxgltest/dxgltest.rc |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |