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
Anonymous
unregistriert
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
//------------------------------------------------------------------ // Erstellt eine Kameramatrix // vLookat: Vektor, zu dem die Kamera "sieht" // vPos: Positionsvektor der Kamera // vUp: Richtungsvektor für die Y Achse der Kamera static qCMatrix CameraMatrix(const qCVector &vPos, const qCVector &vLookAt, const qCVector &vUp) { // Zunächst alle 3 Achsen der Kamera ermitteln - Richtungsverktoren qCVector vZAxis( qCVector::Normalize(vLookAt - vPos) ); qCVector vXAxis( qCVector::CrossProduct(vZAxis, vUp) ); qCVector vYAxis( qCVector::CrossProduct(vZAxis, vXAxis) ); return qCMatrix::TranslationMatrix( -vPos ) * qCMatrix(vXAxis.GetX(), vYAxis.GetX(), vZAxis.GetX(), 0.0, vXAxis.GetY(), vYAxis.GetY(), vZAxis.GetY(), 0.0, vXAxis.GetZ(), vYAxis.GetZ(), vZAxis.GetZ(), 0.0, 0.0, 0.0, 0.0, 1.0); } |
Quellcode |
|
1 2 3 4 5 6 7 |
qCMatrix mTranslation = qCMatrix::TranslationMatrix(qCVector(0.0f, 0.0f, 100.0f)); qCMatrix mCamera = qCMatrix::CameraMatrix(g_vCamPos, qCVector(0.0f, 0.0f, 1.0f), qCVector(0.0f, -1.0f, 0.0f)); qCMatrix mWorld = mTranslation * mCamera; hResult = pD3DDevice->SetTransform(D3DTS_WORLD, (D3DMATRIX*)&((D3DMATRIX)mWorld)); // (...hier wird gezeichnet...) |
Quellcode |
|
1 2 3 4 5 6 7 8 |
zaxis = normal(At - Eye) xaxis = normal(cross(Up, zaxis)) yaxis = cross(zaxis, xaxis) xaxis.x yaxis.x zaxis.x 0 xaxis.y yaxis.y zaxis.y 0 xaxis.z yaxis.z zaxis.z 0 -dot(xaxis, eye) -dot(yaxis, eye) -dot(zaxis, eye) 1 |
Anonymous
unregistriert
Zitat
da sie einige Objekte schon heftig verzerrt
Anonymous
unregistriert
Zitat von »"Osram"«
Zitat
da sie einige Objekte schon heftig verzerrt
Wie Nox sagte, genau das passiert, wenn Du nicht normierst .
Werbeanzeige