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
46
47
48
49
50
51
52
53
|
tbResult RenderProc(float fNumSecsPassed)
{
float fAspect;
tbMatrix mProjection;
tbMatrix mCamera;
tbMatrix mWorld;
tbVector3 vCamera;
// Die Szene beginnen
tbDirect3D::GetDevice()->BeginScene();
// ------------------------------------------------------------------
// Projektionsmatrix erstellen und einsetzen
fAspect = (float)(g_Config.Direct3D.VideoMode.Width) / (float)(g_Config.Direct3D.VideoMode.Height);
mProjection = tbMatrixProjection(TB_DEG_TO_RAD(90.0f), fAspect, 0.1f, 100.0f);
tbDirect3D::GetDevice()->SetTransform(D3DTS_PROJECTION, (D3DMATRIX*)(&mProjection));
// Kameramatrix erstellen und einsetzen.
vCamera = tbVector3(0, 0, sinf(fNumSecsPassed) * 100.0f);
mCamera = tbMatrixCamera(vCamera, tbVector3(0.0f, 0.0f, 0.0f));
tbDirect3D::GetDevice()->SetTransform(D3DTS_VIEW, (D3DMATRIX*)(&mCamera));
// ------------------------------------------------------------------
// Z-Buffer deaktivieren, Dithering aktivieren
tbDirect3D::SetRS(D3DRS_ZENABLE, FALSE);
tbDirect3D::SetRS(D3DRS_DITHERENABLE, TRUE);
// Lighting deaktiviren
tbDirect3D::SetRS(D3DRS_LIGHTING, FALSE);
// ------------------------------------------------------------------
// Weltmatrix zurücksetzen
tbDirect3D::GetDevice()->SetTransform(D3DTS_WORLD, (D3DMATRIX*)(&tbMatrixIdentity()));
tbDirect3D::GetDevice()->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0),1.0f, 0);
// Kugel rendern
g_pSphere->Render();
// ------------------------------------------------------------------
// Szene beenden und darstellen
tbDirect3D::GetDevice()->EndScene();
tbDirect3D::GetDevice()->Present(NULL, NULL, NULL, NULL);
return TB_OK;
}
|