| 245 | //----------------------------------------------------------------------------// |
| 246 | |
| 247 | PxVec3 Picking::unProject(int x, int y, float depth) const |
| 248 | { |
| 249 | SampleRenderer::Renderer* renderer = mFrame.getRenderer(); |
| 250 | const SampleRenderer::RendererProjection& projection = mFrame.getCamera().getProjMatrix(); |
| 251 | const PxTransform view = mFrame.getCamera().getViewMatrix().getInverse(); |
| 252 | |
| 253 | PxU32 windowWidth = 0; |
| 254 | PxU32 windowHeight = 0; |
| 255 | renderer->getWindowSize(windowWidth, windowHeight); |
| 256 | |
| 257 | const PxF32 outX = (float)x / (float)windowWidth; |
| 258 | const PxF32 outY = (float)y / (float)windowHeight; |
| 259 | |
| 260 | return SampleRenderer::unproject(projection, view, outX * 2 -1, outY * 2 -1, depth * 2 - 1); |
| 261 | } |
| 262 | |
| 263 | //----------------------------------------------------------------------------// |
| 264 |
nothing calls this directly
no test coverage detected