Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions guide/app_config_ini.tex
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ \subsection{\big[astro\big]}
flag\_nebula & bool & true & Set to \emph{false} to hide the nebulae on start-up. \\%\midrule
flag\_nebula\_name & bool & false & Set to \emph{true} to show the nebula labels on start-up. \\%\midrule
flag\_nebula\_display\_no\_texture & bool & false & Set to \emph{true} to suppress displaying of nebula textures. \\%\midrule
nebula\_texture\_decimation & int & 1 & Reduce nebula texture size by this factor [1\ldots8]. May help on very limited systems. \\
nebula\_hints\_amount & float & 3.0 & Sets the amount of hints [0\ldots10]. \\%\midrule
nebula\_labels\_amount & float & 3.0 & Sets the amount of labels [0\ldots10].\\%\midrule
flag\_milky\_way & bool & true & Set to \emph{false} to hide the Milky Way.\\%\midrule
Expand Down Expand Up @@ -696,7 +697,7 @@ \subsection{\big[projection\big]}
\emph{ID} & \emph{Type} & \emph{Description}\\\midrule
type & string & Sets projection mode. Values: \emph{ProjectionPerspective,
ProjectionEqualArea, ProjectionStereographic, ProjectionFisheye,
ProjectionHammer, ProjectionCylinder, ProjectionMercator,
ProjectionHammer, ProjectionCylinder, ProjectionCylinderFill, ProjectionMercator,
ProjectionOrthographic, ProjectionMiller}, or \emph{ProjectionSinusoidal}.\\%\midrule
flip\_horz & bool & \\%\midrule
flip\_vert & bool & \\%\midrule
Expand Down Expand Up @@ -841,7 +842,7 @@ \subsection{\big[tui\big]}
\subsection{\big[video\big]}
\label{sec:config.ini:video}

\begin{tabularx}{\textwidth}{l|l|X}\toprule
\begin{longtable}{l|l|p{80mm}}\toprule
\emph{ID} & \emph{Type} & \emph{Description}\\\midrule
fullscreen & bool & If \emph{true}, Stellarium will start up in full-screen mode, else windowed mode\\%\midrule
screen\_w & int & Display width when in windowed mode. Value in pixels, e.g. \emph{1024}\\%\midrule
Expand All @@ -851,11 +852,15 @@ \subsection{\big[video\big]}
viewport\_effect & string & This is used when the spheric mirror display mode is activated. Values include \emph{none} and \emph{sphericMirrorDistorter}.\\%\midrule
minimum\_fps & int & Sets the minimum number of frames per second to display at (hardware performance permitting)\\%\midrule
maximum\_fps & int & Sets the maximum number of frames per second to display at. This is useful to reduce power consumption in laptops.\\%\midrule
multisampling & int & Sets the number of samples to use for multisampling antialiasing. \emph{0} disables antialiasing, \emph{1} is no-op (single sample per pixel), higher values increase smoothness and degrade performance. Too high a value may result in excessive blurriness of the GUI. A good starting value to try is \emph{4}.\\
planet\_shadows\_supersampling & bool & Improves quality of shadows on the Moon by evaluating the color for each multisampling sample, rather than once per pixel. Level of improvement (and performance cost) depends on \emph{multisampling} setting. Default is \emph{false}, i.e. disabled.\\
anisotropic\_filtering & int & Improves quality of rendering of inclined textured surfaces like e.g. planetary surface near the limb. Modern (and even quite old, like from 2010) GPUs can handle high anisotropy with no noticeable performance drop, so it should be fine to set this value as high as 16. If this setting value is higher than the GPU is capable of, the maximum value supported is used. The default is 16. To disable anisotropic filtering, set this value to 0.\\
multisampling & int & Sets the number of samples to use for multisampling antialiasing. \emph{0} disables antialiasing, \emph{1} is no-op (single sample per pixel),
higher values increase smoothness and degrade performance. Too high a value may result in excessive blurriness of the GUI. A good starting value to try is \emph{4}.\\
planet\_shadows\_supersampling & bool & Improves quality of shadows on the Moon by evaluating the color for each multisampling sample, rather than once per pixel.
Level of improvement (and performance cost) depends on \emph{multisampling} setting. Default is \emph{false}, i.e. disabled.\\
anisotropic\_filtering & int & Improves quality of rendering of inclined textured surfaces like e.g. planetary surface near the limb.
Modern (and even quite old, like from 2010) GPUs can handle high anisotropy with no noticeable performance drop, so it should be fine to set this value as high as 16.
If this setting value is higher than the GPU is capable of, the maximum value supported is used. The default is 16. To disable anisotropic filtering, set this value to 0.\\
\bottomrule
\end{tabularx}
\end{longtable}

