Asphyre et coordonnées écran
Bonjour à tous,
J'utilise D3D9 par l'intermédiaire des composants Asphyre 3.1.
Je cherche avec cette interface Asphyre comment obtenir les coordonnées écran (projection) d'un point de l'espace objet ou de l'espace monde (probablement avec TAsphyreCamera).
Le but est de réagir à un click souris sur un objet particulier.
J'ai trouvé un exemple directX avec le code suivant
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
const D3DXMATRIX* pmatProj = g_Camera.GetProjMatrix();
POINT ptCursor;
GetCursorPos( &ptCursor );
ScreenToClient( DXUTGetHWND(), &ptCursor );
// Compute the vector of the pick ray in screen space
D3DXVECTOR3 v;
v.x = ( ( ( 2.0f * ptCursor.x ) / pd3dsdBackBuffer->Width ) - 1 ) / pmatProj->_11;
v.y = -( ( ( 2.0f * ptCursor.y ) / pd3dsdBackBuffer->Height ) - 1 ) / pmatProj->_22;
v.z = 1.0f; |
Merci d'avance pour votre aide.