Skip to content

Commit

Permalink
Delete previous skybox implementation and save skybox settings as a D…
Browse files Browse the repository at this point in the history
…OM element
  • Loading branch information
NEDJIMAbelgacem committed Aug 1, 2020
1 parent 5c418c4 commit b39547e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 54 deletions.
20 changes: 0 additions & 20 deletions python/3d/auto_generated/qgs3dmapsettings.sip.in
Expand Up @@ -299,26 +299,6 @@ Sets list of extra 3D renderers to use in the scene. Takes ownership of the obje
QList<QgsAbstract3DRenderer *> renderers() const;
%Docstring
Returns list of extra 3D renderers
%End

void setSkybox( bool enabled, const QString &fileBase = QString(), const QString &fileExtension = QString() );
%Docstring
Sets skybox configuration. When enabled, map scene will try to load six texture files
using the following syntax of filenames: "[base]_[side][extension]" where [side] is one
of the following: posx/posy/posz/negx/negy/negz and [base] and [extension] are the arguments
passed this method.
%End
bool hasSkyboxEnabled() const;
%Docstring
Returns whether skybox is enabled
%End
QString skyboxFileBase() const;
%Docstring
Returns base part of filenames of skybox (see :py:func:`~Qgs3DMapSettings.setSkybox`)
%End
QString skyboxFileExtension() const;
%Docstring
Returns extension part of filenames of skybox (see :py:func:`~Qgs3DMapSettings.setSkybox`)
%End

void setShowTerrainBoundingBoxes( bool enabled );
Expand Down
18 changes: 2 additions & 16 deletions src/3d/qgs3dmapsettings.cpp
Expand Up @@ -54,9 +54,6 @@ Qgs3DMapSettings::Qgs3DMapSettings( const Qgs3DMapSettings &other )
, mFieldOfView( other.mFieldOfView )
, mLayers( other.mLayers )
, mRenderers() // initialized in body
, mSkyboxEnabled( other.mSkyboxEnabled )
, mSkyboxFileBase( other.mSkyboxFileBase )
, mSkyboxFileExtension( other.mSkyboxFileExtension )
, mTransformContext( other.mTransformContext )
, mPathResolver( other.mPathResolver )
, mMapThemes( other.mMapThemes )
Expand Down Expand Up @@ -208,9 +205,7 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte
}

QDomElement elemSkybox = elem.firstChildElement( QStringLiteral( "skybox" ) );
mSkyboxEnabled = elemSkybox.attribute( QStringLiteral( "enabled" ), QStringLiteral( "0" ) ).toInt();
mSkyboxFileBase = elemSkybox.attribute( QStringLiteral( "file-base" ) );
mSkyboxFileExtension = elemSkybox.attribute( QStringLiteral( "file-ext" ) );
mSkyboxSettings.readXml( elemSkybox, context );

QDomElement elemDebug = elem.firstChildElement( QStringLiteral( "debug" ) );
mShowTerrainBoundingBoxes = elemDebug.attribute( QStringLiteral( "bounding-boxes" ), QStringLiteral( "0" ) ).toInt();
Expand Down Expand Up @@ -300,10 +295,8 @@ QDomElement Qgs3DMapSettings::writeXml( QDomDocument &doc, const QgsReadWriteCon
elem.appendChild( elemRenderers );

QDomElement elemSkybox = doc.createElement( QStringLiteral( "skybox" ) );
elemSkybox.setAttribute( QStringLiteral( "enabled" ), mSkyboxEnabled ? 1 : 0 );
// TODO: use context for relative paths, maybe explicitly list all files(?)
elemSkybox.setAttribute( QStringLiteral( "file-base" ), mSkyboxFileBase );
elemSkybox.setAttribute( QStringLiteral( "file-ext" ), mSkyboxFileExtension );
mSkyboxSettings.writeXml( elemSkybox, context );
elem.appendChild( elemSkybox );

QDomElement elemDebug = doc.createElement( QStringLiteral( "debug" ) );
Expand Down Expand Up @@ -588,13 +581,6 @@ void Qgs3DMapSettings::setFieldOfView( const float fieldOfView )
emit fieldOfViewChanged();
}

void Qgs3DMapSettings::setSkybox( bool enabled, const QString &fileBase, const QString &fileExtension )
{
mSkyboxEnabled = enabled;
mSkyboxFileBase = fileBase;
mSkyboxFileExtension = fileExtension;
}

void Qgs3DMapSettings::setSkyboxSettings( const QgsSkyboxSettings &skyboxSettings )
{
mSkyboxSettings = skyboxSettings;
Expand Down
20 changes: 2 additions & 18 deletions src/3d/qgs3dmapsettings.h
Expand Up @@ -281,20 +281,6 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject, public QgsTemporalRangeObjec
//! Returns list of extra 3D renderers
QList<QgsAbstract3DRenderer *> renderers() const { return mRenderers; }

/**
* Sets skybox configuration. When enabled, map scene will try to load six texture files
* using the following syntax of filenames: "[base]_[side][extension]" where [side] is one
* of the following: posx/posy/posz/negx/negy/negz and [base] and [extension] are the arguments
* passed this method.
*/
void setSkybox( bool enabled, const QString &fileBase = QString(), const QString &fileExtension = QString() );
//! Returns whether skybox is enabled
bool hasSkyboxEnabled() const { return mSkyboxEnabled; }
//! Returns base part of filenames of skybox (see setSkybox())
QString skyboxFileBase() const { return mSkyboxFileBase; }
//! Returns extension part of filenames of skybox (see setSkybox())
QString skyboxFileExtension() const { return mSkyboxFileExtension; }

//! Sets whether to display bounding boxes of terrain tiles (for debugging)
void setShowTerrainBoundingBoxes( bool enabled );
//! Returns whether to display bounding boxes of terrain tiles (for debugging)
Expand Down Expand Up @@ -502,15 +488,13 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject, public QgsTemporalRangeObjec
float mFieldOfView = 45.0f; //<! Camera lens field of view value
QList<QgsMapLayerRef> mLayers; //!< Layers to be rendered
QList<QgsAbstract3DRenderer *> mRenderers; //!< Extra stuff to render as 3D object
bool mSkyboxEnabled = false; //!< Whether to render skybox
QString mSkyboxFileBase; //!< Base part of the files with skybox textures
QString mSkyboxFileExtension; //!< Extension part of the files with skybox textures
//! Coordinate transform context
QgsCoordinateTransformContext mTransformContext;
QgsPathResolver mPathResolver;
QgsMapThemeCollection *mMapThemes = nullptr; //!< Pointer to map themes (e.g. from the current project) to resolve map theme content from the name
double mDpi = 96; //!< Dot per inch value for the screen / painter
QgsSkyboxSettings mSkyboxSettings;

QgsSkyboxSettings mSkyboxSettings; //!< Skybox realted configuration
};


Expand Down

0 comments on commit b39547e

Please sign in to comment.