1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
tbResult Render(float fNumSecsPassed)
{tbMatrix mRotation;
tbMatrix mTranslation;
tbMatrix mWorld;
/*tbMatrixRotationY(TB_DEG_TO_RAD(g_fTime*90.0f), &mRotation);
tbMatrixTranslation(tbVector3(0.0f, 0.0f, 2.0f), &mTranslation);
Hab die Funktion abgeändert (s.u.), weil VC++ sagt, dass die Funktion keine 2 Parameter will!! Liegt mein Problem hierin?
*/
tbMatrixRotationY(TB_DEG_TO_RAD(g_fTime*90.0f));
tbMatrixTranslation(tbVector3(0.0f, 0.0f, 2.0f));
mWorld=mRotation*mTranslation;
g_pD3DDevice->SetTransform(D3DTS_WORLD, (D3DMATRIX*)(&mWorld));
SVertex g_aTriangleVertex[3];
g_aTriangleVertex[0].vPosition = tbVector3( 0.0f, 1.0f, 0.0f);
g_aTriangleVertex[1].vPosition = tbVector3( 1.0f, -1.0f, 0.0f);
g_aTriangleVertex[2].vPosition = tbVector3( -1.0f, -1.0f, 0.0f);
g_aTriangleVertex[0].dwColor = (DWORD)(tbColor(1.0f, 0.0f, 0.0f));
g_aTriangleVertex[1].dwColor = (DWORD)(tbColor(0.0f, 1.0f, 0.0f));
g_aTriangleVertex[2].dwColor = (DWORD)(tbColor(0.0f, 0.0f, 1.0f));
if(FAILED(hResult = g_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 63), 1.0f, 0)))
{//FEHLER BEIM LEEREN
TB_ERROR_DIRECTX("g_pD3DDevice->Clear", hResult, TB_STOP);
}
g_pD3DDevice->BeginScene();
if(FAILED(hResult=g_pD3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 1, g_aTriangleVertex, sizeof(SVertex))))
{
TB_ERROR_DIRECTX("g_pD3DDevice->DrawPrimitiveUP", hResult, TB_STOP);
}
g_pD3DDevice->EndScene();
g_pD3DDevice->Present(NULL, NULL, NULL, NULL);
return TB_OK;
}
|