Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 12, 2025
1 parent eaca225 commit ef962c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
23 changes: 9 additions & 14 deletions src/3d/qgs3dutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,15 @@ QImage Qgs3DUtils::captureSceneImage( QgsAbstract3DEngine &engine, Qgs3DMapScene

waitForFrame( engine, scene );

auto saveImageFcn = [&evLoop, &resImage]( const QImage & img )
{
auto saveImageFcn = [&evLoop, &resImage]( const QImage &img ) {
resImage = img;
evLoop.quit();
};

const QMetaObject::Connection conn1 = QObject::connect( &engine, &QgsAbstract3DEngine::imageCaptured, saveImageFcn );
QMetaObject::Connection conn2;

auto requestImageFcn = [&engine, scene]
{
auto requestImageFcn = [&engine, scene] {
if ( scene->sceneState() == Qgs3DMapScene::Ready )
{
engine.renderSettings()->setRenderPolicy( Qt3DRender::QRenderSettings::RenderPolicy::OnDemand );
Expand Down Expand Up @@ -132,17 +130,15 @@ QImage Qgs3DUtils::captureSceneDepthBuffer( QgsAbstract3DEngine &engine, Qgs3DMa
// We need to change render policy to RenderPolicy::Always, since otherwise render capture node won't work
engine.renderSettings()->setRenderPolicy( Qt3DRender::QRenderSettings::RenderPolicy::Always );

auto requestImageFcn = [&engine, scene]
{
auto requestImageFcn = [&engine, scene] {
if ( scene->sceneState() == Qgs3DMapScene::Ready )
{
engine.renderSettings()->setRenderPolicy( Qt3DRender::QRenderSettings::RenderPolicy::OnDemand );
engine.requestDepthBufferCapture();
}
};

auto saveImageFcn = [&evLoop, &resImage]( const QImage & img )
{
auto saveImageFcn = [&evLoop, &resImage]( const QImage &img ) {
resImage = img;
evLoop.quit();
};
Expand Down Expand Up @@ -531,10 +527,10 @@ void Qgs3DUtils::extractPointPositions( const QgsFeature &f, const Qgs3DRenderCo
break;
}
positions.append( QVector3D(
static_cast<float>( pt.x() - chunkOrigin.x() ),
static_cast<float>( pt.y() - chunkOrigin.y() ),
h
) );
static_cast<float>( pt.x() - chunkOrigin.x() ),
static_cast<float>( pt.y() - chunkOrigin.y() ),
h
) );
QgsDebugMsgLevel( QStringLiteral( "%1 %2 %3" ).arg( positions.last().x() ).arg( positions.last().y() ).arg( positions.last().z() ), 2 );
}
}
Expand Down Expand Up @@ -976,8 +972,7 @@ void Qgs3DUtils::decomposeTransformMatrix( const QMatrix4x4 &matrix, QVector3D &
const float sx = QVector3D( md[0], md[1], md[2] ).length();
const float sy = QVector3D( md[4], md[5], md[6] ).length();
const float sz = QVector3D( md[8], md[9], md[10] ).length();
float rd[9] =
{
float rd[9] = {
md[0] / sx,
md[4] / sy,
md[8] / sz,
Expand Down
7 changes: 3 additions & 4 deletions tests/src/3d/testqgs3dcameracontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TestQgs3DCameraController : public QgsTest
void testRotationCenterRotationCameraRotationCenter();

private:
void waitForNearPlane( QgsOffscreen3DEngine &engine, Qgs3DMapScene *scene, float atLeast ); //#spellok
void waitForNearPlane( QgsOffscreen3DEngine &engine, Qgs3DMapScene *scene, float atLeast ); //#spellok

QgsRasterLayer *mLayerRgb = nullptr;
QgsVectorLayer *mLayerBuildings = nullptr;
Expand Down Expand Up @@ -1172,7 +1172,7 @@ void TestQgs3DCameraController::testRotationCenterRotationCameraRotationCenter()
mapSettings->setLayers( {} );
}

void TestQgs3DCameraController::waitForNearPlane( QgsOffscreen3DEngine &engine, Qgs3DMapScene *scene, float atLeast ) //#spellok
void TestQgs3DCameraController::waitForNearPlane( QgsOffscreen3DEngine &engine, Qgs3DMapScene *scene, float atLeast ) //#spellok
{
// XXX: Sometimes the near/far planes aren't calculated correctly, so they're
// left at the too-deep default. This causes the rest of the test to fail in
Expand All @@ -1184,8 +1184,7 @@ void TestQgs3DCameraController::waitForNearPlane( QgsOffscreen3DEngine &engine,

// this call is not used but ensures to synchronize the scene
Qgs3DUtils::captureSceneImage( engine, scene );
}
while ( scene->cameraController()->camera()->nearPlane() < atLeast ); //#spellok
} while ( scene->cameraController()->camera()->nearPlane() < atLeast ); //#spellok
}

QGSTEST_MAIN( TestQgs3DCameraController )
Expand Down

0 comments on commit ef962c0

Please sign in to comment.