DXGL r224 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r223‎ | r224 | r225 >
Date:23:31, 3 August 2012
Author:admin
Status:new
Tags:
Comment:
Populate Texture Shader dialog controls.
Modified paths:
  • /dxgltest/Tests3D.cpp (modified) (history)
  • /dxgltest/dxgltest.rc (modified) (history)

Diff [purge]

Index: dxgltest/Tests3D.cpp
@@ -634,9 +634,10 @@
635635 case 2:
636636 MakeCube3D(points,normals,vertices);
637637 ZeroMemory(&material,sizeof(D3DMATERIAL7));
638 - material.diffuse.r = 1.0f;
639 - material.diffuse.g = 1.0f;
640 - material.diffuse.b = 1.0f;
 638+ material.ambient.r = 1.0f;
 639+ material.ambient.g = 1.0f;
 640+ material.ambient.b = 1.0f;
 641+ material.ambient.a = 1.0f;
641642 error = d3d7dev->SetMaterial(&material);
642643 error = d3d7dev->SetRenderState(D3DRENDERSTATE_LIGHTING, TRUE);
643644 error = d3d7dev->SetRenderState(D3DRENDERSTATE_AMBIENT, 0xffffffff);
@@ -750,7 +751,93 @@
751752 {
752753 }
753754
 755+void PopulateArgCombo(HWND hWnd)
 756+{
 757+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Diffuse"));
 758+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Current"));
 759+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Texture"));
 760+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Factor"));
 761+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Specular"));
 762+}
754763
 764+void PopulateOpCombo(HWND hWnd, bool color)
 765+{
 766+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Disable"));
 767+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Select Arg 1"));
 768+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Select Arg 2"));
 769+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Modulate"));
 770+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Modulate 2x"));
 771+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Modulate 4x"));
 772+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Add"));
 773+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Add Signed"));
 774+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Add Signed 2x"));
 775+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Subtract"));
 776+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Add Smooth"));
 777+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Blend Diffuse Alpha"));
 778+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Blend Texture Alpha"));
 779+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Blend Factor Alpha"));
 780+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Blend Texture Alpha PM"));
 781+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Blend Current Alpha"));
 782+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Premodulate"));
 783+ if(color)
 784+ {
 785+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Modulate Alpha Add Color"));
 786+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Modulate Color Add Alpha"));
 787+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Modulate Inv. Alpha Add Color"));
 788+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Modulate Inv. Color Add Alpha"));
 789+ }
 790+ else
 791+ {
 792+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("(invalid)"));
 793+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("(invalid)"));
 794+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("(invalid)"));
 795+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("(invalid)"));
 796+ }
 797+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Bump Env. Map"));
 798+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Bump Env. Map Luminance"));
 799+ if(color) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Dot Product3"));
 800+}
 801+
 802+void PopulateBlendCombo(HWND hWnd, bool src)
 803+{
 804+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Zero"));
 805+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("One"));
 806+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Source Color"));
 807+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Inv. Src. Color"));
 808+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Source Alpha"));
 809+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Inv. Src. Alpha"));
 810+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Dest. Alpha"));
 811+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Inv. Dest. Alpha"));
 812+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Dest. Color"));
 813+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Inv. Dest. Color"));
 814+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Src. Alpha Sat."));
 815+ if(src)
 816+ {
 817+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Both Src. Alpha"));
 818+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Both Inv. Src. Alpha"));
 819+ }
 820+}
 821+
 822+void PopulateCompareCombo(HWND hWnd)
 823+{
 824+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Never"));
 825+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Less"));
 826+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Equal"));
 827+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Less or Equal"));
 828+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Greater"));
 829+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Not Equal"));
 830+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Greater or Equal"));
 831+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Always"));
 832+}
 833+
 834+void PopulateFogCombo(HWND hWnd)
 835+{
 836+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("None"));
 837+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Exponential"));
 838+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Exp. Squared"));
 839+ SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Linear"));
 840+}
 841+
