DXGL r266 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r265‎ | r266 | r267 >
Date:18:01, 30 September 2012
Author:admin
Status:new
Tags:
Comment:
Add fog color to Texture Shader demo.
Add diffuse, specular, factor, fog, and background colors to Vertex Shader demo.
Add fill mode, shade mode, and cull mode to Vertex Shader demo.
Modified paths:
  • /dxgltest/Resource.h (modified) (history)
  • /dxgltest/Tests3D.cpp (modified) (history)
  • /dxgltest/dxgltest.rc (modified) (history)

Diff [purge]

Index: dxgltest/Resource.h
@@ -31,6 +31,7 @@
3232 #define IDC_DXDIAG 1000
3333 #define IDC_SPINSTAGE 1000
3434 #define IDC_VIDMODES 1000
 35+#define IDC_LIGHTENABLED 1001
3536 #define IDC_RESIZABLE 1001
3637 #define IDC_SPINALPHAREF 1001
3738 #define IDC_DDTYPE 1002
Index: dxgltest/Tests3D.cpp
@@ -1313,6 +1313,14 @@
13141314 d3d7dev->SetRenderState(D3DRENDERSTATE_TEXTUREFACTOR,number);
13151315 }
13161316 break;
 1317+ case IDC_FOGCOLOR:
 1318+ if(HIWORD(wParam) == EN_CHANGE)
 1319+ {
 1320+ SendDlgItemMessage(hWnd,IDC_FOGCOLOR,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
 1321+ _stscanf(tmpstring,_T("%x"),&number);
 1322+ d3d7dev->SetRenderState(D3DRENDERSTATE_FOGCOLOR,number);
 1323+ }
 1324+ break;
13171325 case IDC_TEXCOLORKEY:
13181326 if(HIWORD(wParam) == EN_CHANGE)
13191327 {
@@ -1390,6 +1398,7 @@
13911399 f = (float)_ttof(tmpstring);
13921400 d3d7dev->SetRenderState(D3DRENDERSTATE_FOGSTART, *((LPDWORD)(&f)));
13931401 }
 1402+ break;
13941403 case IDC_FOGEND:
13951404 if(HIWORD(wParam) == EN_CHANGE)
13961405 {
@@ -1397,6 +1406,7 @@
13981407 f = (float)_ttof(tmpstring);
13991408 d3d7dev->SetRenderState(D3DRENDERSTATE_FOGEND, *((LPDWORD)(&f)));
14001409 }
 1410+ break;
14011411 case IDC_FOGDENSITY:
14021412 if(HIWORD(wParam) == EN_CHANGE)
14031413 {
@@ -1404,6 +1414,7 @@
14051415 f = (float)_ttof(tmpstring);
14061416 d3d7dev->SetRenderState(D3DRENDERSTATE_FOGDENSITY, *((LPDWORD)(&f)));
14071417 }
 1418+ break;
14081419 default:
14091420 return FALSE;
14101421 }
@@ -1495,9 +1506,23 @@
14961507 SendDlgItemMessage(hWnd,IDC_MATAMBIENT,WM_SETTEXT,0,(LPARAM)_T("FFFFFFFF"));
14971508 PopulateFogCombo(GetDlgItem(hWnd,IDC_VERTEXFOGMODE));
14981509 PopulateFogCombo(GetDlgItem(hWnd,IDC_PIXELFOGMODE));
 1510+ SendDlgItemMessage(hWnd,IDC_VERTEXFOGMODE,CB_SETCURSEL,D3DFOG_NONE,0);
 1511+ SendDlgItemMessage(hWnd,IDC_PIXELFOGMODE,CB_SETCURSEL,D3DFOG_NONE,0);
14991512 SendDlgItemMessage(hWnd,IDC_FOGSTART,WM_SETTEXT,0,(LPARAM)_T("0.0"));
15001513 SendDlgItemMessage(hWnd,IDC_FOGEND,WM_SETTEXT,0,(LPARAM)_T("1.0"));
15011514 SendDlgItemMessage(hWnd,IDC_FOGDENSITY,WM_SETTEXT,0,(LPARAM)_T("1.0"));
 1515+ SendDlgItemMessage(hWnd,IDC_FILLMODE,CB_ADDSTRING,0,(LPARAM)_T("Points"));
 1516+ SendDlgItemMessage(hWnd,IDC_FILLMODE,CB_ADDSTRING,0,(LPARAM)_T("Wireframe"));
 1517+ SendDlgItemMessage(hWnd,IDC_FILLMODE,CB_ADDSTRING,0,(LPARAM)_T("Solid"));
 1518+ SendDlgItemMessage(hWnd,IDC_FILLMODE,CB_SETCURSEL,2,0);
 1519+ SendDlgItemMessage(hWnd,IDC_SHADEMODE,CB_ADDSTRING,0,(LPARAM)_T("Flat"));
 1520+ SendDlgItemMessage(hWnd,IDC_SHADEMODE,CB_ADDSTRING,0,(LPARAM)_T("Gouraud"));
 1521+ SendDlgItemMessage(hWnd,IDC_SHADEMODE,CB_ADDSTRING,0,(LPARAM)_T("Phong"));
 1522+ SendDlgItemMessage(hWnd,IDC_SHADEMODE,CB_SETCURSEL,1,0);
 1523+ SendDlgItemMessage(hWnd,IDC_CULLMODE,CB_ADDSTRING,0,(LPARAM)_T("None"));
 1524+ SendDlgItemMessage(hWnd,IDC_CULLMODE,CB_ADDSTRING,0,(LPARAM)_T("CW"));
 1525+ SendDlgItemMessage(hWnd,IDC_CULLMODE,CB_ADDSTRING,0,(LPARAM)_T("CCW"));
 1526+ SendDlgItemMessage(hWnd,IDC_CULLMODE,CB_SETCURSEL,2,0);
