Skip to content
Permalink
Browse files

adress reviews

  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Nov 6, 2020
1 parent 6f542e7 commit a25f04641b6dbd934db7e3b9d79fb27f26e0bfe3
@@ -454,7 +454,7 @@ Sets the eye dome lighting distance value (contributes to the contrast of the im
Returns the eye dome lighting distance value (contributes to the contrast of the image)
%End

void setDebugShadowMapSettings( bool enabled, const QString &corner, double size );
void setDebugShadowMapSettings( bool enabled, Qt::Corner corner, double size );
%Docstring
Sets the debugging settings of the shadow map

@@ -466,7 +466,7 @@ Sets the debugging settings of the shadow map
%Docstring
Returns whether the shadow map debugging is enabled
%End
QString debugShadowMapCorner() const;
Qt::Corner debugShadowMapCorner() const;
%Docstring
Returns the corner where the shadow map preview is displayed
%End
@@ -475,7 +475,7 @@ Returns the corner where the shadow map preview is displayed
Returns the size of the shadow map preview
%End

void setDebugDepthMapSettings( bool enabled, const QString &corner, double size );
void setDebugDepthMapSettings( bool enabled, Qt::Corner corner, double size );
%Docstring
Sets the debugging settings of the depth map

@@ -487,7 +487,7 @@ Sets the debugging settings of the depth map
%Docstring
Returns whether the shadow map debugging is enabled
%End
QString debugDepthMapCorner() const;
Qt::Corner debugDepthMapCorner() const;
%Docstring
Returns the corner where the shadow map preview is displayed
%End
@@ -244,11 +244,11 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte

QDomElement elemDebugSettings = elem.firstChildElement( QStringLiteral( "debug-settings" ) );
mDebugShadowMapEnabled = elemDebugSettings.attribute( QStringLiteral( "shadowmap-enabled" ), QStringLiteral( "0" ) ).toInt();
mDebugShadowMapCorner = elemDebugSettings.attribute( QStringLiteral( "shadowmap-corner" ), QStringLiteral( "Top Left" ) );
mDebugShadowMapCorner = static_cast<Qt::Corner>( elemDebugSettings.attribute( QStringLiteral( "shadowmap-corner" ), "0" ).toInt() );
mDebugShadowMapSize = elemDebugSettings.attribute( QStringLiteral( "shadowmap-size" ), QStringLiteral( "0.2" ) ).toDouble();

mDebugDepthMapEnabled = elemDebugSettings.attribute( QStringLiteral( "depthmap-enabled" ), QStringLiteral( "0" ) ).toInt();
mDebugDepthMapCorner = elemDebugSettings.attribute( QStringLiteral( "depthmap-corner" ), QStringLiteral( "Top Right" ) );
mDebugDepthMapCorner = static_cast<Qt::Corner>( elemDebugSettings.attribute( QStringLiteral( "depthmap-corner" ), QStringLiteral( "1" ) ).toInt() );
mDebugDepthMapSize = elemDebugSettings.attribute( QStringLiteral( "depthmap-size" ), QStringLiteral( "0.2" ) ).toDouble();

QDomElement elemDebug = elem.firstChildElement( QStringLiteral( "debug" ) );
@@ -724,15 +724,15 @@ void Qgs3DMapSettings::setShadowSettings( const QgsShadowSettings &shadowSetting
emit shadowSettingsChanged();
}

void Qgs3DMapSettings::setDebugShadowMapSettings( bool enabled, const QString &corner, double size )
void Qgs3DMapSettings::setDebugShadowMapSettings( bool enabled, Qt::Corner corner, double size )
{
mDebugShadowMapEnabled = enabled;
mDebugShadowMapCorner = corner;
mDebugShadowMapSize = size;
emit debugShadowMapSettingsChanged();
}

void Qgs3DMapSettings::setDebugDepthMapSettings( bool enabled, const QString &corner, double size )
void Qgs3DMapSettings::setDebugDepthMapSettings( bool enabled, Qt::Corner corner, double size )
{
mDebugDepthMapEnabled = enabled;
mDebugDepthMapCorner = corner;
@@ -394,11 +394,11 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject, public QgsTemporalRangeObjec
* \see debugShadowMapEnabled() debugShadowMapCorner() debugShadowMapSize()
* \since QGIS 3.18
*/
void setDebugShadowMapSettings( bool enabled, const QString &corner, double size );
void setDebugShadowMapSettings( bool enabled, Qt::Corner corner, double size );
//! Returns whether the shadow map debugging is enabled
bool debugShadowMapEnabled() const { return mDebugShadowMapEnabled; }
//! Returns the corner where the shadow map preview is displayed
QString debugShadowMapCorner() const { return mDebugShadowMapCorner; }
Qt::Corner debugShadowMapCorner() const { return mDebugShadowMapCorner; }
//! Returns the size of the shadow map preview
double debugShadowMapSize() const { return mDebugShadowMapSize; }

@@ -407,11 +407,11 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject, public QgsTemporalRangeObjec
* \see debugDepthMapEnabled() debugDepthMapCorner() debugDepthMapSize()
* \since QGIS 3.18
*/
void setDebugDepthMapSettings( bool enabled, const QString &corner, double size );
void setDebugDepthMapSettings( bool enabled, Qt::Corner corner, double size );
//! Returns whether the shadow map debugging is enabled
bool debugDepthMapEnabled() const { return mDebugDepthMapEnabled; }
//! Returns the corner where the shadow map preview is displayed
QString debugDepthMapCorner() const { return mDebugDepthMapCorner; }
Qt::Corner debugDepthMapCorner() const { return mDebugDepthMapCorner; }
//! Returns the size of the shadow map preview
double debugDepthMapSize() const { return mDebugDepthMapSize; }

@@ -684,11 +684,11 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject, public QgsTemporalRangeObjec
int mEyeDomeLightingDistance = 1;

bool mDebugShadowMapEnabled = false;
QString mDebugShadowMapCorner = "Top Left";
Qt::Corner mDebugShadowMapCorner = Qt::Corner::TopLeftCorner;
double mDebugShadowMapSize = 0.2;

bool mDebugDepthMapEnabled = false;
QString mDebugDepthMapCorner = "Top Right";
Qt::Corner mDebugDepthMapCorner = Qt::Corner::TopRightCorner;
double mDebugDepthMapSize = 0.2;
};

@@ -196,7 +196,6 @@ QgsShadowRenderingFrameGraph::QgsShadowRenderingFrameGraph( QWindow *window, Qt3
mDebugShadowMapPreviewQuad = this->addTexturePreviewOverlay( mShadowMapTexture, QPointF( -0.8f, -0.8f ), QSizeF( 0.2f, 0.2f ) );
mDebugDepthMapPreviewQuad->setEnabled( false );
mDebugShadowMapPreviewQuad->setEnabled( false );
// this->addTexturePreviewOverlay( mForwardDepthTexture, QPointF( 0.8f, 0.8f ), QSizeF( 0.2f, 0.2f ) );
}

QgsPreviewQuad *QgsShadowRenderingFrameGraph::addTexturePreviewOverlay( Qt3DRender::QTexture2D *texture, const QPointF &centerNDC, const QSizeF &size, QVector<Qt3DRender::QParameter *> additionalShaderParameters )
@@ -359,34 +358,49 @@ void QgsShadowRenderingFrameGraph::setupEyeDomeLighting( bool enabled, double st
mPostprocessingEntity->setEyeDomeLightingDistance( distance );
}

void QgsShadowRenderingFrameGraph::setupShadowMapDebugging( bool enabled, const QString &corner, double size )
void QgsShadowRenderingFrameGraph::setupShadowMapDebugging( bool enabled, Qt::Corner corner, double size )
{
mDebugShadowMapPreviewQuad->setEnabled( enabled );
if ( enabled )
{
if ( corner == QStringLiteral( "Top Right" ) )
mDebugShadowMapPreviewQuad->setViewPort( QPointF( 1.0f - size, 1.0f - size ), QSizeF( size, size ) );
else if ( corner == QStringLiteral( "Bottom Right" ) )
mDebugShadowMapPreviewQuad->setViewPort( QPointF( 1.0f - size, -1.0f + size ), QSizeF( size, size ) );
else if ( corner == QStringLiteral( "Top Left" ) )
mDebugShadowMapPreviewQuad->setViewPort( QPointF( -1.0f + size, 1.0f - size ), QSizeF( size, size ) );
else if ( corner == QStringLiteral( "Bottom Left" ) )
mDebugShadowMapPreviewQuad->setViewPort( QPointF( -1.0f + size, -1.0f + size ), QSizeF( size, size ) );
switch ( corner )
{
case Qt::Corner::TopRightCorner:
mDebugShadowMapPreviewQuad->setViewPort( QPointF( 1.0f - size, 1.0f - size ), QSizeF( size, size ) );
break;
case Qt::Corner::TopLeftCorner:
mDebugShadowMapPreviewQuad->setViewPort( QPointF( -1.0f + size, 1.0f - size ), QSizeF( size, size ) );
break;
case Qt::Corner::BottomRightCorner:
mDebugShadowMapPreviewQuad->setViewPort( QPointF( 1.0f - size, -1.0f + size ), QSizeF( size, size ) );
break;
case Qt::Corner::BottomLeftCorner:
mDebugShadowMapPreviewQuad->setViewPort( QPointF( -1.0f + size, -1.0f + size ), QSizeF( size, size ) );
break;
}
}
}

void QgsShadowRenderingFrameGraph::setupDepthMapDebugging( bool enabled, const QString &corner, double size )
void QgsShadowRenderingFrameGraph::setupDepthMapDebugging( bool enabled, Qt::Corner corner, double size )
{
mDebugDepthMapPreviewQuad->setEnabled( enabled );

if ( enabled )
{
if ( corner == QStringLiteral( "Top Right" ) )
mDebugDepthMapPreviewQuad->setViewPort( QPointF( 1.0f - size, 1.0f - size ), QSizeF( size, size ) );
else if ( corner == QStringLiteral( "Bottom Right" ) )
mDebugDepthMapPreviewQuad->setViewPort( QPointF( 1.0f - size, -1.0f + size ), QSizeF( size, size ) );
else if ( corner == QStringLiteral( "Top Left" ) )
mDebugDepthMapPreviewQuad->setViewPort( QPointF( -1.0f + size, 1.0f - size ), QSizeF( size, size ) );
else if ( corner == QStringLiteral( "Bottom Left" ) )
mDebugDepthMapPreviewQuad->setViewPort( QPointF( -1.0f + size, -1.0f + size ), QSizeF( size, size ) );
switch ( corner )
{
case Qt::Corner::TopRightCorner:
mDebugDepthMapPreviewQuad->setViewPort( QPointF( 1.0f - size, 1.0f - size ), QSizeF( size, size ) );
break;
case Qt::Corner::TopLeftCorner:
mDebugDepthMapPreviewQuad->setViewPort( QPointF( -1.0f + size, 1.0f - size ), QSizeF( size, size ) );
break;
case Qt::Corner::BottomRightCorner:
mDebugDepthMapPreviewQuad->setViewPort( QPointF( 1.0f - size, -1.0f + size ), QSizeF( size, size ) );
break;
case Qt::Corner::BottomLeftCorner:
mDebugDepthMapPreviewQuad->setViewPort( QPointF( -1.0f + size, -1.0f + size ), QSizeF( size, size ) );
break;
}
}
}
@@ -119,9 +119,9 @@ class QgsShadowRenderingFrameGraph : public Qt3DCore::QEntity
//! Sets eye dome lighting shading related settings
void setupEyeDomeLighting( bool enabled, double strength, int distance );
//! Sets the shadow map debugging view port
void setupShadowMapDebugging( bool enabled, const QString &corner, double size );
void setupShadowMapDebugging( bool enabled, Qt::Corner corner, double size );
//! Sets the depth map debugging view port
void setupDepthMapDebugging( bool enabled, const QString &corner, double size );
void setupDepthMapDebugging( bool enabled, Qt::Corner corner, double size );

private:
Qt3DRender::QRenderSurfaceSelector *mRenderSurfaceSelector = nullptr;
@@ -166,25 +166,23 @@ Qgs3DMapConfigWidget::Qgs3DMapConfigWidget( Qgs3DMapSettings *map, QgsMapCanvas
edlStrengthSpinBox->setValue( map->eyeDomeLightingStrength() );
edlDistanceSpinBox->setValue( map->eyeDomeLightingDistance() );

mDebugShadowMapCornerComboBox->addItem( QStringLiteral( "Top Right" ) );
mDebugShadowMapCornerComboBox->addItem( QStringLiteral( "Top Left" ) );
mDebugShadowMapCornerComboBox->addItem( QStringLiteral( "Bottom Left" ) );
mDebugShadowMapCornerComboBox->addItem( QStringLiteral( "Bottom Right" ) );
mDebugShadowMapCornerComboBox->addItem( tr( "Top Left" ) );
mDebugShadowMapCornerComboBox->addItem( tr( "Top Right" ) );
mDebugShadowMapCornerComboBox->addItem( tr( "Bottom Left" ) );
mDebugShadowMapCornerComboBox->addItem( tr( "Bottom Right" ) );

mDebugDepthMapCornerComboBox->addItem( QStringLiteral( "Top Right" ) );
mDebugDepthMapCornerComboBox->addItem( QStringLiteral( "Top Left" ) );
mDebugDepthMapCornerComboBox->addItem( QStringLiteral( "Bottom Left" ) );
mDebugDepthMapCornerComboBox->addItem( QStringLiteral( "Bottom Right" ) );

// mDebugShadowMapCornerComboBox->setCurrentText( QStringLiteral( "Top Left" ) );
// mDebugDepthMapCornerComboBox->setCurrentText( QStringLiteral( "Top Right" ) );
mDebugDepthMapCornerComboBox->addItem( tr( "Top Left" ) );
mDebugDepthMapCornerComboBox->addItem( tr( "Top Right" ) );
mDebugDepthMapCornerComboBox->addItem( tr( "Bottom Left" ) );
mDebugDepthMapCornerComboBox->addItem( tr( "Bottom Right" ) );

mDebugShadowMapGroupBox->setChecked( map->debugShadowMapEnabled() );
mDebugShadowMapCornerComboBox->setCurrentText( map->debugShadowMapCorner() );

mDebugShadowMapCornerComboBox->setCurrentIndex( static_cast<int>( map->debugShadowMapCorner() ) );
mDebugShadowMapSizeSpinBox->setValue( map->debugShadowMapSize() );

mDebugDepthMapGroupBox->setChecked( map->debugDepthMapEnabled() );
mDebugDepthMapCornerComboBox->setCurrentText( map->debugDepthMapCorner() );
mDebugDepthMapCornerComboBox->setCurrentIndex( static_cast<int>( map->debugDepthMapCorner() ) );
mDebugDepthMapSizeSpinBox->setValue( map->debugDepthMapSize() );
}

@@ -316,8 +314,8 @@ void Qgs3DMapConfigWidget::apply()
mMap->setEyeDomeLightingStrength( edlStrengthSpinBox->value() );
mMap->setEyeDomeLightingDistance( edlDistanceSpinBox->value() );

mMap->setDebugDepthMapSettings( mDebugDepthMapGroupBox->isChecked(), mDebugDepthMapCornerComboBox->currentText(), mDebugDepthMapSizeSpinBox->value() );
mMap->setDebugShadowMapSettings( mDebugShadowMapGroupBox->isChecked(), mDebugShadowMapCornerComboBox->currentText(), mDebugShadowMapSizeSpinBox->value() );
mMap->setDebugDepthMapSettings( mDebugDepthMapGroupBox->isChecked(), static_cast<Qt::Corner>( mDebugDepthMapCornerComboBox->currentIndex() ), mDebugDepthMapSizeSpinBox->value() );
mMap->setDebugShadowMapSettings( mDebugShadowMapGroupBox->isChecked(), static_cast<Qt::Corner>( mDebugShadowMapCornerComboBox->currentIndex() ), mDebugShadowMapSizeSpinBox->value() );
}

void Qgs3DMapConfigWidget::onTerrainTypeChanged()

0 comments on commit a25f046

Please sign in to comment.
You can’t perform that action at this time.