ezResult ezQtEngineViewWidget::PickPlane(ezUInt16 uiScreenPosX, ezUInt16 uiScreenPosY, const ezPlane& plane, ezVec3& out_Position) const { const auto& cam = m_pViewConfig->m_Camera; ezMat4 mView = cam.GetViewMatrix(); ezMat4 mProj; cam.GetProjectionMatrix((float)width() / (float)height(), mProj); ezMat4 mViewProj = mProj * mView; ezMat4 mInvViewProj = mViewProj.GetInverse(); ezVec3 vScreenPos(uiScreenPosX, height() - uiScreenPosY, 0); ezVec3 vResPos, vResRay; if (ezGraphicsUtils::ConvertScreenPosToWorldPos(mInvViewProj, 0, 0, width(), height(), vScreenPos, vResPos, &vResRay).Failed()) return EZ_FAILURE; if (plane.GetRayIntersection(vResPos, vResRay, nullptr, &out_Position)) return EZ_SUCCESS; return EZ_FAILURE; }
void CAtlas::update(Ogre::Real tpf) { if (mFirstFrame) {return;} mEllipticFader.fade(tpf); if (mEllipticFader.isFading()) { Ogre::Vector3 vScreenPos(m_pWorldCamera->getProjectionMatrix() * m_pWorldCamera->getViewMatrix() * m_pPlayer->getCenter()); mEllipticFader.setFadeCenter(Ogre::Vector2(vScreenPos.x, vScreenPos.y)); } mAlphaFader.fade(tpf); if (m_bSwitchingMaps && m_eSwitchMapType == SMT_MOVE_CAMERA) { if (m_pCameraPerspective->isCameraInBounds() && m_bPlayerTargetReached) { m_pCurrentMap->deleteNow(); m_pCurrentMap = m_pNextMap; m_pNextMap = nullptr; m_bSwitchingMaps = false; } } { // only update if map switching is done CWorldEntity::update(tpf); } }