DXGL r228 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r227‎ | r228 | r229 >
Date:21:58, 5 August 2012
Author:admin
Status:new
Tags:
Comment:
Add background color to Texture Shader demo.
Orient textures properly in Texture 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
@@ -39,6 +39,7 @@
4040 #define IDC_TEXTUREPREVIEW 1003
4141 #define IDC_DISPLAY 1004
4242 #define IDC_TESTLIST 1004
 43+#define IDC_BGCOLOR 1007
4344 #define IDC_WINDOWED 1008
4445 #define IDC_FULLSCREEN 1009
4546 #define IDC_APIVER 1012
@@ -111,3 +112,4 @@
112113 #define IDC_FOGEND 1099
113114 #define IDC_FOGDENSITY 1100
114115 #define IDC_RANGEBASEDFOG 1101
 116+#define IDC_BGCOLORSELECT 1102
Index: dxgltest/Tests3D.cpp
@@ -53,6 +53,7 @@
5454 static WORD cube_mesh[] = {0,1,2, 2,1,3, 4,5,6, 6,5,7, 8,9,10, 10,9,11, 12,13,14, 14,13,15, 16,17,18,
5555 18,17,19, 20,21,22, 22,21,23 };
5656 static D3DLIGHT7 lights[8];
 57+static DWORD bgcolor = 0;
5758
5859 typedef struct
5960 {
@@ -465,30 +466,30 @@
466467 normals[3] = D3DVECTOR(-1.0f,0.0f,0.0f);
467468 normals[4] = D3DVECTOR(0.0f,1.0f,0.0f);
468469 normals[5] = D3DVECTOR(0.0f,-10.0f,0.0f);
469 - vertices[0] = D3DVERTEX(points[0],normals[0],0,0);
470 - vertices[1] = D3DVERTEX(points[1],normals[0],1,0);
471 - vertices[2] = D3DVERTEX(points[2],normals[0],0,1);
472 - vertices[3] = D3DVERTEX(points[3],normals[0],1,1);
473 - vertices[4] = D3DVERTEX(points[2],normals[1],0,0);
474 - vertices[5] = D3DVERTEX(points[3],normals[1],1,0);
475 - vertices[6] = D3DVERTEX(points[4],normals[1],0,1);
476 - vertices[7] = D3DVERTEX(points[5],normals[1],1,1);
477 - vertices[8] = D3DVERTEX(points[4],normals[2],0,0);
478 - vertices[9] = D3DVERTEX(points[5],normals[2],1,0);
479 - vertices[10] = D3DVERTEX(points[6],normals[2],0,1);
480 - vertices[11] = D3DVERTEX(points[7],normals[2],1,1);
481 - vertices[12] = D3DVERTEX(points[6],normals[3],0,0);
482 - vertices[13] = D3DVERTEX(points[7],normals[3],1,0);
483 - vertices[14] = D3DVERTEX(points[0],normals[3],0,1);
484 - vertices[15] = D3DVERTEX(points[1],normals[3],1,1);
485 - vertices[16] = D3DVERTEX(points[1],normals[4],0,0);
486 - vertices[17] = D3DVERTEX(points[7],normals[4],1,0);
487 - vertices[18] = D3DVERTEX(points[3],normals[4],0,1);
488 - vertices[19] = D3DVERTEX(points[5],normals[4],1,1);
489 - vertices[20] = D3DVERTEX(points[6],normals[5],0,0);
490 - vertices[21] = D3DVERTEX(points[0],normals[5],1,0);
491 - vertices[22] = D3DVERTEX(points[4],normals[5],0,1);
492 - vertices[23] = D3DVERTEX(points[2],normals[5],1,1);
 470+ vertices[0] = D3DVERTEX(points[0],normals[0],0,1);
 471+ vertices[1] = D3DVERTEX(points[1],normals[0],0,0);
 472+ vertices[2] = D3DVERTEX(points[2],normals[0],1,1);
 473+ vertices[3] = D3DVERTEX(points[3],normals[0],1,0);
 474+ vertices[4] = D3DVERTEX(points[2],normals[1],0,1);
 475+ vertices[5] = D3DVERTEX(points[3],normals[1],0,0);
 476+ vertices[6] = D3DVERTEX(points[4],normals[1],1,1);
 477+ vertices[7] = D3DVERTEX(points[5],normals[1],1,0);
 478+ vertices[8] = D3DVERTEX(points[4],normals[2],0,1);
 479+ vertices[9] = D3DVERTEX(points[5],normals[2],0,0);
 480+ vertices[10] = D3DVERTEX(points[6],normals[2],1,1);
 481+ vertices[11] = D3DVERTEX(points[7],normals[2],1,0);
 482+ vertices[12] = D3DVERTEX(points[6],normals[3],0,1);
 483+ vertices[13] = D3DVERTEX(points[7],normals[3],0,0);
 484+ vertices[14] = D3DVERTEX(points[0],normals[3],1,1);
 485+ vertices[15] = D3DVERTEX(points[1],normals[3],1,0);
 486+ vertices[16] = D3DVERTEX(points[1],normals[4],0,1);
 487+ vertices[17] = D3DVERTEX(points[7],normals[4],0,0);
 488+ vertices[18] = D3DVERTEX(points[3],normals[4],1,1);
 489+ vertices[19] = D3DVERTEX(points[5],normals[4],1,0);
 490+ vertices[20] = D3DVERTEX(points[6],normals[5],0,1);
 491+ vertices[21] = D3DVERTEX(points[0],normals[5],0,0);
 492+ vertices[22] = D3DVERTEX(points[4],normals[5],1,1);
 493+ vertices[23] = D3DVERTEX(points[2],normals[5],1,0);
493494 }
494495
495496 DDPIXELFORMAT texformats[256];
@@ -545,6 +546,7 @@
546547 D3DMATRIX matProj;
547548 D3DMATRIX mat;
548549 D3DMATERIAL7 material;
 550+ bgcolor = 0;
