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
Quellcode |
|
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 |
//Init Scene Method bool CApplication::InitScene() { HRESULT hResult; hResult = pD3DDevice->SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE); //Deactivate LIGHTHING and CULLING, Activate DITHERING pD3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE); pD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); pD3DDevice->SetRenderState(D3DRS_DITHERENABLE, TRUE); pD3DDevice->SetRenderState(D3DRS_ZENABLE, TRUE); pD3DDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID); fAspect = (float)(d3dpp.BackBufferWidth)/(float)(d3dpp.BackBufferHeight); //Creating Projection-Matrix tbMatrix mProjection = tbMatrixProjection(0, fAspect, 0.1f, 1000.0f); //Setting Projection-Matrix pD3DDevice->SetTransform(D3DTS_PROJECTION, (D3DMATRIX*)(&mProjection)); //Speichere Dreieck aTriangleVertex[0].vPosition = tbVector3(0.0f,1.0f,10.0f); aTriangleVertex[1].vPosition = tbVector3(-1.0f,1.0f,10.0f); aTriangleVertex[2].vPosition = tbVector3(-1.0f,-1.0f,10.0f); aTriangleVertex[0].dwColor = (DWORD)(tbColor(1.0f,0.0f,0.0f)); aTriangleVertex[1].dwColor = (DWORD)(tbColor(0.0f,1.0f,0.0f)); aTriangleVertex[2].dwColor = (DWORD)(tbColor(0.0f,0.0f,1.0f)); return true; } |
Quellcode |
|
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 |
//Rendering Method bool CApplication::Render() { tbMatrix mRotation; tbMatrix mTranslation; tbMatrix mWorld; HRESULT hResult; tbMatrixRotationY(TB_DEG_TO_RAD(90.0f)); tbMatrixTranslation(tbVector3(0.0f,0.0f,80.0f)); mWorld = mRotation * mTranslation; pD3DDevice->SetTransform(D3DTS_WORLD,(D3DMATRIX*)(&mWorld)); if(CheckD3DDevice()) { pD3DDevice->Clear(0,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER ,D3DCOLOR_XRGB(0,0,68),1.0f,0); pD3DDevice->BeginScene(); hResult = pD3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST,1,aTriangleVertex,sizeof(sVertex)); pD3DDevice->EndScene(); pD3DDevice->Present(NULL,NULL,NULL,NULL); } return true; } |
Quellcode |
|
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 |
//GameLoop bool CApplication::DoGameLoop() { MSG Message; DWORD dwTime1; DWORD dwTime2; while(D3DStatus == true) { dwTime1 = timeGetTime(); if(PeekMessage(&Message,NULL,0,0,PM_REMOVE)) { TranslateMessage(&Message); DispatchMessage(&Message); } Move(); Render(); dwTime2 = timeGetTime(); fNumSecsPassed = (float)(dwTime2-dwTime1) / 1000.0f; } //Releasing Dx-Device if(pD3DDevice != NULL) { pD3DDevice->Release(); } //Rleasing Dx-Interface if(pD3D != NULL) { pD3D->Release(); } return true; } |
Administrator
Administrator
Administrator
Quellcode |
|
1 2 3 4 5 |
typedef struct { tbVector3 vPosition; DWORD dwColor; }sVertex; |
Administrator
Zitat von »"Pirat!"«
tbMatrix mRotation;
tbMatrix mTranslation;
tbMatrix mWorld;
HRESULT hResult;
tbMatrixRotationY(TB_DEG_TO_RAD(90.0f));
tbMatrixTranslation(tbVector3(0.0f,0.0f,80.0f));
mWorld = mRotation * mTranslation;
Administrator
Zitat von »"Pirat!"«
Das mit den Matrizen könnte es sein. Hab allerdings auch nur nen roten Strich bekommen, als ich z.b. 60° eingesetzt hab, oder 1°.
Werbeanzeige