SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Mouse.hpp
Go to the documentation of this file.
1/*
2-------- Unprojecting mouse coordinate (NDC) to world space
3float ndcX = (2.0f * mouseX) / screenWidth - 1.0f;
4float ndcY = 1.0f - (2.0f * mouseY) / screenHeight;
5XMMATRIX viewProjectionMatrix = XMMatrixMultiply(viewMatrix, projectionMatrix);
6
7XMVECTOR mouseNDC = XMVectorSet(ndcX, ndcY, 0.0 , 1.0); // Z value stands for Near/Far plane
8
9XMMATRIX inverseViewProjection = XMMatrixInverse(nullptr, viewProjectionMatrix);
10
11XMVECTOR worldNear = XMVector3TransformCoord(mouseNear, inverseViewProjection);
12*/