Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feature] directional lights support for QGIS 3D
- Loading branch information
1 parent
672d6ec
commit 9556bd2
Showing
13 changed files
with
734 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
python/3d/auto_generated/qgsdirectionallightsettings.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/3d/qgsdirectionallightsettings.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsDirectionalLightSettings | ||
{ | ||
%Docstring | ||
Definition of a directional light in a 3D map scene | ||
|
||
.. versionadded:: 3.16 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsdirectionallightsettings.h" | ||
%End | ||
public: | ||
QgsDirectionalLightSettings(); | ||
%Docstring | ||
Construct a directional light with default values | ||
%End | ||
|
||
QgsVector3D direction() const; | ||
%Docstring | ||
Returns the direction of the light in degrees | ||
%End | ||
void setDirection( const QgsVector3D &direction ); | ||
%Docstring | ||
Sets the direction of the light in degrees | ||
%End | ||
|
||
QColor color() const; | ||
%Docstring | ||
Returns color of the light | ||
%End | ||
void setColor( const QColor &color ); | ||
%Docstring | ||
Sets color of the light | ||
%End | ||
|
||
float intensity() const; | ||
%Docstring | ||
Returns intensity of the light | ||
%End | ||
void setIntensity( float intensity ); | ||
%Docstring | ||
Sets intensity of the light | ||
%End | ||
|
||
QDomElement writeXml( QDomDocument &doc ) const; | ||
%Docstring | ||
Writes configuration to a new DOM element and returns it | ||
%End | ||
void readXml( const QDomElement &elem ); | ||
%Docstring | ||
Reads configuration from a DOM element previously written using writeXml() | ||
%End | ||
|
||
bool operator==( const QgsDirectionalLightSettings &other ); | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/3d/qgsdirectionallightsettings.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*************************************************************************** | ||
qgsdirectionallightsettings.cpp | ||
-------------------------------------- | ||
Date : June 2020 | ||
Copyright : (C) 2020 by Belgacem Nedjima | ||
Email : gb underscore nedjima at esi dot dz | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsdirectionallightsettings.h" | ||
|
||
#include <QDomDocument> | ||
|
||
#include "qgssymbollayerutils.h" | ||
|
||
|
||
QDomElement QgsDirectionalLightSettings::writeXml( QDomDocument &doc ) const | ||
{ | ||
QDomElement elemLight = doc.createElement( QStringLiteral( "directional-light" ) ); | ||
elemLight.setAttribute( QStringLiteral( "x" ), mDirection.x() ); | ||
elemLight.setAttribute( QStringLiteral( "y" ), mDirection.y() ); | ||
elemLight.setAttribute( QStringLiteral( "z" ), mDirection.z() ); | ||
elemLight.setAttribute( QStringLiteral( "color" ), QgsSymbolLayerUtils::encodeColor( mColor ) ); | ||
elemLight.setAttribute( QStringLiteral( "intensity" ), mIntensity ); | ||
return elemLight; | ||
} | ||
|
||
void QgsDirectionalLightSettings::readXml( const QDomElement &elem ) | ||
{ | ||
mDirection.set( elem.attribute( QStringLiteral( "x" ) ).toFloat(), | ||
elem.attribute( QStringLiteral( "y" ) ).toFloat(), | ||
elem.attribute( QStringLiteral( "z" ) ).toFloat() ); | ||
mColor = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "color" ) ) ); | ||
mIntensity = elem.attribute( QStringLiteral( "intensity" ) ).toFloat(); | ||
} | ||
|
||
bool QgsDirectionalLightSettings::operator==( const QgsDirectionalLightSettings &other ) | ||
{ | ||
return mDirection == other.mDirection && mColor == other.mColor && mIntensity == other.mIntensity; | ||
} |
Oops, something went wrong.