21#include <QDomDocument>
24using namespace Qt::StringLiterals;
27 : mSkyboxType( other.mSkyboxType )
29 , mPanoramicTexturePath( other.mPanoramicTexturePath )
31 , mCubeMapping( other.mCubeMapping )
32 , mCubeMapFacesPaths( other.mCubeMapFacesPaths )
40 this->mSkyboxType = rhs.mSkyboxType;
41#if ENABLE_PANORAMIC_SKYBOX
42 this->mPanoramicTexturePath = rhs.mPanoramicTexturePath;
44 this->mCubeMapFacesPaths = rhs.mCubeMapFacesPaths;
45 this->mCubeMapping = rhs.mCubeMapping;
52 const QString skyboxTypeStr = element.attribute( u
"skybox-type"_s );
53 if ( skyboxTypeStr ==
"Distinct Faces"_L1 )
55#if ENABLE_PANORAMIC_SKYBOX
56 else if ( skyboxTypeStr ==
"Panoramic Texture"_L1 )
57 mSkyboxType = Qgis::SkyboxType::Panoramic;
58 mPanoramicTexturePath = pathResolver.
readPath( element.attribute( u
"panoramic-texture-path"_s ) );
60 mCubeMapFacesPaths.clear();
61 mCubeMapFacesPaths[u
"posX"_s] = pathResolver.
readPath( element.attribute( u
"posX-texture-path"_s ) );
62 mCubeMapFacesPaths[u
"posY"_s] = pathResolver.
readPath( element.attribute( u
"posY-texture-path"_s ) );
63 mCubeMapFacesPaths[u
"posZ"_s] = pathResolver.
readPath( element.attribute( u
"posZ-texture-path"_s ) );
64 mCubeMapFacesPaths[u
"negX"_s] = pathResolver.
readPath( element.attribute( u
"negX-texture-path"_s ) );
65 mCubeMapFacesPaths[u
"negY"_s] = pathResolver.
readPath( element.attribute( u
"negY-texture-path"_s ) );
66 mCubeMapFacesPaths[u
"negZ"_s] = pathResolver.
readPath( element.attribute( u
"negZ-texture-path"_s ) );
72 switch ( mSkyboxType )
75 element.setAttribute( u
"skybox-type"_s, u
"Distinct Faces"_s );
78#if ENABLE_PANORAMIC_SKYBOX
79 case Qgis::SkyboxType::Panoramic:
80 element.setAttribute( u
"skybox-type"_s, u
"Panoramic Texture"_s );
86#if ENABLE_PANORAMIC_SKYBOX
87 element.setAttribute( u
"panoramic-texture-path"_s, pathResolver.
writePath( mPanoramicTexturePath ) );
89 element.setAttribute( u
"posX-texture-path"_s, pathResolver.
writePath( mCubeMapFacesPaths[u
"posX"_s] ) );
90 element.setAttribute( u
"posY-texture-path"_s, pathResolver.
writePath( mCubeMapFacesPaths[u
"posY"_s] ) );
91 element.setAttribute( u
"posZ-texture-path"_s, pathResolver.
writePath( mCubeMapFacesPaths[u
"posZ"_s] ) );
92 element.setAttribute( u
"negX-texture-path"_s, pathResolver.
writePath( mCubeMapFacesPaths[u
"negX"_s] ) );
93 element.setAttribute( u
"negY-texture-path"_s, pathResolver.
writePath( mCubeMapFacesPaths[u
"negY"_s] ) );
94 element.setAttribute( u
"negZ-texture-path"_s, pathResolver.
writePath( mCubeMapFacesPaths[u
"negZ"_s] ) );
105 mCubeMapping = mapping;
SkyboxCubeMapping
Skybox texture cube mapping for distinct texture skyboxes.
@ NativeZUp
Textures exported for Z-up (+X Right, +Y Forward, +Z Up).
@ DistinctTextures
Cube map built from distinct textures.
Resolves relative paths into absolute paths and vice versa.
QString writePath(const QString &filename) const
Prepare a filename to save it to the project file.
QString readPath(const QString &filename) const
Turn filename read from the project file to an absolute path.
A container for the context for various read/write operations on objects.
const QgsPathResolver & pathResolver() const
Returns path resolver for conversion between relative and absolute paths.
void setCubeMapping(Qgis::SkyboxCubeMapping mapping)
Sets the cube face mapping scheme.
QgsSkyboxSettings()=default
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads settings from a DOM element.
QgsSkyboxSettings & operator=(QgsSkyboxSettings const &rhs)
void writeXml(QDomElement &element, const QgsReadWriteContext &context) const
Writes settings to a DOM element.
Qgis::SkyboxCubeMapping cubeMapping() const
Returns the cube face mapping scheme.
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
#define ENABLE_PANORAMIC_SKYBOX