DXGL r226 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r225‎ | r226 | r227 >
Date:17:14, 5 August 2012
Author:admin
Status:new
Tags:
Comment:
Set texture stage arguments.
Fix default factor value.
Modified paths:
  • /dxgltest/Tests3D.cpp (modified) (history)
  • /dxgltest/dxgltest.rc (modified) (history)

Diff [purge]

Index: dxgltest/Tests3D.cpp
@@ -113,7 +113,7 @@
114114 },
115115 0xFFFFFFFF,
116116 0,
117 - 0,
 117+ 0xFFFFFFFF,
118118 D3DFOG_NONE,
119119 D3DFOG_NONE,
120120 0.0,
@@ -862,6 +862,20 @@
863863 }
864864 }
865865
 866+void SelectTexture(MultiDirectDrawSurface **surface, int type, DWORD colorkey, LPCTSTR file)
 867+{
 868+}
 869+
 870+void SetShaderArg(HWND hWnd, UINT dropdown, UINT checkalpha, UINT checkinv, DWORD *texarg)
 871+{
 872+ DWORD arg = SendDlgItemMessage(hWnd,dropdown,CB_GETCURSEL,0,0);
 873+ if(SendDlgItemMessage(hWnd,checkalpha,BM_GETCHECK,0,0) == BST_CHECKED)
 874+ arg |= D3DTA_ALPHAREPLICATE;
 875+ if(SendDlgItemMessage(hWnd,checkinv,BM_GETCHECK,0,0) == BST_CHECKED)
 876+ arg |= D3DTA_COMPLEMENT;
 877+ *texarg = arg;
 878+}
 879+
866880 INT_PTR CALLBACK TexShader7Proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
867881 {
868882 HRESULT error;
@@ -922,6 +936,8 @@
923937 SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("DXGL logo (small)"));
924938 SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("DXGL logo (large)"));
925939 SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("Texture file"));
 940+ SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_SETCURSEL,0,0);
 941+ SendDlgItemMessage(hWnd,IDC_TEXCOLORKEY,WM_SETTEXT,0,(LPARAM)_T("00000000"));
