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
|
tbMatrix mCamera;
tbVector3 vCameraDir;
tbDirect3D& D3D = tbDirect3D::Instance();
D3D->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, tbColor(0.2f, 0.2f, 0.2f), 1.0f, 0);
D3D->BeginScene();
D3D.SetTransform(D3DTS_PROJECTION, tbMatrixProjection(TB_DEG_TO_RAD(90.0f), (float)(m_Config.Direct3D.VideoMode.Width)/(float)(m_Config.Direct3D.VideoMode.Height), 0.1f, 100.0f));
vCameraDir = tbVector3(0.0f);
mCamera = tbMatrixCamera(m_vCameraPos, vCameraDir);
D3D.SetTransform(D3DTS_VIEW, mCamera);
D3DLIGHT9 Light;
ZeroMemory(&Light, sizeof(D3DLIGHT9));
Light.Type = D3DLIGHT_DIRECTIONAL;
Light.Diffuse = tbColor(0.5f, 0.5f, 0.5f);
Light.Ambient = tbColor(0.5f, 0.5f, 0.5f);
//Light.Specular = tbColor(0.0f, 0.0f, 0.0f);
Light.Direction = vCameraDir - m_vCameraPos;
D3D->SetLight(0, &Light);
D3D->LightEnable(0, true);
// -----------------------------------------------------------------------------------------
D3D.SetTransform(D3DTS_WORLD, m_World);
if(m_pModel)
m_pModel->Render();
char cText[100];
sprintf_s(cText, "Scal: %.1f Rot: %d °", m_fDist, (int)(TB_RAD_TO_DEG(m_fRot))%360);
m_pFont->Begin();
m_pFont->DrawText(tbVector2(0.9f, 0.1f), cText);
m_pFont->End();
D3D->EndScene();
|