15021527 ::width = ddsd.dwWidth;
15031528 ::height = ddsd.dwHeight;
15041529 vertexshaderstate.texture = NULL;
@@ -1560,6 +1585,7 @@
15611586 f = (float)_ttof(tmpstring);
15621587 d3d7dev->SetRenderState(D3DRENDERSTATE_FOGSTART, *((LPDWORD)(&f)));
15631588 }
 1589+ break;
15641590 case IDC_FOGEND:
15651591 if(HIWORD(wParam) == EN_CHANGE)
15661592 {
@@ -1567,6 +1593,7 @@
15681594 f = (float)_ttof(tmpstring);
15691595 d3d7dev->SetRenderState(D3DRENDERSTATE_FOGEND, *((LPDWORD)(&f)));
15701596 }
 1597+ break;
15711598 case IDC_FOGDENSITY:
15721599 if(HIWORD(wParam) == EN_CHANGE)
15731600 {
@@ -1574,6 +1601,67 @@
15751602 f = (float)_ttof(tmpstring);
15761603 d3d7dev->SetRenderState(D3DRENDERSTATE_FOGDENSITY, *((LPDWORD)(&f)));
15771604 }
 1605+ break;
 1606+ case IDC_FILLMODE:
 1607+ if(HIWORD(wParam) == CBN_SELCHANGE)
 1608+ {
 1609+ d3d7dev->SetRenderState(D3DRENDERSTATE_FILLMODE,SendDlgItemMessage(hWnd,
 1610+ IDC_FILLMODE,CB_GETCURSEL,0,0)+1);
 1611+ }
 1612+ break;
 1613+ case IDC_SHADEMODE:
 1614+ if(HIWORD(wParam) == CBN_SELCHANGE)
 1615+ {
 1616+ d3d7dev->SetRenderState(D3DRENDERSTATE_SHADEMODE,SendDlgItemMessage(hWnd,
 1617+ IDC_SHADEMODE,CB_GETCURSEL,0,0)+1);
 1618+ }
 1619+ break;
 1620+ case IDC_CULLMODE:
 1621+ if(HIWORD(wParam) == CBN_SELCHANGE)
 1622+ {
 1623+ d3d7dev->SetRenderState(D3DRENDERSTATE_CULLMODE,SendDlgItemMessage(hWnd,
 1624+ IDC_CULLMODE,CB_GETCURSEL,0,0)+1);
 1625+ }
 1626+ break;
 1627+ case IDC_DIFFUSE:
 1628+ if(HIWORD(wParam) == EN_CHANGE)
 1629+ {
 1630+ SendDlgItemMessage(hWnd,IDC_DIFFUSE,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
 1631+ _stscanf(tmpstring,_T("%x"),&number);
 1632+ SetVertexColor(litvertices,24,number);
 1633+ }
 1634+ break;
 1635+ case IDC_SPECULAR:
 1636+ if(HIWORD(wParam) == EN_CHANGE)
 1637+ {
 1638+ SendDlgItemMessage(hWnd,IDC_SPECULAR,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
 1639+ _stscanf(tmpstring,_T("%x"),&number);
 1640+ SetVertexSpecular(litvertices,24,number);
 1641+ }
 1642+ break;
 1643+ case IDC_FACTOR:
 1644+ if(HIWORD(wParam) == EN_CHANGE)
 1645+ {
 1646+ SendDlgItemMessage(hWnd,IDC_FACTOR,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
 1647+ _stscanf(tmpstring,_T("%x"),&number);
 1648+ d3d7dev->SetRenderState(D3DRENDERSTATE_TEXTUREFACTOR,number);
 1649+ }
 1650+ break;
 1651+ case IDC_FOGCOLOR:
 1652+ if(HIWORD(wParam) == EN_CHANGE)
 1653+ {
 1654+ SendDlgItemMessage(hWnd,IDC_FOGCOLOR,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
 1655+ _stscanf(tmpstring,_T("%x"),&number);
 1656+ d3d7dev->SetRenderState(D3DRENDERSTATE_FOGCOLOR,number);
 1657+ }
 1658+ break;
 1659+ case IDC_BGCOLOR:
 1660+ if(HIWORD(wParam) == EN_CHANGE)
 1661+ {
 1662+ SendDlgItemMessage(hWnd,IDC_BGCOLOR,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
 1663+ _stscanf(tmpstring,_T("%x"),&bgcolor);
 1664+ }
 1665+ break;
15781666 default:
15791667 return FALSE;
15801668 }
Index: dxgltest/dxgltest.rc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream