Index: ddraw/include/d3dtypes.h |
— | — | @@ -280,6 +280,15 @@ |
281 | 281 | D3DVALUE tv;
|
282 | 282 | D3DVALUE dvTV;
|
283 | 283 | } DUMMYUNIONNAME7;
|
| 284 | +#if defined(__cplusplus) && defined(D3D_OVERLOADS)
|
| 285 | +public:
|
| 286 | + _D3DLVERTEX() {}
|
| 287 | + _D3DLVERTEX(const D3DVECTOR& v, DWORD _color, DWORD _specular, float _tu, float _tv) {
|
| 288 | + x = v.x; y = v.y; z = v.z;
|
| 289 | + color = _color; specular = _specular;
|
| 290 | + tu = _tu; tv = _tv;
|
| 291 | + }
|
| 292 | +#endif
|
284 | 293 | } D3DLVERTEX, *LPD3DLVERTEX;
|
285 | 294 |
|
286 | 295 | typedef struct _D3DVERTEX {
|
Index: dxgltest/Tests3D.cpp |
— | — | @@ -49,6 +49,7 @@ |
50 | 50 | static D3DVECTOR points[256];
|
51 | 51 | static D3DVECTOR normals[256];
|
52 | 52 | static D3DVERTEX vertices[256];
|
| 53 | +static D3DLVERTEX litvertices[256];
|
53 | 54 | static WORD mesh[256];
|
54 | 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,
|
55 | 56 | 18,17,19, 20,21,22, 22,21,23 };
|
— | — | @@ -450,7 +451,7 @@ |
451 | 452 | StopTimer();
|
452 | 453 | }
|
453 | 454 |
|
454 | | -void MakeCube3D(D3DVECTOR *points, D3DVECTOR *normals, D3DVERTEX *vertices)
|
| 455 | +void MakeCube3D()
|
455 | 456 | {
|
456 | 457 | points[0] = D3DVECTOR(-2.5f,-2.5f,-2.5f);
|
457 | 458 | points[1] = D3DVECTOR(-2.5f,2.5f,-2.5f);
|
— | — | @@ -490,6 +491,30 @@ |
491 | 492 | vertices[21] = D3DVERTEX(points[0],normals[5],0,0);
|
492 | 493 | vertices[22] = D3DVERTEX(points[4],normals[5],1,1);
|
493 | 494 | vertices[23] = D3DVERTEX(points[2],normals[5],1,0);
|
| 495 | + litvertices[0] = D3DLVERTEX(points[0],0xFFFFFFFF,0,0,1);
|
| 496 | + litvertices[1] = D3DLVERTEX(points[1],0xFFFFFFFF,0,0,0);
|
| 497 | + litvertices[2] = D3DLVERTEX(points[2],0xFFFFFFFF,0,1,1);
|
| 498 | + litvertices[3] = D3DLVERTEX(points[3],0xFFFFFFFF,0,1,0);
|
| 499 | + litvertices[4] = D3DLVERTEX(points[2],0xFFFFFFFF,0,0,1);
|
| 500 | + litvertices[5] = D3DLVERTEX(points[3],0xFFFFFFFF,0,0,0);
|
| 501 | + litvertices[6] = D3DLVERTEX(points[4],0xFFFFFFFF,0,1,1);
|
| 502 | + litvertices[7] = D3DLVERTEX(points[5],0xFFFFFFFF,0,1,0);
|
| 503 | + litvertices[8] = D3DLVERTEX(points[4],0xFFFFFFFF,0,0,1);
|
| 504 | + litvertices[9] = D3DLVERTEX(points[5],0xFFFFFFFF,0,0,0);
|
| 505 | + litvertices[10] = D3DLVERTEX(points[6],0xFFFFFFFF,0,1,1);
|
| 506 | + litvertices[11] = D3DLVERTEX(points[7],0xFFFFFFFF,0,1,0);
|
| 507 | + litvertices[12] = D3DLVERTEX(points[6],0xFFFFFFFF,0,0,1);
|
| 508 | + litvertices[13] = D3DLVERTEX(points[7],0xFFFFFFFF,0,0,0);
|
| 509 | + litvertices[14] = D3DLVERTEX(points[0],0xFFFFFFFF,0,1,1);
|
| 510 | + litvertices[15] = D3DLVERTEX(points[1],0xFFFFFFFF,0,1,0);
|
| 511 | + litvertices[16] = D3DLVERTEX(points[1],0xFFFFFFFF,0,0,1);
|
| 512 | + litvertices[17] = D3DLVERTEX(points[7],0xFFFFFFFF,0,0,0);
|
| 513 | + litvertices[18] = D3DLVERTEX(points[3],0xFFFFFFFF,0,1,1);
|
| 514 | + litvertices[19] = D3DLVERTEX(points[5],0xFFFFFFFF,0,1,0);
|
| 515 | + litvertices[20] = D3DLVERTEX(points[6],0xFFFFFFFF,0,0,1);
|
| 516 | + litvertices[21] = D3DLVERTEX(points[0],0xFFFFFFFF,0,0,0);
|
| 517 | + litvertices[22] = D3DLVERTEX(points[4],0xFFFFFFFF,0,1,1);
|
| 518 | + litvertices[23] = D3DLVERTEX(points[2],0xFFFFFFFF,0,1,0);
|
494 | 519 | }
|
495 | 520 |
|
496 | 521 | DDPIXELFORMAT texformats[256];
|
— | — | @@ -550,7 +575,7 @@ |
551 | 576 | switch(test)
|
552 | 577 | {
|
553 | 578 | case 0:
|
554 | | - MakeCube3D(points,normals,vertices);
|
| 579 | + MakeCube3D();
|
555 | 580 | ZeroMemory(&material,sizeof(D3DMATERIAL7));
|
556 | 581 | material.ambient.r = 0.5f;
|
557 | 582 | material.ambient.g = 0.5f;
|
— | — | @@ -589,7 +614,7 @@ |
590 | 615 | error = d3d7dev->SetLight(0,&lights[0]);
|
591 | 616 | break;
|
592 | 617 | case 1:
|
593 | | - MakeCube3D(points,normals,vertices);
|
| 618 | + MakeCube3D();
|
594 | 619 | cleartexformats();
|
595 | 620 | d3d7dev->EnumTextureFormats(gettexformat,NULL);
|
596 | 621 | gentexture(fmt_rgba4444,&textures[0],256,256,0);
|
— | — | @@ -634,7 +659,7 @@ |
635 | 660 | error = d3d7dev->SetLight(0,&lights[0]);
|
636 | 661 | break;
|
637 | 662 | case 2:
|
638 | | - MakeCube3D(points,normals,vertices);
|
| 663 | + MakeCube3D();
|
639 | 664 | ZeroMemory(&material,sizeof(D3DMATERIAL7));
|
640 | 665 | material.ambient.r = 1.0f;
|
641 | 666 | material.ambient.g = 1.0f;
|
— | — | @@ -727,7 +752,7 @@ |
728 | 753 | mat._31 = (FLOAT)sin( (float)time );
|
729 | 754 | error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_WORLD, &mat);
|
730 | 755 | error = d3d7dev->BeginScene();
|
731 | | - error = d3d7dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,D3DFVF_VERTEX,vertices,24,cube_mesh,36,0);
|
| 756 | + error = d3d7dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,D3DFVF_LVERTEX,litvertices,24,cube_mesh,36,0);
|
732 | 757 | error = d3d7dev->EndScene();
|
733 | 758 | break;
|
734 | 759 | default:
|