549551 switch(test)
550552 {
551553 case 0:
@@ -675,7 +677,7 @@
676678 ZeroMemory(&ddsd,sizeof(DDSURFACEDESC2));
677679 if(d3dver >= 3) ddsd.dwSize = sizeof(DDSURFACEDESC2);
678680 else ddsd.dwSize = sizeof(DDSURFACEDESC);
679 - error = d3d7dev->Clear(0,NULL,D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,0,1.0,0);
 681+ error = d3d7dev->Clear(0,NULL,D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,bgcolor,1.0,0);
680682 float time = (float)clock() / (float)CLOCKS_PER_SEC;
681683 switch(test)
682684 {
@@ -1199,7 +1201,6 @@
12001202 d3d7dev->SetTextureStageState(number,D3DTSS_ALPHAARG2,texshaderstate.texstages[number].alphaarg2);
12011203 }
12021204 break;
1203 - }
12041205 case IDC_COLOROP:
12051206 if(HIWORD(wParam) == CBN_SELCHANGE)
12061207 {
@@ -1216,6 +1217,15 @@
12171218 d3d7dev->SetTextureStageState(number,D3DTSS_ALPHAOP,texshaderstate.texstages[number].alphaop);
12181219 }
12191220 break;
 1221+ case IDC_BGCOLOR:
 1222+ if(HIWORD(wParam) == EN_CHANGE)
 1223+ {
 1224+ SendDlgItemMessage(hWnd,IDC_BGCOLOR,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
 1225+ _stscanf(tmpstring,_T("%x"),&bgcolor);
 1226+ }
 1227+ break;
 1228+ }
 1229+ break;
12201230 case WM_CLOSE:
12211231 ddinterface->Release();
12221232 EndDialog(hWnd,IDCANCEL);
Index: dxgltest/dxgltest.rc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream