Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
tbResult CSimulation::Render(float fTime) { tbDirect3D& D3D = tbDirect3D::Instance(); D3D->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0, 1.0f, 0); D3D->BeginScene(); mProjection = tbMatrixProjection(70.0f, D3D.GetAspect(), 0.1f, 5000); D3D.SetTransform(D3DTS_PROJECTION, mProjection); mCamera = tbMatrixCamera(CamPos, tbVector3(0,0,0)); D3D.SetTransform(D3DTS_VIEW, mCamera); Light.Type = D3DLIGHT_POINT; Light.Diffuse = tbColor(0.0f, 0.0f, 0.0f); Light.Ambient = tbColor(1.0f, 1.0f, 1.0f); Light.Specular = tbColor(1.0f, 1.0f, 1.0f); Light.Direction = tbVector3(0.0f,0.0f,0.0f); Light.Range = 1000; // 1000 Einheiten Reichweite Light.Attenuation0 = 0.0f; // Lichtabschwächung Light.Attenuation1 = 0.025f; // ... Light.Attenuation2 = 0.0f; // ... Light.Position=tbVector3(0,100,100); D3D->SetLight(0, &Light); D3D->LightEnable(0, TRUE); D3D.SetRS(D3DRS_FOGENABLE, TRUE); D3D.SetRS(D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); D3D.SetRS(D3DRS_RANGEFOGENABLE, TRUE); D3D.SetRS(D3DRS_FOGCOLOR, 0); D3D.SetRSF(D3DRS_FOGSTART, 100.0f); D3D.SetRSF(D3DRS_FOGEND, 350.0f); //Skybox.draw(); man sieht nichts von der skybox D3D.SetTransform(D3DTS_WORLD, tbMatrixIdentity()); mWorld = tbMatrixTranslation(tbVector3(0, 0, 0)); D3D.SetTransform(D3DTS_WORLD, mWorld); Terrain.Render(fTime); //Skybox.draw(); man sieht nichts vom terrain for (int i=0; i<Anzahl; i++) { WaterPoints[i].Render(fTime); } Skybox.draw(); //man sieht nur die Skybox D3D.SetRS(D3DRS_FOGENABLE, FALSE); D3D->EndScene(); return TB_OK; } |
C-/C++-Quelltext |
|
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 |
void CSkybox::draw() { tbMatrix mWorld; tbDirect3D& D3D = tbDirect3D::Instance(); D3D->BeginScene(); D3D->SetRenderState(D3DRS_LIGHTING, FALSE); D3D->SetRenderState(D3DRS_ZENABLE, FALSE); D3D->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); D3D.SetRS(D3DRS_FOGENABLE, FALSE); D3D.SetTexture(0, g_pSkyBoxTexture); // Weltmatrix erstellen, die die Sky-Box zur Kamera hin schiebt mWorld = tbMatrixTranslation(vMittelpunkt); D3D.SetTransform(D3DTS_WORLD, mWorld); // Vertex- und Index-Buffer aktivieren und das Vertexformat setzen D3D->SetStreamSource(0, g_pSkyBoxVB->GetVB(), 0, sizeof(SkyboxVertex)); D3D->SetIndices(g_pSkyBoxIB->GetIB()); D3D.SetFVF(dwFVF); // Zeichnen! int iNumPasses = g_pSkyBoxEffect->Begin(); for(int iPass = 0; iPass < iNumPasses; iPass++) { g_pSkyBoxEffect->Pass(iPass); D3D->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 12); } g_pSkyBoxEffect->End(); D3D->SetRenderState(D3DRS_LIGHTING, TRUE); D3D->SetRenderState(D3DRS_ZENABLE, TRUE); D3D->SetRenderState(D3DRS_ZWRITEENABLE, TRUE); D3D.SetRS(D3DRS_FOGENABLE, TRUE); D3D->EndScene(); } |
Werbeanzeige