void MeteorMgr::update(double deltaTime) { #ifdef _MSC_BUILD return; #endif if (!flagShow) return; deltaTime*=1000; StelCore* core = StelApp::getInstance().getCore(); // step through and update all active meteors for (std::vector<Meteor*>::iterator iter = active.begin(); iter != active.end(); ++iter) { if (!(*iter)->update(deltaTime)) { // remove dead meteor // qDebug("Meteor \tdied\n"); delete *iter; active.erase(iter); iter--; // important! } } // only makes sense given lifetimes of meteors to draw when timeSpeed is realtime // otherwise high overhead of large numbers of meteors double tspeed = core->getTimeRate()*86400; // sky seconds per actual second if (tspeed<=0 || fabs(tspeed)>1.) { // don't start any more meteors return; } // if stellarium has been suspended, don't create huge number of meteors to // make up for lost time! if (deltaTime > 500) { deltaTime = 500; } // determine average meteors per frame needing to be created int mpf = (int)((double)ZHR*zhrToWsr*deltaTime/1000.0 + 0.5); if (mpf<1) mpf = 1; int mlaunch = 0; for (int i=0; i<mpf; ++i) { // start new meteor based on ZHR time probability double prob = ((double)rand())/RAND_MAX; if (ZHR>0 && prob<((double)ZHR*zhrToWsr*deltaTime/1000.0/(double)mpf) ) { Meteor *m = new Meteor(StelApp::getInstance().getCore(), maxVelocity); active.push_back(m); mlaunch++; } } // qDebug("mpf: %d\tm launched: %d\t(mps: %f)\t%d\n", mpf, mlaunch, ZHR*zhrToWsr, deltaTime); }
StoredView Scenery3d::getCurrentView() { if(!currentScene) { qCWarning(scenery3d)<<"Can't return current view, no scene loaded!"; return StoredView(); } StoredView view; view.isGlobal = false; StelCore* core = StelApp::getInstance().getCore(); //get view vec Vec3d vd = mvMgr->getViewDirectionJ2000(); //convert to alt/az format vd = core->j2000ToAltAz(vd, StelCore::RefractionOff); //convert to spherical angles StelUtils::rectToSphe(&view.view_fov[0],&view.view_fov[1],vd); //convert to degrees view.view_fov[0]*=180.0/M_PI; view.view_fov[1]*=180.0/M_PI; // we must patch azimuth view.view_fov[0]=180.0-view.view_fov[0]; //3rd comp is fov view.view_fov[2] = mvMgr->getAimFov(); //get current grid pos + eye height Vec3d pos = currentScene->getGridPosition(); view.position[0] = pos[0]; view.position[1] = pos[1]; view.position[2] = pos[2]; view.position[3] = currentScene->getEyeHeight(); return view; }
// Update the map for the given location. void LocationDialog::setMapForLocation(const StelLocation& loc) { // Avoids useless processing if (lastPlanet==loc.planetName) return; QPixmap pixmap; // Try to set the proper planet map image if (loc.planetName=="Earth") { // Special case for earth, we don't want to see the clouds pixmap = QPixmap(":/graphicGui/world.png"); } else { SolarSystem* ssm = GETSTELMODULE(SolarSystem); PlanetP p = ssm->searchByEnglishName(loc.planetName); if (p) { QString path = StelFileMgr::findFile("textures/"+p->getTextMapName()); if (path.isEmpty()) { qWarning() << "ERROR - could not find planet map for " << loc.planetName; return; } pixmap = QPixmap(path); } } StelCore * core = StelApp::getInstance().getCore(); pixmap.setDevicePixelRatio(core->getCurrentStelProjectorParams().devicePixelsPerPixel); ui->mapLabel->setPixmap(pixmap); // For caching lastPlanet = loc.planetName; }
void SearchDialog::manualPositionChanged() { ui->completionLabel->clearValues(); StelCore* core = StelApp::getInstance().getCore(); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr); Vec3d pos; switch (getCurrentCoordinateSystem()) { case equatorialJ2000: { StelUtils::spheToRect(ui->AxisXSpinBox->valueRadians(), ui->AxisYSpinBox->valueRadians(), pos); break; } case equatorial: { StelUtils::spheToRect(ui->AxisXSpinBox->valueRadians(), ui->AxisYSpinBox->valueRadians(), pos); pos = core->equinoxEquToJ2000(pos); break; } case horizontal: { double cx; cx = 3.*M_PI - ui->AxisXSpinBox->valueRadians(); // N is zero, E is 90 degrees if (cx > M_PI*2) cx -= M_PI*2; StelUtils::spheToRect(cx, ui->AxisYSpinBox->valueRadians(), pos); pos = core->altAzToJ2000(pos); break; } case galactic: { StelUtils::spheToRect(ui->AxisXSpinBox->valueRadians(), ui->AxisYSpinBox->valueRadians(), pos); pos = core->galacticToJ2000(pos); break; } case eclipticJ2000: { double ra, dec; StelUtils::eclToEqu(ui->AxisXSpinBox->valueRadians(), ui->AxisYSpinBox->valueRadians(), core->getCurrentPlanet()->getRotObliquity(2451545.0), &ra, &dec); StelUtils::spheToRect(ra, dec, pos); break; } case ecliptic: { double ra, dec; StelUtils::eclToEqu(ui->AxisXSpinBox->valueRadians(), ui->AxisYSpinBox->valueRadians(), core->getCurrentPlanet()->getRotObliquity(core->getJDE()), &ra, &dec); StelUtils::spheToRect(ra, dec, pos); pos = core->equinoxEquToJ2000(pos); break; } } mvmgr->setFlagTracking(false); mvmgr->moveToJ2000(pos, 0.05); }
void SporadicMeteorMgr::update(double deltaTime) { if (!m_flagShow) { return; } // step through and update all active meteors foreach (SporadicMeteor* m, activeMeteors) { if (!m->update(deltaTime)) { //important to delete when no longer active activeMeteors.removeOne(m); delete m; } } StelCore* core = StelApp::getInstance().getCore(); // going forward/backward OR current ZHR is zero ? // don't create new meteors if(!core->getRealTimeSpeed() || m_zhr < 1) { return; } // average meteors per frame float mpf = m_zhr * deltaTime / 3600.f; // maximum amount of meteors for the current frame int maxMpf = qRound(mpf); maxMpf = maxMpf < 1 ? 1 : maxMpf; float rate = mpf / (float) maxMpf; for (int i = 0; i < maxMpf; ++i) { float prob = (float) qrand() / (float) RAND_MAX; if (prob < rate) { SporadicMeteor* m = new SporadicMeteor(core, m_maxVelocity, m_bolideTexture); if (m->isAlive()) { activeMeteors.append(m); } else { delete m; } } } }
void SlewDialog::getCenterInfo() { StelCore *core = StelApp::getInstance().getCore(); const StelProjectorP projector = core->getProjection(StelCore::FrameEquinoxEqu); Vec3d centerPosition; Vec2f center = projector->getViewportCenter(); projector->unProject(center[0], center[1], centerPosition); double dec_j2000 = 0; double ra_j2000 = 0; StelUtils::rectToSphe(&ra_j2000,&dec_j2000,core->equinoxEquToJ2000(centerPosition)); ui->spinBoxRA->setRadians(ra_j2000); ui->spinBoxDec->setRadians(dec_j2000); }
void MeteorShowersMgr::init() { loadTextures(); m_meteorShowers = new MeteorShowers(this); m_configDialog = new MSConfigDialog(this); m_searchDialog = new MSSearchDialog(this); createActions(); loadConfig(); // timer to hide the alert messages m_messageTimer = new QTimer(this); m_messageTimer->setSingleShot(true); m_messageTimer->setInterval(9000); m_messageTimer->stop(); connect(m_messageTimer, SIGNAL(timeout()), this, SLOT(messageTimeout())); // MeteorShowers directory QString userDir = StelFileMgr::getUserDir() + "/modules/MeteorShowers"; StelFileMgr::makeSureDirExistsAndIsWritable(userDir); // Loads the JSON catalog m_catalogPath = userDir + "/showers.json"; if (!loadCatalog(m_catalogPath)) { displayMessage(q_("The current catalog of Meteor Showers is invalid!"), "#bb0000"); restoreDefaultCatalog(m_catalogPath); } // Sets up the download manager m_downloadMgr = new QNetworkAccessManager(this); connect(m_downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateFinished(QNetworkReply*))); // every 5 min, check if it's time to update QTimer* updateTimer = new QTimer(this); updateTimer->setInterval(300000); connect(updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdates())); updateTimer->start(); checkForUpdates(); // always check if we are on Earth StelCore* core = StelApp::getInstance().getCore(); m_onEarth = core->getCurrentPlanet().data()->getEnglishName() == "Earth"; connect(core, SIGNAL(locationChanged(StelLocation)), this, SLOT(locationChanged(StelLocation))); // enable at startup? setEnablePlugin(getEnableAtStartup()); }
long long int GetNow(void) { long long int t; StelCore *core = StelApp::getInstance().getCore(); #ifdef Q_OS_WIN32 union { FILETIME file_time; __int64 t; } tmp; GetSystemTimeAsFileTime(&tmp.file_time); t = (tmp.t/10) - 86400000000LL*(369*365+89); #else struct timeval tv; gettimeofday(&tv, 0); t = tv.tv_sec * 1000000LL + tv.tv_usec; #endif return t - core->getDeltaT(StelUtils::getJDFromSystem())*1000000; // Delta T anti-correction }
// Update the widget to make sure it is synchrone if the location is changed programmatically void LocationDialog::updateFromProgram(const StelLocation& currentLocation) { if (!dialog->isVisible()) return; StelCore* stelCore = StelApp::getInstance().getCore(); isEditingNew = false; // Check that the use as default check box needs to be updated // Move to setFieldsFromLocation()? --BM? const bool b = currentLocation.getID() == stelCore->getDefaultLocationID(); QSettings* conf = StelApp::getInstance().getSettings(); if (conf->value("init_location/location", "auto").toString() != ("auto")) { updateDefaultLocationControls(b); ui->pushButtonReturnToDefault->setEnabled(!b); } const QString& key1 = currentLocation.getID(); const QString& key2 = locationFromFields().getID(); if (key1!=key2) { setFieldsFromLocation(currentLocation); } LandscapeMgr *lmgr = GETSTELMODULE(LandscapeMgr); if (lmgr->getFlagUseLightPollutionFromDatabase()) { int bidx = currentLocation.bortleScaleIndex; if (!currentLocation.planetName.contains("Earth")) // location not on Earth... bidx = 1; if (bidx<1) // ...or it observatory, or it unknown location bidx = currentLocation.DEFAULT_BORTLE_SCALE_INDEX; stelCore->getSkyDrawer()->setBortleScaleIndex(bidx); lmgr->setAtmosphereBortleLightPollution(bidx); } }
// Initialize the dialog widgets and connect the signals/slots void LocationDialog::createDialogContent() { // We try to directly connect to the observer slots as much as we can ui->setupUi(dialog); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); // Init the SpinBox entries ui->longitudeSpinBox->setDisplayFormat(AngleSpinBox::DMSSymbols); ui->longitudeSpinBox->setPrefixType(AngleSpinBox::Longitude); ui->longitudeSpinBox->setMinimum(-180.0, true); ui->longitudeSpinBox->setMaximum( 180.0, true); ui->longitudeSpinBox->setWrapping(true); ui->latitudeSpinBox->setDisplayFormat(AngleSpinBox::DMSSymbols); ui->latitudeSpinBox->setPrefixType(AngleSpinBox::Latitude); ui->latitudeSpinBox->setMinimum(-90.0, true); ui->latitudeSpinBox->setMaximum( 90.0, true); ui->latitudeSpinBox->setWrapping(false); QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this); proxyModel->setSourceModel((QAbstractItemModel*)StelApp::getInstance().getLocationMgr().getModelAll()); proxyModel->sort(0, Qt::AscendingOrder); proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); ui->citiesListView->setModel(proxyModel); #ifdef Q_OS_WIN //Kinetic scrolling for tablet pc and pc QList<QWidget *> addscroll; addscroll << ui->citiesListView; installKineticScrolling(addscroll); #endif populatePlanetList(); populateCountryList(); connect(ui->citySearchLineEdit, SIGNAL(textChanged(const QString&)), proxyModel, SLOT(setFilterWildcard(const QString&))); connect(ui->citiesListView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(setPositionFromList(const QModelIndex&))); // Connect all the QT signals connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint))); connect(ui->mapLabel, SIGNAL(positionChanged(double, double)), this, SLOT(setPositionFromMap(double, double))); connect(ui->addLocationToListPushButton, SIGNAL(clicked()), this, SLOT(addCurrentLocationToList())); connect(ui->deleteLocationFromListPushButton, SIGNAL(clicked()), this, SLOT(deleteCurrentLocationFromList())); connect(ui->resetListPushButton, SIGNAL(clicked()), this, SLOT(resetCompleteList())); connect(ui->countryNameComboBox, SIGNAL(activated(const QString &)), this, SLOT(filterSitesByCountry())); StelCore* core = StelApp::getInstance().getCore(); const StelLocation& currentLocation = core->getCurrentLocation(); bool b = (currentLocation.getID() == core->getDefaultLocationID()); QSettings* conf = StelApp::getInstance().getSettings(); if (conf->value("init_location/location", "auto").toString() == "auto") { ui->useIpQueryCheckBox->setChecked(true); b = false; } setFieldsFromLocation(currentLocation); updateDefaultLocationControls(b); connect(ui->useIpQueryCheckBox, SIGNAL(clicked(bool)), this, SLOT(ipQueryLocation(bool))); connect(ui->useAsDefaultLocationCheckBox, SIGNAL(clicked(bool)), this, SLOT(setDefaultLocation(bool))); connect(ui->pushButtonReturnToDefault, SIGNAL(clicked()), core, SLOT(returnToDefaultLocation())); connectEditSignals(); connect(core, SIGNAL(locationChanged(StelLocation)), this, SLOT(updateFromProgram(StelLocation))); ui->citySearchLineEdit->setFocus(); }
void SearchDialog::manualPositionChanged() { ui->completionLabel->clearValues(); StelCore* core = StelApp::getInstance().getCore(); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr); Vec3d pos; Vec3d aimUp; double spinLong=ui->AxisXSpinBox->valueRadians(); double spinLat=ui->AxisYSpinBox->valueRadians(); // Since 0.15: proper handling of aimUp vector. This does not depend on the searched coordinate system, but on the MovementManager's C.S. // However, if those are identical, we have a problem when we want to look right into the pole. (e.g. zenith), which requires a special up vector. // aimUp depends on MovementMgr::MountMode mvmgr->mountMode! mvmgr->setViewUpVector(Vec3d(0., 0., 1.)); aimUp=mvmgr->getViewUpVectorJ2000(); StelMovementMgr::MountMode mountMode=mvmgr->getMountMode(); switch (getCurrentCoordinateSystem()) { case equatorialJ2000: { StelUtils::spheToRect(spinLong, spinLat, pos); if ( (mountMode==StelMovementMgr::MountEquinoxEquatorial) && (fabs(spinLat)> (0.9*M_PI/2.0)) ) { // make up vector more stable. // Strictly mount should be in a new J2000 mode, but this here also stabilizes searching J2000 coordinates. mvmgr->setViewUpVector(Vec3d(-cos(spinLong), -sin(spinLong), 0.) * (spinLat>0. ? 1. : -1. )); aimUp=mvmgr->getViewUpVectorJ2000(); } break; } case equatorial: { StelUtils::spheToRect(spinLong, spinLat, pos); pos = core->equinoxEquToJ2000(pos); if ( (mountMode==StelMovementMgr::MountEquinoxEquatorial) && (fabs(spinLat)> (0.9*M_PI/2.0)) ) { // make up vector more stable. mvmgr->setViewUpVector(Vec3d(-cos(spinLong), -sin(spinLong), 0.) * (spinLat>0. ? 1. : -1. )); aimUp=mvmgr->getViewUpVectorJ2000(); } break; } case horizontal: { double cx; cx = 3.*M_PI - spinLong; // N is zero, E is 90 degrees if (cx > 2.*M_PI) cx -= 2.*M_PI; StelUtils::spheToRect(cx, spinLat, pos); pos = core->altAzToJ2000(pos); if ( (mountMode==StelMovementMgr::MountAltAzimuthal) && (fabs(spinLat)> (0.9*M_PI/2.0)) ) { // make up vector more stable. mvmgr->setViewUpVector(Vec3d(-cos(cx), -sin(cx), 0.) * (spinLat>0. ? 1. : -1. )); aimUp=mvmgr->getViewUpVectorJ2000(); } break; } case galactic: { StelUtils::spheToRect(spinLong, spinLat, pos); pos = core->galacticToJ2000(pos); if ( (mountMode==StelMovementMgr::MountGalactic) && (fabs(spinLat)> (0.9*M_PI/2.0)) ) { // make up vector more stable. mvmgr->setViewUpVector(Vec3d(-cos(spinLong), -sin(spinLong), 0.) * (spinLat>0. ? 1. : -1. )); aimUp=mvmgr->getViewUpVectorJ2000(); } break; } case eclipticJ2000: { double ra, dec; StelUtils::eclToEqu(spinLong, spinLat, core->getCurrentPlanet()->getRotObliquity(2451545.0), &ra, &dec); StelUtils::spheToRect(ra, dec, pos); break; } case ecliptic: { double ra, dec; StelUtils::eclToEqu(spinLong, spinLat, core->getCurrentPlanet()->getRotObliquity(core->getJDE()), &ra, &dec); StelUtils::spheToRect(ra, dec, pos); pos = core->equinoxEquToJ2000(pos); break; } } mvmgr->setFlagTracking(false); mvmgr->moveToJ2000(pos, aimUp, 0.05); }
void StelGui::update() { StelCore* core = StelApp::getInstance().getCore(); if (core->getTimeRate()<-0.99*StelCore::JD_SECOND) { if (buttonTimeRewind->isChecked()==false) buttonTimeRewind->setChecked(true); } else { if (buttonTimeRewind->isChecked()==true) buttonTimeRewind->setChecked(false); } if (core->getTimeRate()>1.01*StelCore::JD_SECOND) { if (buttonTimeForward->isChecked()==false) { buttonTimeForward->setChecked(true); } } else { if (buttonTimeForward->isChecked()==true) buttonTimeForward->setChecked(false); } if (core->getTimeRate() == 0) { if (buttonTimeRealTimeSpeed->isChecked() != StelButton::ButtonStateNoChange) buttonTimeRealTimeSpeed->setChecked(StelButton::ButtonStateNoChange); } else if (core->getRealTimeSpeed()) { if (buttonTimeRealTimeSpeed->isChecked() != StelButton::ButtonStateOn) buttonTimeRealTimeSpeed->setChecked(StelButton::ButtonStateOn); } else if (buttonTimeRealTimeSpeed->isChecked() != StelButton::ButtonStateOff) { buttonTimeRealTimeSpeed->setChecked(StelButton::ButtonStateOff); } const bool isTimeNow=core->getIsTimeNow(); if (buttonTimeCurrent->isChecked()!=isTimeNow) { buttonTimeCurrent->setChecked(isTimeNow); } StelMovementMgr* mmgr = GETSTELMODULE(StelMovementMgr); const bool b = mmgr->getFlagTracking(); if (buttonGotoSelectedObject->isChecked()!=b) { buttonGotoSelectedObject->setChecked(b); } bool flag = GETSTELMODULE(StarMgr)->getFlagStars(); if (getGuiAction("actionShow_Stars")->isChecked() != flag) { getGuiAction("actionShow_Stars")->setChecked(flag); } flag = GETSTELMODULE(NebulaMgr)->getFlagHints(); if (getGuiAction("actionShow_Nebulas")->isChecked() != flag) getGuiAction("actionShow_Nebulas")->setChecked(flag); flag = GETSTELMODULE(StelSkyLayerMgr)->getFlagShow(); if (getGuiAction("actionShow_DSS")->isChecked() != flag) getGuiAction("actionShow_DSS")->setChecked(flag); flag = mmgr->getMountMode() != StelMovementMgr::MountAltAzimuthal; if (getGuiAction("actionSwitch_Equatorial_Mount")->isChecked() != flag) getGuiAction("actionSwitch_Equatorial_Mount")->setChecked(flag); SolarSystem* ssmgr = GETSTELMODULE(SolarSystem); flag = ssmgr->getFlagLabels(); if (getGuiAction("actionShow_Planets_Labels")->isChecked() != flag) getGuiAction("actionShow_Planets_Labels")->setChecked(flag); flag = ssmgr->getFlagOrbits(); if (getGuiAction("actionShow_Planets_Orbits")->isChecked() != flag) getGuiAction("actionShow_Planets_Orbits")->setChecked(flag); flag = ssmgr->getFlagTrails(); if (getGuiAction("actionShow_Planets_Trails")->isChecked() != flag) getGuiAction("actionShow_Planets_Trails")->setChecked(flag); flag = StelApp::getInstance().getVisionModeNight(); if (getGuiAction("actionShow_Night_Mode")->isChecked() != flag) getGuiAction("actionShow_Night_Mode")->setChecked(flag); flag = StelMainWindow::getInstance().isFullScreen(); if (getGuiAction("actionSet_Full_Screen_Global")->isChecked() != flag) getGuiAction("actionSet_Full_Screen_Global")->setChecked(flag); skyGui->infoPanel->setTextFromObjects(GETSTELMODULE(StelObjectMgr)->getSelectedObject()); // Check if the progressbar window changed, if yes update the whole view if (savedProgressBarSize!=skyGui->progressBarMgr->boundingRect().size()) { savedProgressBarSize=skyGui->progressBarMgr->boundingRect().size(); skyGui->updateBarsPos(); } dateTimeDialog->setDateTime(core->getJDay()); }
StelViewportDistorterFisheyeToSphericMirror::StelViewportDistorterFisheyeToSphericMirror (int screenWidth,int screenHeight, StelRenderer* renderer) : screenWidth(screenWidth) , screenHeight(screenHeight) , originalProjectorParams(StelApp::getInstance().getCore()-> getCurrentStelProjectorParams()) , maxTexCoords(1.0f, 1.0f) , texCoordGrid(NULL) , vertexGrid(renderer->createVertexBuffer<Vertex>(PrimitiveType_TriangleStrip)) { QSettings& conf = *StelApp::getInstance().getSettings(); StelCore* core = StelApp::getInstance().getCore(); // initialize viewport parameters and texture size: // maximum FOV value of the not yet distorted image double distorterMaxFOV = conf.value("spheric_mirror/distorter_max_fov",175.f).toFloat(); if (distorterMaxFOV > 240.f) { qDebug() << "spheric_mirror/distorter_max_fov too high : setting to 240.0"; distorterMaxFOV = 240.f; } else if (distorterMaxFOV < 120.f) { qDebug() << "spheric_mirror/distorter_max_fov too low : setting to 120.0"; distorterMaxFOV = 120.f; } if (distorterMaxFOV > core->getMovementMgr()->getMaxFov()) distorterMaxFOV = core->getMovementMgr()->getMaxFov(); StelProjectorP proj = core->getProjection(StelCore::FrameJ2000); core->getMovementMgr()->setMaxFov(distorterMaxFOV); // width of the not yet distorted image newProjectorParams.viewportXywh[2] = conf.value("spheric_mirror/newProjectorParams.viewportXywh[2]idth", originalProjectorParams.viewportXywh[2]).toInt(); if (newProjectorParams.viewportXywh[2] <= 0) { newProjectorParams.viewportXywh[2] = originalProjectorParams.viewportXywh[2]; } else if (newProjectorParams.viewportXywh[2] > screenWidth) { newProjectorParams.viewportXywh[2] = screenWidth; } // height of the not yet distorted image newProjectorParams.viewportXywh[3] = conf.value("spheric_mirror/newProjectorParams.viewportXywh[3]eight", originalProjectorParams.viewportXywh[3]).toInt(); if (newProjectorParams.viewportXywh[3] <= 0) { newProjectorParams.viewportXywh[3] = originalProjectorParams.viewportXywh[3]; } else if (newProjectorParams.viewportXywh[3] > screenHeight) { newProjectorParams.viewportXywh[3] = screenHeight; } // center of the FOV-disk in the not yet distorted image newProjectorParams.viewportCenter[0] = conf.value("spheric_mirror/viewportCenterX", 0.5*newProjectorParams.viewportXywh[2]).toFloat(); newProjectorParams.viewportCenter[1] = conf.value("spheric_mirror/viewportCenterY", 0.5*newProjectorParams.viewportXywh[3]).toFloat(); // diameter of the FOV-disk in pixels newProjectorParams.viewportFovDiameter = conf.value("spheric_mirror/viewport_fov_diameter", qMin(newProjectorParams.viewportXywh[2], newProjectorParams.viewportXywh[3])).toFloat(); // Vestigial mirror texture dimensions: used to be a single value, // the closest power of 2 higher or equal to the larger screen dimension. texture_w = newProjectorParams.viewportXywh[2]; texture_h = newProjectorParams.viewportXywh[3]; // while (texture_wh < newProjectorParams.viewportXywh[2] || // texture_wh < newProjectorParams.viewportXywh[3]) // { // texture_wh <<= 1; // } // TODO: Given the above, is there any point in this? --BM newProjectorParams.viewportXywh[0] = (screenWidth-newProjectorParams.viewportXywh[2]) >> 1; newProjectorParams.viewportXywh[1] = (screenHeight-newProjectorParams.viewportXywh[3]) >> 1; StelApp::getInstance().getCore()->setCurrentStelProjectorParams(newProjectorParams); const QString customDistortionFileName = QDir::fromNativeSeparators(conf.value("spheric_mirror/custom_distortion_file","").toString()); if (customDistortionFileName.isEmpty()) { generateDistortion(conf, proj, distorterMaxFOV, renderer); } else if (!loadDistortionFromFile(customDistortionFileName, renderer)) { qDebug() << "Falling back to generated distortion"; generateDistortion(conf, proj, distorterMaxFOV, renderer); } vertexGrid->lock(); }