MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / unProject

Method unProject

physx/samples/samplebase/Picking.cpp:247–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245//----------------------------------------------------------------------------//
246
247PxVec3 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

Callers

nothing calls this directly

Calls 4

getRendererMethod · 0.80
getCameraMethod · 0.45
getInverseMethod · 0.45
getWindowSizeMethod · 0.45

Tested by

no test coverage detected