\subsection{\big[viewing\big]}
%\label{sec:config.ini:viewing}
Expand Down
2 changes: 1 addition & 1 deletion plugins/NavStars/src/NavStars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "StelFader.hpp"
#include "StelModule.hpp"
#include "StelObject.hpp" // For StelObjectP
#include "StelTexture.hpp"
#include "StelTextureTypes.hpp"

#include <QSettings>

Expand Down
23 changes: 14 additions & 9 deletions src/core/StelSkyImageTile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ void StelSkyImageTile::initCtor()
texFader = Q_NULLPTR;
birthJD = -1e10;
withAberration = true;
decimation = 1;
}

// Constructor
StelSkyImageTile::StelSkyImageTile(const QString& url, StelSkyImageTile* parent) : MultiLevelJsonBase(parent)
StelSkyImageTile::StelSkyImageTile(const QString& url, StelSkyImageTile* parent, int decimateBy) : MultiLevelJsonBase(parent)
{
initCtor();
if (parent!=Q_NULLPTR)
decimation=decimateBy;
if (parent)
{
luminance = parent->luminance;
alphaBlend = parent->alphaBlend;
Expand All @@ -62,10 +64,11 @@ StelSkyImageTile::StelSkyImageTile(const QString& url, StelSkyImageTile* parent)
}

// Constructor from a map used for JSON files with more than 1 level
StelSkyImageTile::StelSkyImageTile(const QVariantMap& map, StelSkyImageTile* parent) : MultiLevelJsonBase(parent)
StelSkyImageTile::StelSkyImageTile(const QVariantMap& map, StelSkyImageTile* parent, int decimateBy) : MultiLevelJsonBase(parent)
{
initCtor();
if (parent!=Q_NULLPTR)
decimation=decimateBy;
if (parent)
{
luminance = parent->luminance;
alphaBlend = parent->alphaBlend;
Expand Down Expand Up @@ -209,7 +212,7 @@ void StelSkyImageTile::getTilesToDraw(QMultiMap<double, StelSkyImageTile*>& resu
{
// The tile has an associated texture, but it is not yet loaded: load it now
StelTextureMgr& texMgr=StelApp::getInstance().getTextureManager();
tex = texMgr.createTextureThread(absoluteImageURI, StelTexture::StelTextureParams(true));
tex = texMgr.createTextureThread(absoluteImageURI, StelTexture::StelTextureParams(true, GL_LINEAR, GL_CLAMP_TO_EDGE, false, decimation));
if (!tex)
{
qWarning() << "WARNING : Can't create tile: " << absoluteImageURI;
Expand Down Expand Up @@ -237,15 +240,15 @@ void StelSkyImageTile::getTilesToDraw(QMultiMap<double, StelSkyImageTile*>& resu
#else
if (s.type()==QVariant::Map)
#endif
nt = new StelSkyImageTile(s.toMap(), this);
nt = new StelSkyImageTile(s.toMap(), this, decimation);
else
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Q_ASSERT(s.metaType()==QMetaType(QMetaType::QString));
#else
Q_ASSERT(s.type()==QVariant::String);
#endif
nt = new StelSkyImageTile(s.toString(), this);
nt = new StelSkyImageTile(s.toString(), this, decimation);
}
subTiles.append(nt);
}
Expand Down Expand Up @@ -469,7 +472,8 @@ void StelSkyImageTile::loadFromQVariantMap(const QVariantMap& map)
{
const QVariant& polyRaDec = polyList.at(i);
QVector<Vec3d> vertices;
for (const auto& vRaDec : polyRaDec.toList())
Comment thread
10110111 marked this conversation as resolved.
const QList<QVariant> polyRaDecList=polyRaDec.toList();
for (const auto& vRaDec : polyRaDecList)
{
const QVariantList vl = vRaDec.toList();
Vec3d v;
Expand All @@ -484,7 +488,8 @@ void StelSkyImageTile::loadFromQVariantMap(const QVariantMap& map)
{
const QVariant& polyXY = texCoordList.at(i);
QVector<Vec2f> texCoords;
for (const auto& vXY : polyXY.toList())
const QList<QVariant> polyXYlist=polyXY.toList();
for (const auto& vXY : polyXYlist)
{
const QVariantList vl = vXY.toList();
texCoords.append(Vec2f(vl.at(0).toFloat(&ok), vl.at(1).toFloat(&ok)));
Expand Down
6 changes: 4 additions & 2 deletions src/core/StelSkyImageTile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ class StelSkyImageTile : public MultiLevelJsonBase
StelSkyImageTile();

//! Constructor
StelSkyImageTile(const QString& url, StelSkyImageTile* parent=Q_NULLPTR);
StelSkyImageTile(const QString& url, StelSkyImageTile* parent=Q_NULLPTR, int decimateBy=1);
//! Constructor
StelSkyImageTile(const QVariantMap& map, StelSkyImageTile* parent);
StelSkyImageTile(const QVariantMap& map, StelSkyImageTile* parent, int decimateBy=1);

//! Destructor
~StelSkyImageTile() Q_DECL_OVERRIDE;
Expand Down Expand Up @@ -161,6 +161,8 @@ class StelSkyImageTile : public MultiLevelJsonBase
QTimeLine* texFader;

QString htmlDescription;

int decimation; //!> Allow texture size reduction for very weak hardware. Default 1, useful 2..8.
};

#endif // STELSKYIMAGETILE_HPP
18 changes: 8 additions & 10 deletions src/core/StelSkyLayerMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@
#include "StelApp.hpp"
#include "StelCore.hpp"
#include "StelFileMgr.hpp"
#include "StelProjector.hpp"
#include "StelSkyImageTile.hpp"
#include "StelModuleMgr.hpp"
#include "StelPainter.hpp"
#include "MilkyWay.hpp"
#include "StelGuiBase.hpp"
#include "StelSkyDrawer.hpp"
#include "StelTranslator.hpp"
#include "StelProgressController.hpp"

Expand Down Expand Up @@ -64,9 +61,10 @@ double StelSkyLayerMgr::getCallOrder(StelModuleActionName actionName) const
// read from stream
void StelSkyLayerMgr::init()
{
loadCollection();

QSettings* conf = StelApp::getInstance().getSettings();
const int decimation=conf->value("astro/nebula_texture_decimation", 1).toInt();
loadCollection(decimation);

conf->beginGroup("skylayers");
for (const auto& key : conf->childKeys())
{
Expand All @@ -86,7 +84,7 @@ void StelSkyLayerMgr::init()
addAction("actionShow_DSO_Textures_Reload", N_("Display Options"), N_("Reload the deep-sky objects background images"), "loadCollection()", "Ctrl+I");
}

void StelSkyLayerMgr::loadCollection()
void StelSkyLayerMgr::loadCollection(int decimateBy)
{
if (!allSkyLayers.isEmpty())
allSkyLayers.clear();
Expand All @@ -95,7 +93,7 @@ void StelSkyLayerMgr::loadCollection()
if (path.isEmpty())
qWarning() << "ERROR while loading nebula texture set default";
else
insertSkyImage(path);
insertSkyImage(path, QString(), true, decimateBy);
}

QString StelSkyLayerMgr::insertSkyLayer(StelSkyLayerP tile, const QString& keyHint, bool ashow)
Expand Down Expand Up @@ -131,9 +129,9 @@ QString StelSkyLayerMgr::insertSkyLayer(StelSkyLayerP tile, const QString& keyHi
}

// Add a new image from its URI (URL or local file name)
QString StelSkyLayerMgr::insertSkyImage(const QString& uri, const QString& keyHint, bool ashow)
QString StelSkyLayerMgr::insertSkyImage(const QString& uri, const QString& keyHint, bool ashow, int decimateBy)
{
return insertSkyLayer(StelSkyLayerP(new StelSkyImageTile(uri)), keyHint, ashow);
return insertSkyLayer(StelSkyLayerP(new StelSkyImageTile(uri, Q_NULLPTR, decimateBy)), keyHint, ashow);
}

// Remove a sky image tile from the list of background images
Expand Down Expand Up @@ -258,7 +256,7 @@ bool StelSkyLayerMgr::loadSkyImage(const QString& id, const QString& filename,
double long1, double lat1,
double long2, double lat2,
double long3, double lat3,
double minRes, double maxBright, bool visible, StelCore::FrameType frameType, bool withAberration)
double minRes, double maxBright, bool visible, StelCore::FrameType frameType, bool withAberration, int decimateBy)
{
if (allSkyLayers.contains(id))
{
Expand Down
10 changes: 7 additions & 3 deletions src/core/StelSkyLayerMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public slots:
//! @param visible initial visibility setting
//! @param frameType Coordinate frame type
//! @param withAberration the image shall undergo aberration effects. Else it is really fixed to the frame. This flag is only used for images linked to FrameJ2000.
//! @param decimateBy allow texture reduction on loading, useful on very limited hardware.
//! @note frameType has been added 2017-03. Use loadSkyImage(... , StelCore::FrameJ2000) for the previous behaviour!
//! @note For frameType=AzAlt, azimuth currently is counted from South towards East.
//! @bug Some image are not visible close to screen center, only when in the corners.
Expand All @@ -106,7 +107,7 @@ public slots:
double long1, double lat1,
double long2, double lat2,
double long3, double lat3,
double minRes, double maxBright, bool visible, StelCore::FrameType frameType=StelCore::FrameJ2000, bool withAberration=true);
double minRes, double maxBright, bool visible, StelCore::FrameType frameType=StelCore::FrameJ2000, bool withAberration=true, int decimateBy=1);

//! Decide to show or not to show a layer by its ID.
//! @param id the id of the layer whose status is to be changed.
Expand All @@ -129,8 +130,9 @@ public slots:
//! @param uri the local file or the URL where the JSON image description is located.
//! @param keyHint a hint on which key to use for later referencing the image.
//! @param show defined whether the image should be shown by default.
//! @param decimateBy Allow image size reduction (e.g., 2...8) on very limited hardware
//! @return the reference key to use when accessing this image later on.
QString insertSkyImage(const QString& uri, const QString& keyHint=QString(), bool show=true);
QString insertSkyImage(const QString& uri, const QString& keyHint=QString(), bool show=true, int decimateBy=1);

//! Remove a sky layer from the list.
//! Note: this is not thread safe, and so should not be used directly
Expand All @@ -154,7 +156,9 @@ private slots:
//! @param percentage the percentage of loaded data
void percentLoadedChanged(int percentage);

void loadCollection();
//! Load the textures from the default nebula collection
//! @param decimateBy allow texture size decimation (division) by this factor (for very weak hardware)
void loadCollection(int decimateBy=1);

private:
//! Store the information needed for a graphical element layer.
Expand Down
44 changes: 25 additions & 19 deletions src/core/StelTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

#include "StelTexture.hpp"
#include "StelTextureMgr.hpp"
#include "StelFileMgr.hpp"
#include "StelApp.hpp"
#include "StelUtils.hpp"
#include "StelPainter.hpp"
#include "StelMainView.hpp"
#include "StelOpenGL.hpp"


#include <QImageReader>
#include <QSize>
Expand Down Expand Up @@ -116,23 +116,23 @@ void StelTexture::reportError(const QString& aerrorMessage)
emit loadingProcessFinished(true);
}

StelTexture::GLData StelTexture::imageToGLData(const QImage &image)
StelTexture::GLData StelTexture::imageToGLData(const QImage &image, const int decimateBy)
{
GLData ret = GLData();
if (image.isNull())
return ret;
ret.data = convertToGLFormat(image, ret.format, ret.type, ret.width, ret.height);
ret.data = convertToGLFormat(image, ret.format, ret.type, decimateBy, ret.width, ret.height);
return ret;
}

/*************************************************************************
Defined to be passed to QtConcurrent::run
*************************************************************************/
StelTexture::GLData StelTexture::loadFromPath(const QString &path)
StelTexture::GLData StelTexture::loadFromPath(const QString &path, const int decimateBy)
{
try
{
return imageToGLData(QImage(path));
return imageToGLData(QImage(path), decimateBy);
}
catch(std::exception& ex) //this catches out-of-memory errors from file conversion
{
Expand All @@ -143,11 +143,11 @@ StelTexture::GLData StelTexture::loadFromPath(const QString &path)
}
}

StelTexture::GLData StelTexture::loadFromData(const QByteArray& data)
StelTexture::GLData StelTexture::loadFromData(const QByteArray& data, const int decimateBy)
{
try
{
return imageToGLData(QImage::fromData(data));
return imageToGLData(QImage::fromData(data), decimateBy);
}
catch(std::exception& ex) //this catches out-of-memory errors from file conversion
{
Expand Down Expand Up @@ -204,12 +204,12 @@ void StelTexture::waitForLoaded()
loader->waitForFinished();
}

template <typename T, typename Param, typename Arg>
void StelTexture::startAsyncLoader(T (*functionPointer)(Param), const Arg &arg)
template <typename T, typename...Params, typename...Args>
void StelTexture::startAsyncLoader(T (*functionPointer)(Params...), Args&&...args)
{
Q_ASSERT(loader==Q_NULLPTR);
//own thread pool only supported with Qt 5.4+
loader = new QFuture<GLData>(QtConcurrent::run(textureMgr->loaderThreadPool, functionPointer, arg));
//own thread pool supported with Qt 5.4+
loader = new QFuture<GLData>(QtConcurrent::run(textureMgr->loaderThreadPool, functionPointer, std::forward<Args>(args)...));
}

bool StelTexture::load()
Expand All @@ -232,7 +232,7 @@ bool StelTexture::load()
// Not a remote file, start a loader from local file.
if (loader == Q_NULLPTR)
{
startAsyncLoader(loadFromPath,fullPath);
startAsyncLoader(static_cast<GLData(*)(const QString&, const int)>(loadFromPath), fullPath, loadParams.decimation);
return false;
}
// Wait until the loader finish.
Expand All @@ -248,7 +248,7 @@ void StelTexture::onNetworkReply()
if(data.isEmpty()) //prevent starting the loader when there is nothing to load
reportError(QString("Empty result received for URL: %1").arg(networkReply->url().toString()));
else
startAsyncLoader(loadFromData, data);
startAsyncLoader(static_cast<GLData(*)(const QByteArray&, const int)>(loadFromData), data, loadParams.decimation);
}
else
reportError(networkReply->errorString());
Expand Down Expand Up @@ -279,15 +279,21 @@ bool StelTexture::getDimensions(int &awidth, int &aheight)
return true;
}

QByteArray StelTexture::convertToGLFormat(QImage image, GLint& format, GLint& type, int& width, int& height)
QByteArray StelTexture::convertToGLFormat(QImage image, GLint& format, GLint& type, int decimate, int& width, int& height)
{
QByteArray ret;
const auto glInfo = StelMainView::getInstance().getGLInformation();
width = std::min(image.width(), glInfo.maxTextureSize);
height = std::min(image.height(), glInfo.maxTextureSize);
width = std::min(image.width()/decimate, glInfo.maxTextureSize);
height = std::min(image.height()/decimate, glInfo.maxTextureSize);

#ifndef NDEBUG
if (decimate>1)
qDebug() << "decimated texture width: " << image.width() << "/" << decimate << "->" << width;
#endif
if(width != image.width() || height != image.height())
{
qWarning().nospace() << "Got a texture with too large dimensions: "
if ((decimate==1) || (image.width()/decimate>glInfo.maxTextureSize) || (image.height()/decimate>glInfo.maxTextureSize))
qWarning().nospace() << "Got a texture with too large dimensions: "
<< image.width() << "x" << image.height()
<< ", while maximum size is " << glInfo.maxTextureSize
<< ". Shrinking to fit in the limit.";
Expand Down Expand Up @@ -458,5 +464,5 @@ bool StelTexture::glLoad(const GLData& data)
// Actually load the texture to openGL memory
bool StelTexture::glLoad(const QImage& image)
{
return glLoad(imageToGLData(image));
return glLoad(imageToGLData(image, loadParams.decimation));
}
Loading