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 |
/** * itcResult SetupMatrices( * void * ); * * Setzt die D3D9 - Matrizen */ itcResult SetupMatrices() { D3DXMATRIX matWorld, matView, matProj; // World Matrix D3DXMatrixRotationY(&matWorld, 0.2f); g_p3DDevice->SetTransform(D3DTS_WORLD, &matWorld); // View Matrix D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3(0.0f, 3.0f,-5.0f), &D3DXVECTOR3(0.0f, 0.0f, 0.0f), &D3DXVECTOR3(0.0f, 1.0f, 0.0f)); g_p3DDevice->SetTransform(D3DTS_VIEW, &matView); // Projection Matrix D3DXMatrixPerspectiveFovLH(&matProj, D3DX_PI / 4, 1.0f, 1.0f, 100.0f); g_p3DDevice->SetTransform(D3DTS_PROJECTION, &matProj); return ITC_OK; } |
Anonymous
unregistriert
Quellcode |
|
1 |
D3DXMatrixRotationY(&matWorld, Konstante*globalerzeitzähler); |
Anonymous
unregistriert
Administrator
Zitat von »"Anonymous"«
So, wie es momentan ist, zeigt mir das Programme in Dreieck und zwar 100%ig frontal.
Zitat von »"David Scherfgen"«
Zitat von »"Anonymous"«
So, wie es momentan ist, zeigt mir das Programme in Dreieck und zwar 100%ig frontal.
Glaube ich Dir nicht
Das kann man nämlich praktisch garnicht erkennen, da das Dreieck ja nur ein wenig schmäler wird. Bring eine Animation mit rein, dann wirst Du es sehen. Im Code ist nämlich alles OK.
Administrator
Quellcode |
|
1 2 3 4 5 6 7 |
g_p3DDevice->SetTransform(D3DTS_VIEW, &matView); // Projection Matrix D3DXMatrixPerspectiveFovLH(&matProj, D3DX_PI / 4, 1.0f, 1.0f, 100.0f); g_p3DDevice->SetTransform(D3DTS_PROJECTION, &matProj); return ITC_OK; |
Zitat von »"David Scherfgen"«
Aaah, hättest Du mal irgendwo erwähnt, dass Du mit transformierten Vertizes (D3DFVF_XYZRHW) arbeitest... die laufen natürlich nicht mehr durch die Transformationspipeline, da sie ja schon in 2D-Koordinaten angegeben werden.
Quellcode |
|
1 2 3 4 5 6 7 |
struct CUSTOMVERTEX { float x, y, z; DWORD color; }; #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_DIFFUSE) |
Zitat von »"Stefan"«
hm, ich hab nur ganz kurz den Code angeschaut:
Quellcode
1 2 3 4 5 6 7 g_p3DDevice->SetTransform(D3DTS_VIEW, &matView); // Projection Matrix D3DXMatrixPerspectiveFovLH(&matProj, D3DX_PI / 4, 1.0f, 1.0f, 100.0f); g_p3DDevice->SetTransform(D3DTS_PROJECTION, &matProj); return ITC_OK;
Das kommt mir seltsam vor, muss man hier nicht zuerst Rotation * Translation multiplizieren und anschleißend das Ergbnis in SetTransform setzten??
Administrator
Werbeanzeige