926942 PopulateArgCombo(GetDlgItem(hWnd,IDC_CARG1));
927943 PopulateArgCombo(GetDlgItem(hWnd,IDC_CARG2));
928944 PopulateArgCombo(GetDlgItem(hWnd,IDC_AARG1));
@@ -1004,6 +1020,84 @@
10051021 SendDlgItemMessage(hWnd,IDC_COLOROP,CB_SETCURSEL,texshaderstate.texstages[number].colorop-1,0);
10061022 SendDlgItemMessage(hWnd,IDC_ALPHAOP,CB_SETCURSEL,texshaderstate.texstages[number].alphaop-1,0);
10071023 }
 1024+ case IDC_TEXTURE:
 1025+ if(HIWORD(wParam) == CBN_SELCHANGE)
 1026+ {
 1027+ number = texshaderstate.currentstage;
 1028+ texshaderstate.texstages[number].texturetype =
 1029+ SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_GETCURSEL,0,0);
 1030+ SelectTexture(&texshaderstate.texstages[number].texture,texshaderstate.texstages[number].texturetype,
 1031+ texshaderstate.texstages[number].colorkey,texshaderstate.texstages[number].texturefile);
 1032+ }
 1033+ case IDC_TEXTUREFILE:
 1034+ if(HIWORD(wParam) == EN_KILLFOCUS)
 1035+ {
 1036+ number = texshaderstate.currentstage;
 1037+ SendDlgItemMessage(hWnd,IDC_TEXTUREFILE,WM_GETTEXT,MAX_PATH+1,
 1038+ (LPARAM)texshaderstate.texstages[number].texturefile);
 1039+ SelectTexture(&texshaderstate.texstages[number].texture,texshaderstate.texstages[number].texturetype,
 1040+ texshaderstate.texstages[number].colorkey,texshaderstate.texstages[number].texturefile);
 1041+ }
 1042+ case IDC_CARG1:
 1043+ if(HIWORD(wParam) == CBN_SELCHANGE)
 1044+ {
 1045+ number = texshaderstate.currentstage;
 1046+ SetShaderArg(hWnd,IDC_CARG1,IDC_CARG1A,IDC_CARG1INV,&texshaderstate.texstages[number].colorarg1);
 1047+ d3d7dev->SetTextureStageState(number,D3DTSS_COLORARG1,texshaderstate.texstages[number].colorarg1);
 1048+ }
 1049+ case IDC_CARG1A:
 1050+ case IDC_CARG1INV:
 1051+ if(HIWORD(wParam) == BN_CLICKED)
 1052+ {
 1053+ number = texshaderstate.currentstage;
 1054+ SetShaderArg(hWnd,IDC_CARG1,IDC_CARG1A,IDC_CARG1INV,&texshaderstate.texstages[number].colorarg2);
 1055+ d3d7dev->SetTextureStageState(number,D3DTSS_COLORARG1,texshaderstate.texstages[number].colorarg2);
 1056+ }
 1057+ case IDC_CARG2:
 1058+ if(HIWORD(wParam) == CBN_SELCHANGE)
 1059+ {
 1060+ number = texshaderstate.currentstage;
 1061+ SetShaderArg(hWnd,IDC_CARG2,IDC_CARG2A,IDC_CARG2INV,&texshaderstate.texstages[number].colorarg2);
 1062+ d3d7dev->SetTextureStageState(number,D3DTSS_COLORARG2,texshaderstate.texstages[number].colorarg2);
 1063+ }
 1064+ case IDC_CARG2A:
 1065+ case IDC_CARG2INV:
 1066+ if(HIWORD(wParam) == BN_CLICKED)
 1067+ {
 1068+ number = texshaderstate.currentstage;
 1069+ SetShaderArg(hWnd,IDC_CARG2,IDC_CARG2A,IDC_CARG2INV,&texshaderstate.texstages[number].colorarg1);
 1070+ d3d7dev->SetTextureStageState(number,D3DTSS_COLORARG2,texshaderstate.texstages[number].colorarg1);
 1071+ }
 1072+ case IDC_AARG1:
 1073+ if(HIWORD(wParam) == CBN_SELCHANGE)
 1074+ {
 1075+ number = texshaderstate.currentstage;
 1076+ SetShaderArg(hWnd,IDC_AARG1,IDC_AARG1A,IDC_AARG1INV,&texshaderstate.texstages[number].alphaarg1);
 1077+ d3d7dev->SetTextureStageState(number,D3DTSS_ALPHAARG1,texshaderstate.texstages[number].alphaarg1);
 1078+ }
 1079+ case IDC_AARG1A:
 1080+ case IDC_AARG1INV:
 1081+ if(HIWORD(wParam) == BN_CLICKED)
 1082+ {
 1083+ number = texshaderstate.currentstage;
 1084+ SetShaderArg(hWnd,IDC_AARG1,IDC_AARG1A,IDC_AARG1INV,&texshaderstate.texstages[number].alphaarg1);
 1085+ d3d7dev->SetTextureStageState(number,D3DTSS_ALPHAARG1,texshaderstate.texstages[number].alphaarg1);
 1086+ }
 1087+ case IDC_AARG2:
 1088+ if(HIWORD(wParam) == CBN_SELCHANGE)
 1089+ {
 1090+ number = texshaderstate.currentstage;
 1091+ SetShaderArg(hWnd,IDC_AARG2,IDC_AARG2A,IDC_AARG2INV,&texshaderstate.texstages[number].alphaarg2);
 1092+ d3d7dev->SetTextureStageState(number,D3DTSS_ALPHAARG2,texshaderstate.texstages[number].alphaarg2);
 1093+ }
 1094+ case IDC_AARG2A:
 1095+ case IDC_AARG2INV:
 1096+ if(HIWORD(wParam) == BN_CLICKED)
 1097+ {
 1098+ number = texshaderstate.currentstage;
 1099+ SetShaderArg(hWnd,IDC_AARG2,IDC_AARG2A,IDC_AARG2INV,&texshaderstate.texstages[number].alphaarg2);
 1100+ d3d7dev->SetTextureStageState(number,D3DTSS_ALPHAARG2,texshaderstate.texstages[number].alphaarg2);
 1101+ }
10081102 }
10091103 break;
10101104 case WM_CLOSE:
Index: dxgltest/dxgltest.rc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream