DXGL r308 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r307‎ | r308 | r309 >
Date:16:37, 13 January 2013
Author:admin
Status:new
Tags:
Comment:
Add a couple of light parameters to Vertex Shader demo.
Modified paths:
  • /dxgltest/Tests3D.cpp (modified) (history)

Diff [purge]

Index: dxgltest/Tests3D.cpp
@@ -1848,6 +1848,7 @@
18491849 SendDlgItemMessage(hWnd,IDC_LIGHTTYPE,CB_ADDSTRING,0,(LPARAM)_T("Parallel Point"));
18501850 SendDlgItemMessage(hWnd,IDC_LIGHTTYPE,CB_ADDSTRING,0,(LPARAM)_T("GL Spot"));
18511851 SendDlgItemMessage(hWnd,IDC_LIGHTTYPE,CB_SETCURSEL,D3DLIGHT_DIRECTIONAL-1,0);
 1852+ SendDlgItemMessage(hWnd,IDC_LIGHTENABLED,BM_SETCHECK,BST_CHECKED,0);
18521853 ::width = ddsd.dwWidth;
18531854 ::height = ddsd.dwHeight;
18541855 vertexshaderstate.texture = NULL;
@@ -2138,7 +2139,42 @@
21392140 strupper(tmpstring); paddwordzeroes(tmpstring);
21402141 SendDlgItemMessage(hWnd,IDC_LIGHTSPECULAR,WM_SETTEXT,0,(LPARAM)tmpstring);
21412142 SendDlgItemMessage(hWnd,IDC_LIGHTTYPE,CB_SETCURSEL,lights[vertexshaderstate.currentlight].dltType-1,0);
 2143+ if(lightenable[vertexshaderstate.currentlight])
 2144+ SendDlgItemMessage(hWnd,IDC_LIGHTENABLED,BM_SETCHECK,BST_CHECKED,0);
 2145+ else SendDlgItemMessage(hWnd,IDC_LIGHTENABLED,BM_SETCHECK,BST_UNCHECKED,0);
21422146 }
 2147+ break;
 2148+ case IDC_LIGHTENABLED:
 2149+ if(HIWORD(wParam) == BN_CLICKED)
 2150+ {
 2151+ if(SendDlgItemMessage(hWnd,IDC_LIGHTENABLED,BM_GETCHECK,0,0) == BST_CHECKED)
 2152+ {
 2153+ lightenable[vertexshaderstate.currentlight] = TRUE;
 2154+ d3d7dev->LightEnable(vertexshaderstate.currentlight,TRUE);
 2155+ }
 2156+ else
 2157+ {
 2158+ lightenable[vertexshaderstate.currentlight] = FALSE;
 2159+ d3d7dev->LightEnable(vertexshaderstate.currentlight,FALSE);
 2160+ }
 2161+ }
 2162+ break;
 2163+ case IDC_LIGHTTYPE:
 2164+ if(HIWORD(wParam) == CBN_SELCHANGE)
 2165+ {
 2166+ lights[vertexshaderstate.currentlight].dltType = (D3DLIGHTTYPE)
 2167+ (SendDlgItemMessage(hWnd,IDC_LIGHTTYPE,CB_GETCURSEL,0,0) + 1);
 2168+ d3d7dev->SetLight(vertexshaderstate.currentlight,&lights[vertexshaderstate.currentlight]);
 2169+ }
 2170+ break;
 2171+ case IDC_LIGHTRANGE:
 2172+ if(HIWORD(wParam) == EN_CHANGE)
 2173+ {
 2174+ SendDlgItemMessage(hWnd,IDC_LIGHTRANGE,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
 2175+ lights[vertexshaderstate.currentlight].dvRange = (float)_ttof(tmpstring);
 2176+ d3d7dev->SetLight(vertexshaderstate.currentlight,&lights[vertexshaderstate.currentlight]);
 2177+ }
 2178+ break;
21432179 default:
21442180 return FALSE;
21452181 }