755842 INT_PTR CALLBACK TexShader7Proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
756843 {
757844 HRESULT error;
@@ -804,7 +891,43 @@
805892 error = d3d7dev->SetViewport(&vp);
806893 error = d3d7dev->SetRenderState(D3DRENDERSTATE_ZENABLE,TRUE);
807894 InitTest3D(2);
808 -
 895+ SendDlgItemMessage(hWnd,IDC_SPINSTAGE,UDM_SETRANGE32,0,7);
 896+ SendDlgItemMessage(hWnd,IDC_TEXCOLORKEY,WM_SETTEXT,0,(LPARAM)_T("FFFFFFFF"));
 897+ SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("None"));
 898+ SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("Gradients"));
 899+ SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("DXGL logo (small)"));
 900+ SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("DXGL logo (large)"));
 901+ SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("Texture file"));
 902+ SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_SETCURSEL,0,0);
 903+ PopulateArgCombo(GetDlgItem(hWnd,IDC_CARG1));
 904+ PopulateArgCombo(GetDlgItem(hWnd,IDC_CARG2));
 905+ PopulateArgCombo(GetDlgItem(hWnd,IDC_AARG1));
 906+ PopulateArgCombo(GetDlgItem(hWnd,IDC_AARG2));
 907+ SendDlgItemMessage(hWnd,IDC_CARG1,CB_SETCURSEL,D3DTA_TEXTURE,0);
 908+ SendDlgItemMessage(hWnd,IDC_CARG2,CB_SETCURSEL,D3DTA_CURRENT,0);
 909+ SendDlgItemMessage(hWnd,IDC_AARG1,CB_SETCURSEL,D3DTA_TEXTURE,0);
 910+ SendDlgItemMessage(hWnd,IDC_AARG2,CB_SETCURSEL,D3DTA_CURRENT,0);
 911+ PopulateOpCombo(GetDlgItem(hWnd,IDC_COLOROP),true);
 912+ PopulateOpCombo(GetDlgItem(hWnd,IDC_ALPHAOP),false);
 913+ SendDlgItemMessage(hWnd,IDC_COLOROP,CB_SETCURSEL,D3DTOP_MODULATE-1,0);
 914+ SendDlgItemMessage(hWnd,IDC_ALPHAOP,CB_SETCURSEL,D3DTOP_SELECTARG1-1,0);
 915+ SendDlgItemMessage(hWnd,IDC_DIFFUSE,WM_SETTEXT,0,(LPARAM)_T("FFFFFFFF"));
 916+ SendDlgItemMessage(hWnd,IDC_SPECULAR,WM_SETTEXT,0,(LPARAM)_T("00000000"));
 917+ SendDlgItemMessage(hWnd,IDC_FACTOR,WM_SETTEXT,0,(LPARAM)_T("00000000"));
 918+ SendDlgItemMessage(hWnd,IDC_FOGCOLOR,WM_SETTEXT,0,(LPARAM)_T("00000000"));
 919+ PopulateBlendCombo(GetDlgItem(hWnd,IDC_SRCBLEND),true);
 920+ PopulateBlendCombo(GetDlgItem(hWnd,IDC_DESTBLEND),true);
 921+ SendDlgItemMessage(hWnd,IDC_SRCBLEND,CB_SETCURSEL,D3DBLEND_ONE-1,0);
 922+ SendDlgItemMessage(hWnd,IDC_DESTBLEND,CB_SETCURSEL,D3DBLEND_ZERO-1,0);
 923+ PopulateCompareCombo(GetDlgItem(hWnd,IDC_ALPHAFUNC));
 924+ SendDlgItemMessage(hWnd,IDC_ALPHAFUNC,CB_SETCURSEL,D3DCMP_ALWAYS-1,0);
 925+ PopulateFogCombo(GetDlgItem(hWnd,IDC_VERTEXFOGMODE));
 926+ PopulateFogCombo(GetDlgItem(hWnd,IDC_PIXELFOGMODE));
 927+ SendDlgItemMessage(hWnd,IDC_VERTEXFOGMODE,CB_SETCURSEL,D3DFOG_NONE,0);
 928+ SendDlgItemMessage(hWnd,IDC_PIXELFOGMODE,CB_SETCURSEL,D3DFOG_NONE,0);
 929+ SendDlgItemMessage(hWnd,IDC_FOGSTART,WM_SETTEXT,0,(LPARAM)_T("0.0"));
 930+ SendDlgItemMessage(hWnd,IDC_FOGEND,WM_SETTEXT,0,(LPARAM)_T("1.0"));
 931+ SendDlgItemMessage(hWnd,IDC_FOGDENSITY,WM_SETTEXT,0,(LPARAM)_T("1.0"));
809932 ::width = ddsd.dwWidth;
810933 ::height = ddsd.dwHeight;
811934 StartTimer(hWnd,WM_APP,60);
Index: dxgltest/dxgltest.rc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream