Index: dxgltest/Resource.h |
— | — | @@ -35,6 +35,7 @@ |
36 | 36 | #define IDC_RESIZABLE 1001
|
37 | 37 | #define IDC_SPINALPHAREF 1001
|
38 | 38 | #define IDC_DDTYPE 1002
|
| 39 | +#define IDC_SPINDETAIL 1002
|
39 | 40 | #define IDC_SPINLINEREPEAT 1002
|
40 | 41 | #define IDC_TABS 1002
|
41 | 42 | #define IDC_TESTHEADER 1002
|
— | — | @@ -43,6 +44,7 @@ |
44 | 45 | #define IDC_TESTLIST 1004
|
45 | 46 | #define IDC_FILLMODE 1005
|
46 | 47 | #define IDC_ALPHABLEND 1006
|
| 48 | +#define IDC_DIFFUSESOURCE 1006
|
47 | 49 | #define IDC_BGCOLOR 1007
|
48 | 50 | #define IDC_SHADEMODE 1008
|
49 | 51 | #define IDC_WINDOWED 1008
|
— | — | @@ -50,14 +52,22 @@ |
51 | 53 | #define IDC_CULLMODE 1010
|
52 | 54 | #define IDC_FOGENABLE 1011
|
53 | 55 | #define IDC_APIVER 1012
|
| 56 | +#define IDC_MATDIFFUSESELECT 1012
|
| 57 | +#define IDC_MATDIFFUSE 1013
|
54 | 58 | #define IDC_SPINAPI 1013
|
55 | 59 | #define IDC_ENABLELIGHT 1014
|
56 | 60 | #define IDC_ENABLESPECULAR 1015
|
57 | 61 | #define IDC_VSYNC 1015
|
| 62 | +#define IDC_DETAIL 1016
|
58 | 63 | #define IDC_AMBIENT 1017
|
59 | 64 | #define IDC_BUFFERS 1017
|
| 65 | +#define IDC_SPECULARSOURCE 1018
|
60 | 66 | #define IDC_SPINBACK 1019
|
| 67 | +#define IDC_MATSPECULARSELECT 1020
|
| 68 | +#define IDC_MATSPECULAR 1021
|
| 69 | +#define IDC_AMBIENTSOURCE 1022
|
61 | 70 | #define IDC_FRAMERATE 1023
|
| 71 | +#define IDC_EMISSIVESOURCE 1024
|
62 | 72 | #define IDC_SPINFRAME 1024
|
63 | 73 | #define IDC_FSAA 1026
|
64 | 74 | #define IDC_FILTERLABEL 1027
|
— | — | @@ -132,7 +142,7 @@ |
133 | 143 | #define IDC_MATAMBIENTSELECT 1116
|
134 | 144 | #define IDC_POWER 1118
|
135 | 145 | #define IDC_LIGHTNUMBER 1120
|
136 | | -#define IDC_SPIN1 1121
|
| 146 | +#define IDC_SPINLIGHT 1121
|
137 | 147 | #define IDC_LIGHTTYPE 1123
|
138 | 148 | #define IDC_LIGHTDIFFUSE 1126
|
139 | 149 | #define IDC_LIGHTDIFFUSESELECT 1127
|
Index: dxgltest/Tests3D.cpp |
— | — | @@ -37,6 +37,7 @@ |
38 | 38 | static MultiDirectDrawSurface *textures[8];
|
39 | 39 | static IDirect3D7 *d3d7;
|
40 | 40 | static IDirect3DDevice7 *d3d7dev;
|
| 41 | +D3DMATERIAL7 material;
|
41 | 42 | static LPDIRECTDRAWCLIPPER ddclipper;
|
42 | 43 | static int width,height,bpp,refresh,backbuffers;
|
43 | 44 | static double fps;
|
— | — | @@ -46,14 +47,40 @@ |
47 | 48 | static unsigned int randnum;
|
48 | 49 | static int testtypes[] = {0,0,0};
|
49 | 50 |
|
50 | | -static D3DVECTOR points[256];
|
51 | | -static D3DVECTOR normals[256];
|
52 | | -static D3DVERTEX vertices[256];
|
53 | | -static D3DLVERTEX litvertices[256];
|
54 | | -static WORD mesh[256];
|
55 | | -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,
|
56 | | - 18,17,19, 20,21,22, 22,21,23 };
|
| 51 | +#define FVF_COLORVERTEX (D3DFVF_VERTEX | D3DFVF_DIFFUSE | D3DFVF_SPECULAR)
|
| 52 | +struct COLORVERTEX
|
| 53 | +{
|
| 54 | + D3DVALUE x;
|
| 55 | + D3DVALUE y;
|
| 56 | + D3DVALUE z;
|
| 57 | + D3DVALUE nx;
|
| 58 | + D3DVALUE ny;
|
| 59 | + D3DVALUE nz;
|
| 60 | + D3DCOLOR color;
|
| 61 | + D3DCOLOR specular;
|
| 62 | + D3DVALUE tu;
|
| 63 | + D3DVALUE tv;
|
| 64 | +public:
|
| 65 | + COLORVERTEX() {};
|
| 66 | + COLORVERTEX(const D3DVECTOR& v, const D3DVECTOR& n, D3DCOLOR _color,
|
| 67 | + D3DCOLOR _specular, D3DVALUE _tu, D3DVALUE _tv)
|
| 68 | + {
|
| 69 | + x = v.x; y = v.y; z = v.z;
|
| 70 | + nx = n.x; ny = n.y; nz = n.z;
|
| 71 | + color = _color; specular = _specular;
|
| 72 | + tu = _tu; tv = _tv;
|
| 73 | + }
|
| 74 | +
|
| 75 | +};
|
| 76 | +
|
| 77 | +static int numpoints = 0;
|
| 78 | +static int numindices = 0;
|
| 79 | +static D3DVERTEX *vertices = NULL;
|
| 80 | +static D3DLVERTEX *litvertices = NULL;
|
| 81 | +static COLORVERTEX *colorvertices = NULL;
|
| 82 | +static WORD *mesh = NULL;
|
57 | 83 | static D3DLIGHT7 lights[8];
|
| 84 | +static BOOL lightenable[8];
|
58 | 85 | static DWORD bgcolor = 0;
|
59 | 86 |
|
60 | 87 | typedef struct
|
— | — | @@ -201,6 +228,26 @@ |
202 | 229 | ddinterface->Release();
|
203 | 230 | ddinterface = NULL;
|
204 | 231 | }
|
| 232 | + if(mesh)
|
| 233 | + {
|
| 234 | + free(mesh);
|
| 235 | + mesh = NULL;
|
| 236 | + }
|
| 237 | + if(vertices)
|
| 238 | + {
|
| 239 | + free(vertices);
|
| 240 | + vertices = NULL;
|
| 241 | + }
|
| 242 | + if(litvertices)
|
| 243 | + {
|
| 244 | + free(litvertices);
|
| 245 | + litvertices = NULL;
|
| 246 | + }
|
| 247 | + if(colorvertices)
|
| 248 | + {
|
| 249 | + free(colorvertices);
|
| 250 | + colorvertices = NULL;
|
| 251 | + }
|
205 | 252 | PostQuitMessage(0);
|
206 | 253 | break;
|
207 | 254 | case WM_KEYDOWN:
|
— | — | @@ -466,82 +513,182 @@ |
467 | 514 | StopTimer();
|
468 | 515 | }
|
469 | 516 |
|
470 | | -void MakeCube3D()
|
| 517 | +void MakeCube3D(float size, int detail)
|
471 | 518 | {
|
472 | | - points[0] = D3DVECTOR(-2.5f,-2.5f,-2.5f);
|
473 | | - points[1] = D3DVECTOR(-2.5f,2.5f,-2.5f);
|
474 | | - points[2] = D3DVECTOR(2.5f,-2.5f,-2.5f);
|
475 | | - points[3] = D3DVECTOR(2.5f,2.5f,-2.5f);
|
476 | | - points[4] = D3DVECTOR(2.5f,-2.5f,2.5f);
|
477 | | - points[5] = D3DVECTOR(2.5f,2.5f,2.5f);
|
478 | | - points[6] = D3DVECTOR(-2.5f,-2.5f,2.5f);
|
479 | | - points[7] = D3DVECTOR(-2.5f,2.5f,2.5f);
|
| 519 | + if(detail < 2) return;
|
| 520 | + D3DVECTOR normals[6];
|
480 | 521 | normals[0] = D3DVECTOR(0.0f,0.0f,-1.0f);
|
481 | 522 | normals[1] = D3DVECTOR(1.0f,0.0f,0.0f);
|
482 | 523 | normals[2] = D3DVECTOR(0.0f,0.0f,1.0f);
|
483 | 524 | normals[3] = D3DVECTOR(-1.0f,0.0f,0.0f);
|
484 | 525 | normals[4] = D3DVECTOR(0.0f,1.0f,0.0f);
|
485 | | - normals[5] = D3DVECTOR(0.0f,-10.0f,0.0f);
|
486 | | - vertices[0] = D3DVERTEX(points[0],normals[0],0,1);
|
487 | | - vertices[1] = D3DVERTEX(points[1],normals[0],0,0);
|
488 | | - vertices[2] = D3DVERTEX(points[2],normals[0],1,1);
|
489 | | - vertices[3] = D3DVERTEX(points[3],normals[0],1,0);
|
490 | | - vertices[4] = D3DVERTEX(points[2],normals[1],0,1);
|
491 | | - vertices[5] = D3DVERTEX(points[3],normals[1],0,0);
|
492 | | - vertices[6] = D3DVERTEX(points[4],normals[1],1,1);
|
493 | | - vertices[7] = D3DVERTEX(points[5],normals[1],1,0);
|
494 | | - vertices[8] = D3DVERTEX(points[4],normals[2],0,1);
|
495 | | - vertices[9] = D3DVERTEX(points[5],normals[2],0,0);
|
496 | | - vertices[10] = D3DVERTEX(points[6],normals[2],1,1);
|
497 | | - vertices[11] = D3DVERTEX(points[7],normals[2],1,0);
|
498 | | - vertices[12] = D3DVERTEX(points[6],normals[3],0,1);
|
499 | | - vertices[13] = D3DVERTEX(points[7],normals[3],0,0);
|
500 | | - vertices[14] = D3DVERTEX(points[0],normals[3],1,1);
|
501 | | - vertices[15] = D3DVERTEX(points[1],normals[3],1,0);
|
502 | | - vertices[16] = D3DVERTEX(points[1],normals[4],0,1);
|
503 | | - vertices[17] = D3DVERTEX(points[7],normals[4],0,0);
|
504 | | - vertices[18] = D3DVERTEX(points[3],normals[4],1,1);
|
505 | | - vertices[19] = D3DVERTEX(points[5],normals[4],1,0);
|
506 | | - vertices[20] = D3DVERTEX(points[6],normals[5],0,1);
|
507 | | - vertices[21] = D3DVERTEX(points[0],normals[5],0,0);
|
508 | | - vertices[22] = D3DVERTEX(points[4],normals[5],1,1);
|
509 | | - vertices[23] = D3DVERTEX(points[2],normals[5],1,0);
|
510 | | - litvertices[0] = D3DLVERTEX(points[0],0xFFFFFFFF,0,0,1);
|
511 | | - litvertices[1] = D3DLVERTEX(points[1],0xFFFFFFFF,0,0,0);
|
512 | | - litvertices[2] = D3DLVERTEX(points[2],0xFFFFFFFF,0,1,1);
|
513 | | - litvertices[3] = D3DLVERTEX(points[3],0xFFFFFFFF,0,1,0);
|
514 | | - litvertices[4] = D3DLVERTEX(points[2],0xFFFFFFFF,0,0,1);
|
515 | | - litvertices[5] = D3DLVERTEX(points[3],0xFFFFFFFF,0,0,0);
|
516 | | - litvertices[6] = D3DLVERTEX(points[4],0xFFFFFFFF,0,1,1);
|
517 | | - litvertices[7] = D3DLVERTEX(points[5],0xFFFFFFFF,0,1,0);
|
518 | | - litvertices[8] = D3DLVERTEX(points[4],0xFFFFFFFF,0,0,1);
|
519 | | - litvertices[9] = D3DLVERTEX(points[5],0xFFFFFFFF,0,0,0);
|
520 | | - litvertices[10] = D3DLVERTEX(points[6],0xFFFFFFFF,0,1,1);
|
521 | | - litvertices[11] = D3DLVERTEX(points[7],0xFFFFFFFF,0,1,0);
|
522 | | - litvertices[12] = D3DLVERTEX(points[6],0xFFFFFFFF,0,0,1);
|
523 | | - litvertices[13] = D3DLVERTEX(points[7],0xFFFFFFFF,0,0,0);
|
524 | | - litvertices[14] = D3DLVERTEX(points[0],0xFFFFFFFF,0,1,1);
|
525 | | - litvertices[15] = D3DLVERTEX(points[1],0xFFFFFFFF,0,1,0);
|
526 | | - litvertices[16] = D3DLVERTEX(points[1],0xFFFFFFFF,0,0,1);
|
527 | | - litvertices[17] = D3DLVERTEX(points[7],0xFFFFFFFF,0,0,0);
|
528 | | - litvertices[18] = D3DLVERTEX(points[3],0xFFFFFFFF,0,1,1);
|
529 | | - litvertices[19] = D3DLVERTEX(points[5],0xFFFFFFFF,0,1,0);
|
530 | | - litvertices[20] = D3DLVERTEX(points[6],0xFFFFFFFF,0,0,1);
|
531 | | - litvertices[21] = D3DLVERTEX(points[0],0xFFFFFFFF,0,0,0);
|
532 | | - litvertices[22] = D3DLVERTEX(points[4],0xFFFFFFFF,0,1,1);
|
533 | | - litvertices[23] = D3DLVERTEX(points[2],0xFFFFFFFF,0,1,0);
|
| 526 | + normals[5] = D3DVECTOR(0.0f,-1.0f,0.0f);
|
| 527 | + int numfacevertices = detail*detail;
|
| 528 | + D3DVECTOR *face = (D3DVECTOR*)malloc(numfacevertices*sizeof(D3DVECTOR));
|
| 529 | + int numfaceindices = ((detail-1)*(detail-1))*6;
|
| 530 | + WORD *faceindex = (WORD*)malloc(numfaceindices*sizeof(WORD));
|
| 531 | + int ptr = 0;
|
| 532 | + float fx,fy;
|
| 533 | + // Generate points
|
| 534 | + for(int y = 0; y < detail; y++)
|
| 535 | + {
|
| 536 | + fy = (((float)(y / (float)(detail-1)))-.5f)*size;
|
| 537 | + for(int x = 0; x < detail; x++)
|
| 538 | + {
|
| 539 | + fx = (((float)(x / (float)(detail-1)))-.5f)*size;
|
| 540 | + face[ptr] = D3DVECTOR(fx,fy,0);
|
| 541 | + ptr++;
|
| 542 | + }
|
| 543 | + }
|
| 544 | + // Generate triangle indices
|
| 545 | + ptr = 0;
|
| 546 | + for(int y = 0; y < (detail-1); y++)
|
| 547 | + {
|
| 548 | + for(int x = 0; x < (detail-1); x++)
|
| 549 | + {
|
| 550 | + faceindex[ptr++] = x + (detail*y);
|
| 551 | + faceindex[ptr++] = x + (detail*(y+1));
|
| 552 | + faceindex[ptr++] = (x+1) + (detail*y);
|
| 553 | + faceindex[ptr++] = (x+1) + (detail*y);
|
| 554 | + faceindex[ptr++] = x + (detail*(y+1));
|
| 555 | + faceindex[ptr++] = (x+1) + (detail*(y+1));
|
| 556 | + }
|
| 557 | + }
|
| 558 | + numpoints = (detail*detail)*6;
|
| 559 | + numindices = ((detail-1)*(detail-1))*36;
|
| 560 | + if(vertices) free(vertices);
|
| 561 | + if(litvertices) free(litvertices);
|
| 562 | + if(colorvertices) free(colorvertices);
|
| 563 | + if(mesh) free(mesh);
|
| 564 | + vertices = (D3DVERTEX*)malloc(numpoints*sizeof(D3DVERTEX));
|
| 565 | + litvertices = (D3DLVERTEX*)malloc(numpoints*sizeof(D3DLVERTEX));
|
| 566 | + colorvertices = (COLORVERTEX*)malloc(numpoints*sizeof(COLORVERTEX));
|
| 567 | + mesh = (WORD*)malloc(numindices*sizeof(WORD));
|
| 568 | + // Generate vertex list
|
| 569 | + float u,v;
|
| 570 | + D3DVECTOR pos;
|
| 571 | + D3DVECTOR normal;
|
| 572 | + // Front face
|
| 573 | + ptr = 0;
|
| 574 | + for(int y = 0; y < detail; y++)
|
| 575 | + {
|
| 576 | + for(int x = 0; x < detail; x++)
|
| 577 | + {
|
| 578 | + u = (float)x/(float)(detail-1);
|
| 579 | + v = 1.f-((float)y/(float)(detail-1));
|
| 580 | + ptr = x+(detail*y);
|
| 581 | + pos = D3DVECTOR(face[ptr].x,face[ptr].y,-size/2.f);
|
| 582 | + normal = D3DVECTOR(0,0,-1);
|
| 583 | + vertices[ptr] = D3DVERTEX(pos,normal,u,v);
|
| 584 | + litvertices[ptr] = D3DLVERTEX(pos,0xFFFFFFFF,0,u,v);
|
| 585 | + colorvertices[ptr] = COLORVERTEX(pos,normal,0xFFFFFFFF,0,u,v);
|
| 586 | + }
|
| 587 | + }
|
| 588 | + // Right face
|
| 589 | + ptr = 0;
|
| 590 | + for(int y = 0; y < detail; y++)
|
| 591 | + {
|
| 592 | + for(int x = 0; x < detail; x++)
|
| 593 | + {
|
| 594 | + u = (float)x/(float)(detail-1);
|
| 595 | + v = 1.f-((float)y/(float)(detail-1));
|
| 596 | + ptr = x+(detail*y);
|
| 597 | + pos = D3DVECTOR(size/2.f,face[ptr].y,face[ptr].x);
|
| 598 | + normal = D3DVECTOR(1,0,0);
|
| 599 | + vertices[ptr+numfacevertices] = D3DVERTEX(pos,normal,u,v);
|
| 600 | + litvertices[ptr+numfacevertices] = D3DLVERTEX(pos,0xFFFFFFFF,0,u,v);
|
| 601 | + colorvertices[ptr+numfacevertices] = COLORVERTEX(pos,normal,0xFFFFFFFF,0,u,v);
|
| 602 | + }
|
| 603 | + }
|
| 604 | + // Back face
|
| 605 | + ptr = 0;
|
| 606 | + for(int y = 0; y < detail; y++)
|
| 607 | + {
|
| 608 | + for(int x = 0; x < detail; x++)
|
| 609 | + {
|
| 610 | + u = (float)x/(float)(detail-1);
|
| 611 | + v = 1.f-((float)y/(float)(detail-1));
|
| 612 | + ptr = x+(detail*y);
|
| 613 | + pos = D3DVECTOR(-face[ptr].x,face[ptr].y,size/2.f);
|
| 614 | + normal = D3DVECTOR(0,0,1);
|
| 615 | + vertices[ptr+(numfacevertices*2)] = D3DVERTEX(pos,normal,u,v);
|
| 616 | + litvertices[ptr+(numfacevertices*2)] = D3DLVERTEX(pos,0xFFFFFFFF,0,u,v);
|
| 617 | + colorvertices[ptr+(numfacevertices*2)] = COLORVERTEX(pos,normal,0xFFFFFFFF,0,u,v);
|
| 618 | + }
|
| 619 | + }
|
| 620 | + // Left face
|
| 621 | + ptr = 0;
|
| 622 | + for(int y = 0; y < detail; y++)
|
| 623 | + {
|
| 624 | + for(int x = 0; x < detail; x++)
|
| 625 | + {
|
| 626 | + u = (float)x/(float)(detail-1);
|
| 627 | + v = 1.f-((float)y/(float)(detail-1));
|
| 628 | + ptr = x+(detail*y);
|
| 629 | + pos = D3DVECTOR(-size/2.f,face[ptr].y,-face[ptr].x);
|
| 630 | + normal = D3DVECTOR(-1,0,0);
|
| 631 | + vertices[ptr+(numfacevertices*3)] = D3DVERTEX(pos,normal,u,v);
|
| 632 | + litvertices[ptr+(numfacevertices*3)] = D3DLVERTEX(pos,0xFFFFFFFF,0,u,v);
|
| 633 | + colorvertices[ptr+(numfacevertices*3)] = COLORVERTEX(pos,normal,0xFFFFFFFF,0,u,v);
|
| 634 | + }
|
| 635 | + }
|
| 636 | + // Top face
|
| 637 | + for(int y = 0; y < detail; y++)
|
| 638 | + {
|
| 639 | + for(int x = 0; x < detail; x++)
|
| 640 | + {
|
| 641 | + u = (float)x/(float)(detail-1);
|
| 642 | + v = 1.f-((float)y/(float)(detail-1));
|
| 643 | + ptr = x+(detail*y);
|
| 644 | + pos = D3DVECTOR(face[ptr].x,size/2.f,face[ptr].y);
|
| 645 | + normal = D3DVECTOR(0,1,0);
|
| 646 | + vertices[ptr+(numfacevertices*4)] = D3DVERTEX(pos,normal,u,v);
|
| 647 | + litvertices[ptr+(numfacevertices*4)] = D3DLVERTEX(pos,0xFFFFFFFF,0,u,v);
|
| 648 | + colorvertices[ptr+(numfacevertices*4)] = COLORVERTEX(pos,normal,0xFFFFFFFF,0,u,v);
|
| 649 | + }
|
| 650 | + }
|
| 651 | + // Bottom face
|
| 652 | + for(int y = 0; y < detail; y++)
|
| 653 | + {
|
| 654 | + for(int x = 0; x < detail; x++)
|
| 655 | + {
|
| 656 | + u = (float)x/(float)(detail-1);
|
| 657 | + v = 1.f-((float)y/(float)(detail-1));
|
| 658 | + ptr = x+(detail*y);
|
| 659 | + pos = D3DVECTOR(face[ptr].x,-size/2.f,-face[ptr].y);
|
| 660 | + normal = D3DVECTOR(0,-1,0);
|
| 661 | + vertices[ptr+(numfacevertices*5)] = D3DVERTEX(pos,normal,u,v);
|
| 662 | + litvertices[ptr+(numfacevertices*5)] = D3DLVERTEX(pos,0xFFFFFFFF,0,u,v);
|
| 663 | + colorvertices[ptr+(numfacevertices*5)] = COLORVERTEX(pos,normal,0xFFFFFFFF,0,u,v);
|
| 664 | + }
|
| 665 | + }
|
| 666 | + free(face);
|
| 667 | + // Generate index table
|
| 668 | + ptr = 0;
|
| 669 | + for(int i = 0; i < 6; i++)
|
| 670 | + {
|
| 671 | + for(int j = 0; j < numfaceindices; j++)
|
| 672 | + mesh[ptr++] = faceindex[j]+(i*numfacevertices);
|
| 673 | + }
|
| 674 | + free(faceindex);
|
534 | 675 | }
|
535 | 676 |
|
536 | | -void SetVertexColor(D3DLVERTEX *start, int count, DWORD color)
|
| 677 | +void SetVertexColor(D3DLVERTEX *start, COLORVERTEX *start_color, int count, DWORD color)
|
537 | 678 | {
|
538 | 679 | for(int i = 0; i < count; i++)
|
| 680 | + {
|
539 | 681 | start[i].color = color;
|
| 682 | + start_color[i].color = color;
|
| 683 | + }
|
540 | 684 | }
|
541 | 685 |
|
542 | | -void SetVertexSpecular(D3DLVERTEX *start, int count, DWORD color)
|
| 686 | +void SetVertexSpecular(D3DLVERTEX *start, COLORVERTEX *start_color, int count, DWORD color)
|
543 | 687 | {
|
544 | 688 | for(int i = 0; i < count; i++)
|
| 689 | + {
|
545 | 690 | start[i].specular = color;
|
| 691 | + start_color[i].specular = color;
|
| 692 | + }
|
546 | 693 | }
|
547 | 694 |
|
548 | 695 |
|
— | — | @@ -586,6 +733,34 @@ |
587 | 734 | return true;
|
588 | 735 | }
|
589 | 736 |
|
| 737 | +void MakeLights()
|
| 738 | +{
|
| 739 | + for(int i = 0; i < 8; i++)
|
| 740 | + {
|
| 741 | + lightenable[i] = FALSE;
|
| 742 | + ZeroMemory(&lights[i],sizeof(D3DLIGHT7));
|
| 743 | + lights[i].dcvDiffuse.r = lights[i].dcvDiffuse.g = lights[i].dcvDiffuse.b = 1;
|
| 744 | + lights[i].dltType = D3DLIGHT_DIRECTIONAL;
|
| 745 | + }
|
| 746 | + lightenable[0] = TRUE;
|
| 747 | + lights[0].dvPosition = D3DVECTOR(-10,-10,-10);
|
| 748 | + lights[1].dvPosition = D3DVECTOR(10,-10,-10);
|
| 749 | + lights[2].dvPosition = D3DVECTOR(-10,10,-10);
|
| 750 | + lights[3].dvPosition = D3DVECTOR(10,10,-10);
|
| 751 | + lights[4].dvPosition = D3DVECTOR(-10,-10,10);
|
| 752 | + lights[5].dvPosition = D3DVECTOR(10,-10,10);
|
| 753 | + lights[6].dvPosition = D3DVECTOR(-10,10,10);
|
| 754 | + lights[7].dvPosition = D3DVECTOR(10,10,10);
|
| 755 | + lights[0].dvDirection = D3DVECTOR(1,1,1);
|
| 756 | + lights[1].dvDirection = D3DVECTOR(-1,1,1);
|
| 757 | + lights[2].dvDirection = D3DVECTOR(1,-1,1);
|
| 758 | + lights[3].dvDirection = D3DVECTOR(-1,-1,1);
|
| 759 | + lights[4].dvDirection = D3DVECTOR(1,1,-1);
|
| 760 | + lights[5].dvDirection = D3DVECTOR(-1,1,-1);
|
| 761 | + lights[6].dvDirection = D3DVECTOR(1,-1,-1);
|
| 762 | + lights[7].dvDirection = D3DVECTOR(-1,-1,-1);
|
| 763 | +}
|
| 764 | +
|
590 | 765 | static const DDPIXELFORMAT fmt_rgba4444 = {sizeof(DDPIXELFORMAT),DDPF_RGB|DDPF_ALPHAPIXELS,0,16,0xF00,0xF0,0xF,0xF000};
|
591 | 766 | static const DDPIXELFORMAT fmt_rgba1555 = {sizeof(DDPIXELFORMAT),DDPF_RGB|DDPF_ALPHAPIXELS,0,16,0x7C00,0x3E0,0x1F,0x8000};
|
592 | 767 | static const DDPIXELFORMAT fmt_rgb565 = {sizeof(DDPIXELFORMAT),DDPF_RGB,0,16,0xF800,0x7E0,0x1F,0};
|
— | — | @@ -598,12 +773,11 @@ |
599 | 774 | D3DMATRIX matView;
|
600 | 775 | D3DMATRIX matProj;
|
601 | 776 | D3DMATRIX mat;
|
602 | | - D3DMATERIAL7 material;
|
603 | 777 | bgcolor = 0;
|
604 | 778 | switch(test)
|
605 | 779 | {
|
606 | 780 | case 0:
|
607 | | - MakeCube3D();
|
| 781 | + MakeCube3D(5,2);
|
608 | 782 | ZeroMemory(&material,sizeof(D3DMATERIAL7));
|
609 | 783 | material.ambient.r = 0.5f;
|
610 | 784 | material.ambient.g = 0.5f;
|
— | — | @@ -642,7 +816,7 @@ |
643 | 817 | error = d3d7dev->SetLight(0,&lights[0]);
|
644 | 818 | break;
|
645 | 819 | case 1:
|
646 | | - MakeCube3D();
|
| 820 | + MakeCube3D(5,2);
|
647 | 821 | cleartexformats();
|
648 | 822 | d3d7dev->EnumTextureFormats(gettexformat,NULL);
|
649 | 823 | gentexture(fmt_rgba4444,&textures[0],256,256,0);
|
— | — | @@ -660,6 +834,7 @@ |
661 | 835 | error = d3d7dev->LightEnable(0,TRUE);
|
662 | 836 | error = d3d7dev->SetRenderState(D3DRENDERSTATE_LIGHTING, TRUE);
|
663 | 837 | error = d3d7dev->SetRenderState(D3DRENDERSTATE_AMBIENT, 0xFFFFFFFF);
|
| 838 | + error = d3d7dev->SetRenderState(D3DRENDERSTATE_CULLMODE,D3DCULL_CW);
|
664 | 839 | mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
|
665 | 840 | mat._12 = mat._13 = mat._14 = mat._41 = 0.0f;
|
666 | 841 | mat._21 = mat._23 = mat._24 = mat._42 = 0.0f;
|
— | — | @@ -686,14 +861,20 @@ |
687 | 862 | lights[0].dvAttenuation1 = 0.4f;
|
688 | 863 | error = d3d7dev->SetLight(0,&lights[0]);
|
689 | 864 | break;
|
| 865 | + case 3:
|
| 866 | + ZeroMemory(lights,8*sizeof(D3DLIGHT7));
|
| 867 | + MakeLights();
|
690 | 868 | case 2:
|
691 | | - case 3:
|
692 | | - MakeCube3D();
|
| 869 | + MakeCube3D(5,8);
|
693 | 870 | ZeroMemory(&material,sizeof(D3DMATERIAL7));
|
694 | 871 | material.ambient.r = 1.0f;
|
695 | 872 | material.ambient.g = 1.0f;
|
696 | 873 | material.ambient.b = 1.0f;
|
697 | 874 | material.ambient.a = 1.0f;
|
| 875 | + material.diffuse.r = 1.0f;
|
| 876 | + material.diffuse.g = 1.0f;
|
| 877 | + material.diffuse.b = 1.0f;
|
| 878 | + material.diffuse.a = 1.0f;
|
698 | 879 | error = d3d7dev->SetMaterial(&material);
|
699 | 880 | error = d3d7dev->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE);
|
700 | 881 | error = d3d7dev->SetRenderState(D3DRENDERSTATE_AMBIENT, 0xffffffff);
|
— | — | @@ -746,7 +927,7 @@ |
747 | 928 | mat._31 = (FLOAT)sin( (float)time );
|
748 | 929 | error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_WORLD, &mat);
|
749 | 930 | error = d3d7dev->BeginScene();
|
750 | | - error = d3d7dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,D3DFVF_VERTEX,vertices,24,cube_mesh,36,0);
|
| 931 | + error = d3d7dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,D3DFVF_VERTEX,vertices,numpoints,mesh,numindices,0);
|
751 | 932 | error = d3d7dev->EndScene();
|
752 | 933 | break;
|
753 | 934 | case 1:
|
— | — | @@ -771,6 +952,19 @@ |
772 | 953 | error = d3d7dev->EndScene();
|
773 | 954 | break;
|
774 | 955 | case 2:
|
| 956 | + mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
|
| 957 | + mat._12 = mat._13 = mat._14 = mat._41 = 0.0f;
|
| 958 | + mat._21 = mat._23 = mat._24 = mat._42 = 0.0f;
|
| 959 | + mat._31 = mat._32 = mat._34 = mat._43 = 0.0f;
|
| 960 | + mat._11 = (FLOAT)cos( (float)time );
|
| 961 | + mat._33 = (FLOAT)cos( (float)time );
|
| 962 | + mat._13 = -(FLOAT)sin( (float)time );
|
| 963 | + mat._31 = (FLOAT)sin( (float)time );
|
| 964 | + error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_WORLD, &mat);
|
| 965 | + error = d3d7dev->BeginScene();
|
| 966 | + error = d3d7dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,D3DFVF_LVERTEX,litvertices,numpoints,mesh,numindices,0);
|
| 967 | + error = d3d7dev->EndScene();
|
| 968 | + break;
|
775 | 969 | case 3:
|
776 | 970 | mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
|
777 | 971 | mat._12 = mat._13 = mat._14 = mat._41 = 0.0f;
|
— | — | @@ -782,7 +976,7 @@ |
783 | 977 | mat._31 = (FLOAT)sin( (float)time );
|
784 | 978 | error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_WORLD, &mat);
|
785 | 979 | error = d3d7dev->BeginScene();
|
786 | | - error = d3d7dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,D3DFVF_LVERTEX,litvertices,24,cube_mesh,36,0);
|
| 980 | + error = d3d7dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,FVF_COLORVERTEX,colorvertices,numpoints,mesh,numindices,0);
|
787 | 981 | error = d3d7dev->EndScene();
|
788 | 982 | break;
|
789 | 983 | default:
|
— | — | @@ -895,6 +1089,13 @@ |
896 | 1090 | SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Linear"));
|
897 | 1091 | }
|
898 | 1092 |
|
| 1093 | +void PopulateSourceCombo(HWND hWnd)
|
| 1094 | +{
|
| 1095 | + SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Material"));
|
| 1096 | + SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Color 1"));
|
| 1097 | + SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM)_T("Color 2"));
|
| 1098 | +}
|
| 1099 | +
|
899 | 1100 | void strupper(TCHAR *str)
|
900 | 1101 | {
|
901 | 1102 | TCHAR *ptr = str;
|
— | — | @@ -1294,7 +1495,7 @@ |
1295 | 1496 | {
|
1296 | 1497 | SendDlgItemMessage(hWnd,IDC_DIFFUSE,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
|
1297 | 1498 | _stscanf(tmpstring,_T("%x"),&number);
|
1298 | | - SetVertexColor(litvertices,24,number);
|
| 1499 | + SetVertexColor(litvertices,colorvertices,numpoints,number);
|
1299 | 1500 | }
|
1300 | 1501 | break;
|
1301 | 1502 | case IDC_SPECULAR:
|
— | — | @@ -1302,7 +1503,7 @@ |
1303 | 1504 | {
|
1304 | 1505 | SendDlgItemMessage(hWnd,IDC_SPECULAR,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
|
1305 | 1506 | _stscanf(tmpstring,_T("%x"),&number);
|
1306 | | - SetVertexSpecular(litvertices,24,number);
|
| 1507 | + SetVertexSpecular(litvertices,colorvertices,numpoints,number);
|
1307 | 1508 | }
|
1308 | 1509 | break;
|
1309 | 1510 | case IDC_FACTOR:
|
— | — | @@ -1420,7 +1621,61 @@ |
1421 | 1622 | }
|
1422 | 1623 | break;
|
1423 | 1624 | case WM_CLOSE:
|
1424 | | - ddinterface->Release();
|
| 1625 | + if(d3d7dev)
|
| 1626 | + {
|
| 1627 | + d3d7dev->Release();
|
| 1628 | + d3d7dev = NULL;
|
| 1629 | + }
|
| 1630 | + if(d3d7)
|
| 1631 | + {
|
| 1632 | + d3d7->Release();
|
| 1633 | + d3d7dev = NULL;
|
| 1634 | + }
|
| 1635 | + if(ddsrender)
|
| 1636 | + {
|
| 1637 | + ddsrender->Release();
|
| 1638 | + ddsrender = NULL;
|
| 1639 | + }
|
| 1640 | + if(ddsurface)
|
| 1641 | + {
|
| 1642 | + ddsurface->Release();
|
| 1643 | + ddsurface = NULL;
|
| 1644 | + }
|
| 1645 | + if(zbuffer)
|
| 1646 | + {
|
| 1647 | + zbuffer->Release();
|
| 1648 | + zbuffer = NULL;
|
| 1649 | + }
|
| 1650 | + if(ddclipper)
|
| 1651 | + {
|
| 1652 | + ddclipper->Release();
|
| 1653 | + ddclipper = NULL;
|
| 1654 | + }
|
| 1655 | + if(ddinterface)
|
| 1656 | + {
|
| 1657 | + ddinterface->Release();
|
| 1658 | + ddinterface = NULL;
|
| 1659 | + }
|
| 1660 | + if(mesh)
|
| 1661 | + {
|
| 1662 | + free(mesh);
|
| 1663 | + mesh = NULL;
|
| 1664 | + }
|
| 1665 | + if(vertices)
|
| 1666 | + {
|
| 1667 | + free(vertices);
|
| 1668 | + vertices = NULL;
|
| 1669 | + }
|
| 1670 | + if(litvertices)
|
| 1671 | + {
|
| 1672 | + free(litvertices);
|
| 1673 | + litvertices = NULL;
|
| 1674 | + }
|
| 1675 | + if(colorvertices)
|
| 1676 | + {
|
| 1677 | + free(colorvertices);
|
| 1678 | + colorvertices = NULL;
|
| 1679 | + }
|
1425 | 1680 | EndDialog(hWnd,IDCANCEL);
|
1426 | 1681 | break;
|
1427 | 1682 | case WM_APP:
|
— | — | @@ -1504,6 +1759,8 @@ |
1505 | 1760 | SendDlgItemMessage(hWnd,IDC_AMBIENT,WM_SETTEXT,0,(LPARAM)_T("FFFFFFFF"));
|
1506 | 1761 | SendDlgItemMessage(hWnd,IDC_EMISSIVE,WM_SETTEXT,0,(LPARAM)_T("00000000"));
|
1507 | 1762 | SendDlgItemMessage(hWnd,IDC_MATAMBIENT,WM_SETTEXT,0,(LPARAM)_T("FFFFFFFF"));
|
| 1763 | + SendDlgItemMessage(hWnd,IDC_MATDIFFUSE,WM_SETTEXT,0,(LPARAM)_T("FFFFFFFF"));
|
| 1764 | + SendDlgItemMessage(hWnd,IDC_MATSPECULAR,WM_SETTEXT,0,(LPARAM)_T("00000000"));
|
1508 | 1765 | PopulateFogCombo(GetDlgItem(hWnd,IDC_VERTEXFOGMODE));
|
1509 | 1766 | PopulateFogCombo(GetDlgItem(hWnd,IDC_PIXELFOGMODE));
|
1510 | 1767 | SendDlgItemMessage(hWnd,IDC_VERTEXFOGMODE,CB_SETCURSEL,D3DFOG_NONE,0);
|
— | — | @@ -1523,6 +1780,16 @@ |
1524 | 1781 | SendDlgItemMessage(hWnd,IDC_CULLMODE,CB_ADDSTRING,0,(LPARAM)_T("CW"));
|
1525 | 1782 | SendDlgItemMessage(hWnd,IDC_CULLMODE,CB_ADDSTRING,0,(LPARAM)_T("CCW"));
|
1526 | 1783 | SendDlgItemMessage(hWnd,IDC_CULLMODE,CB_SETCURSEL,2,0);
|
| 1784 | + PopulateSourceCombo(GetDlgItem(hWnd,IDC_DIFFUSESOURCE));
|
| 1785 | + PopulateSourceCombo(GetDlgItem(hWnd,IDC_SPECULARSOURCE));
|
| 1786 | + PopulateSourceCombo(GetDlgItem(hWnd,IDC_AMBIENTSOURCE));
|
| 1787 | + PopulateSourceCombo(GetDlgItem(hWnd,IDC_EMISSIVESOURCE));
|
| 1788 | + SendDlgItemMessage(hWnd,IDC_DIFFUSESOURCE,CB_SETCURSEL,D3DMCS_COLOR1,0);
|
| 1789 | + SendDlgItemMessage(hWnd,IDC_SPECULARSOURCE,CB_SETCURSEL,D3DMCS_COLOR2,0);
|
| 1790 | + SendDlgItemMessage(hWnd,IDC_AMBIENTSOURCE,CB_SETCURSEL,D3DMCS_COLOR2,0);
|
| 1791 | + SendDlgItemMessage(hWnd,IDC_EMISSIVESOURCE,CB_SETCURSEL,D3DMCS_MATERIAL,0);
|
| 1792 | + SendDlgItemMessage(hWnd,IDC_SPINDETAIL,UDM_SETRANGE32,2,64);
|
| 1793 | + SendDlgItemMessage(hWnd,IDC_SPINDETAIL,UDM_SETPOS32,0,8);
|
1527 | 1794 | ::width = ddsd.dwWidth;
|
1528 | 1795 | ::height = ddsd.dwHeight;
|
1529 | 1796 | vertexshaderstate.texture = NULL;
|
— | — | @@ -1628,7 +1895,7 @@ |
1629 | 1896 | {
|
1630 | 1897 | SendDlgItemMessage(hWnd,IDC_DIFFUSE,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
|
1631 | 1898 | _stscanf(tmpstring,_T("%x"),&number);
|
1632 | | - SetVertexColor(litvertices,24,number);
|
| 1899 | + SetVertexColor(litvertices,colorvertices,numpoints,number);
|
1633 | 1900 | }
|
1634 | 1901 | break;
|
1635 | 1902 | case IDC_SPECULAR:
|
— | — | @@ -1636,7 +1903,7 @@ |
1637 | 1904 | {
|
1638 | 1905 | SendDlgItemMessage(hWnd,IDC_SPECULAR,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
|
1639 | 1906 | _stscanf(tmpstring,_T("%x"),&number);
|
1640 | | - SetVertexSpecular(litvertices,24,number);
|
| 1907 | + SetVertexSpecular(litvertices,colorvertices,numpoints,number);
|
1641 | 1908 | }
|
1642 | 1909 | break;
|
1643 | 1910 | case IDC_FACTOR:
|
— | — | @@ -1662,12 +1929,150 @@ |
1663 | 1930 | _stscanf(tmpstring,_T("%x"),&bgcolor);
|
1664 | 1931 | }
|
1665 | 1932 | break;
|
| 1933 | + case IDC_AMBIENT:
|
| 1934 | + {
|
| 1935 | + SendDlgItemMessage(hWnd,IDC_AMBIENT,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
|
| 1936 | + _stscanf(tmpstring,_T("%x"),&number);
|
| 1937 | + d3d7dev->SetRenderState(D3DRENDERSTATE_AMBIENT,number);
|
| 1938 | + }
|
| 1939 | + break;
|
| 1940 | + case IDC_EMISSIVE:
|
| 1941 | + {
|
| 1942 | + SendDlgItemMessage(hWnd,IDC_EMISSIVE,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
|
| 1943 | + _stscanf(tmpstring,_T("%x"),&number);
|
| 1944 | + material.emissive.b = (float)(number & 255) / 255.0;
|
| 1945 | + material.emissive.g = (float)((number>>8) & 255) / 255.0;
|
| 1946 | + material.emissive.r = (float)((number>>16) & 255) / 255.0;
|
| 1947 | + material.emissive.a = (float)((number>>24) & 255) / 255.0;
|
| 1948 | + d3d7dev->SetMaterial(&material);
|
| 1949 | + }
|
| 1950 | + break;
|
| 1951 | + case IDC_MATAMBIENT:
|
| 1952 | + {
|
| 1953 | + SendDlgItemMessage(hWnd,IDC_MATAMBIENT,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
|
| 1954 | + _stscanf(tmpstring,_T("%x"),&number);
|
| 1955 | + material.ambient.b = (float)(number & 255) / 255.0;
|
| 1956 | + material.ambient.g = (float)((number>>8) & 255) / 255.0;
|
| 1957 | + material.ambient.r = (float)((number>>16) & 255) / 255.0;
|
| 1958 | + material.ambient.a = (float)((number>>24) & 255) / 255.0;
|
| 1959 | + d3d7dev->SetMaterial(&material);
|
| 1960 | + }
|
| 1961 | + break;
|
| 1962 | + case IDC_MATDIFFUSE:
|
| 1963 | + {
|
| 1964 | + SendDlgItemMessage(hWnd,IDC_MATDIFFUSE,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
|
| 1965 | + _stscanf(tmpstring,_T("%x"),&number);
|
| 1966 | + material.diffuse.b = (float)(number & 255) / 255.0;
|
| 1967 | + material.diffuse.g = (float)((number>>8) & 255) / 255.0;
|
| 1968 | + material.diffuse.r = (float)((number>>16) & 255) / 255.0;
|
| 1969 | + material.diffuse.a = (float)((number>>24) & 255) / 255.0;
|
| 1970 | + d3d7dev->SetMaterial(&material);
|
| 1971 | + }
|
| 1972 | + break;
|
| 1973 | + case IDC_MATSPECULAR:
|
| 1974 | + {
|
| 1975 | + SendDlgItemMessage(hWnd,IDC_MATSPECULAR,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
|
| 1976 | + _stscanf(tmpstring,_T("%x"),&number);
|
| 1977 | + material.specular.b = (float)(number & 255) / 255.0;
|
| 1978 | + material.specular.g = (float)((number>>8) & 255) / 255.0;
|
| 1979 | + material.specular.r = (float)((number>>16) & 255) / 255.0;
|
| 1980 | + material.specular.a = (float)((number>>24) & 255) / 255.0;
|
| 1981 | + d3d7dev->SetMaterial(&material);
|
| 1982 | + }
|
| 1983 | + break;
|
| 1984 | + case IDC_ENABLELIGHT:
|
| 1985 | + if(HIWORD(wParam) == BN_CLICKED)
|
| 1986 | + {
|
| 1987 | + if(SendDlgItemMessage(hWnd,IDC_ENABLELIGHT,BM_GETCHECK,0,0) == BST_CHECKED)
|
| 1988 | + {
|
| 1989 | + d3d7dev->SetRenderState(D3DRENDERSTATE_LIGHTING,TRUE);
|
| 1990 | + for(int i = 0; i < 8; i++)
|
| 1991 | + {
|
| 1992 | + d3d7dev->SetLight(i,&lights[i]);
|
| 1993 | + d3d7dev->LightEnable(i,lightenable[i]);
|
| 1994 | + }
|
| 1995 | + }
|
| 1996 | + else d3d7dev->SetRenderState(D3DRENDERSTATE_LIGHTING,FALSE);
|
| 1997 | + }
|
| 1998 | + break;
|
| 1999 | + case IDC_VERTEXCOLOR:
|
| 2000 | + if(HIWORD(wParam) == BN_CLICKED)
|
| 2001 | + {
|
| 2002 | + if(SendDlgItemMessage(hWnd,IDC_VERTEXCOLOR,BM_GETCHECK,0,0) == BST_CHECKED)
|
| 2003 | + d3d7dev->SetRenderState(D3DRENDERSTATE_COLORVERTEX,TRUE);
|
| 2004 | + else d3d7dev->SetRenderState(D3DRENDERSTATE_COLORVERTEX,FALSE);
|
| 2005 | + }
|
| 2006 | + break;
|
| 2007 | + case IDC_DETAIL:
|
| 2008 | + if(HIWORD(wParam) == EN_CHANGE)
|
| 2009 | + {
|
| 2010 | + SendDlgItemMessage(hWnd,IDC_DETAIL,WM_GETTEXT,MAX_PATH,(LPARAM)tmpstring);
|
| 2011 | + number = _ttoi(tmpstring);
|
| 2012 | + if(number < 2) SendDlgItemMessage(hWnd,IDC_DETAIL,WM_SETTEXT,0,(LPARAM)_T("2"));
|
| 2013 | + if(number > 64) SendDlgItemMessage(hWnd,IDC_DETAIL,WM_SETTEXT,0,(LPARAM)_T("64"));
|
| 2014 | + MakeCube3D(5,number);
|
| 2015 | + }
|
| 2016 | + break;
|
1666 | 2017 | default:
|
1667 | 2018 | return FALSE;
|
1668 | 2019 | }
|
1669 | 2020 | break;
|
1670 | 2021 | case WM_CLOSE:
|
1671 | | - ddinterface->Release();
|
| 2022 | + if(d3d7dev)
|
| 2023 | + {
|
| 2024 | + d3d7dev->Release();
|
| 2025 | + d3d7dev = NULL;
|
| 2026 | + }
|
| 2027 | + if(d3d7)
|
| 2028 | + {
|
| 2029 | + d3d7->Release();
|
| 2030 | + d3d7dev = NULL;
|
| 2031 | + }
|
| 2032 | + if(ddsrender)
|
| 2033 | + {
|
| 2034 | + ddsrender->Release();
|
| 2035 | + ddsrender = NULL;
|
| 2036 | + }
|
| 2037 | + if(ddsurface)
|
| 2038 | + {
|
| 2039 | + ddsurface->Release();
|
| 2040 | + ddsurface = NULL;
|
| 2041 | + }
|
| 2042 | + if(zbuffer)
|
| 2043 | + {
|
| 2044 | + zbuffer->Release();
|
| 2045 | + zbuffer = NULL;
|
| 2046 | + }
|
| 2047 | + if(ddclipper)
|
| 2048 | + {
|
| 2049 | + ddclipper->Release();
|
| 2050 | + ddclipper = NULL;
|
| 2051 | + }
|
| 2052 | + if(ddinterface)
|
| 2053 | + {
|
| 2054 | + ddinterface->Release();
|
| 2055 | + ddinterface = NULL;
|
| 2056 | + }
|
| 2057 | + if(mesh)
|
| 2058 | + {
|
| 2059 | + free(mesh);
|
| 2060 | + mesh = NULL;
|
| 2061 | + }
|
| 2062 | + if(vertices)
|
| 2063 | + {
|
| 2064 | + free(vertices);
|
| 2065 | + vertices = NULL;
|
| 2066 | + }
|
| 2067 | + if(litvertices)
|
| 2068 | + {
|
| 2069 | + free(litvertices);
|
| 2070 | + litvertices = NULL;
|
| 2071 | + }
|
| 2072 | + if(colorvertices)
|
| 2073 | + {
|
| 2074 | + free(colorvertices);
|
| 2075 | + colorvertices = NULL;
|
| 2076 | + }
|
1672 | 2077 | EndDialog(hWnd,IDCANCEL);
|
1673 | 2078 | break;
|
1674 | 2079 | case WM_APP:
|
Index: dxgltest/dxgltest.rc |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |