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
54
|
tbResult L1Render(float fTime){
//Variablen
tbMatrix World;
tbMatrix Camera;
tbMatrix Projection;
D3DLIGHT9 Light;
D3DLIGHT9 RedLight;
tbDirect3D& D3D = tbDirect3D::Instance();
D3D->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0, 1.0f, 0); //Wenn ich auch noch TARGET STENCIL säubere, entsteht kein Unterschied
D3D->BeginScene();
// Projektionsmatrix erstellen und einsetzen
Projection = tbMatrixProjection(TB_DEG_TO_RAD(80.0f), D3D.GetAspect(), 0.1f, 1300.0f);
D3D.SetTransform(D3DTS_PROJECTION, Projection);
L1CameraDir = tbVector3(sinf(L1CameraRot) * cosf(L1CameraUpDown),
sinf(L1CameraUpDown),
cosf(L1CameraRot) * cosf(L1CameraUpDown));
Camera = tbMatrixCamera(L1CameraPos,L1CameraPos + L1CameraDir);
D3D.SetTransform(D3DTS_VIEW, Camera);
//Skybox <Quelltext ist nicht nötig>
//Licht
ZeroMemory(&Light, sizeof(D3DLIGHT9));
Light.Type = D3DLIGHT_POINT; // Punktlicht
Light.Diffuse = tbColor(0.2f, 0.2f, 0.2f); // Weiße Streufarbe
Light.Ambient = tbColor(0.2f, 0.2f, 0.2f); // Weiße Hintergrundfarbe
Light.Specular = tbColor(0.2f, 0.2f, 0.2f); // Weiße Glanzfarbe
Light.Position = tbVector3(0.0f,30.0f, 50.0f); // Position
Light.Range = 300.0f; // 300 Einheiten Reichweite
Light.Attenuation0 = 0.0f; // Lichtabschwächung
Light.Attenuation1 = 0.025f; // ...
Light.Attenuation2 = 0.0f; // ...
D3D->SetLight(0, &Light);
D3D->LightEnable(0, TRUE);
World = tbMatrixTranslation(tbVector3(0.0f,0.0f,0.0f));
D3D.SetTransform(D3DTS_WORLD,World);
L1Model->Render();
World = tbMatrixTranslation(L1UFOPos);
D3D.SetTransform(D3DTS_WORLD,World);
L1UFO->Render();
D3D->EndScene();
return TB_OK;
}
Danke schon mal
|