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 |
inline void CProGiDisplay::DeviceToDatabase(const CPoint &ptDevice, CProGePoint &ptDatabase) { double x = ptDevice.x, y = ptDevice.y; CRect clipRect; m_pWnd->GetClientRect(clipRect); //Länge/Breite des Client-Fensters double dWidth = clipRect.Width(); double dHeight = clipRect.Height(); CProGeMatrix proj, view, InvView; //Projektions- und Weltmatrix m_gi->GetProjection(proj); m_gi->GetWorld(view); CProGeVector v; v.m_x = (((2 * x) / dWidth ) - 1) / proj.m11; v.m_y = -(((2 * y) / dHeight) - 1) / proj.m22; v.m_z = 1; InvView = view.Inverse(); CProGeVector dir, origin; dir.m_x = v.m_x * InvView.m11 + v.m_y * InvView.m21 + v.m_z * InvView.m31; dir.m_y = v.m_x * InvView.m12 + v.m_y * InvView.m22 + v.m_z * InvView.m32; dir.m_z = v.m_x * InvView.m13 + v.m_y * InvView.m23 + v.m_z * InvView.m33; dir.Normalize(); origin.m_x = InvView.m41; origin.m_y = InvView.m42; origin.m_z = InvView.m43; // TODO?? // und nun? ptDatabase = dir; } |
Administrator
Administrator
Zitat von »"Griesser"«
Dazwischen muss es doch eine Möglichkeit geben das Ganze umzurechnen.
Also mein 2D-Zeugs zu 3D (mit der oben genannten Einschränkung natürlich)
oder liege ich da komplett falsch?
C-/C++-Quelltext |
|
1 2 |
double dWidth = clipRect.Width(); double dHeight = clipRect.Height(); |
C-/C++-Quelltext |
|
1 2 |
m_gi->GetProjection(proj); m_gi->GetWorld(view); |
Werbeanzeige