Skip to content

Commit

Permalink
fix 3d mesh test
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk authored and PeterPetrik committed Jan 16, 2019
1 parent d695c4b commit d2834bb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/src/3d/testqgs3drendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ void TestQgs3DRendering::initTestCase()
QgsVectorLayer3DRenderer *renderer3d = new QgsVectorLayer3DRenderer( symbol3d );
mLayerBuildings->setRenderer3D( renderer3d );

mLayerMesh = new QgsMeshLayer( dataDir + "/mesh/quad_and_triangle.2dm", "mesh", "mdal" );
mLayerMesh = new QgsMeshLayer( dataDir + "/mesh/quad_flower.2dm", "mesh", "mdal" );
QVERIFY( mLayerMesh->isValid() );
mLayerMesh->setCrs( mLayerDtm->crs() ); // this testing mesh does not have any CRS defined originally
mProject->addMapLayer( mLayerMesh );

QgsPhongMaterialSettings meshMaterial;
meshMaterial.setAmbient( Qt::lightGray );
QgsMesh3DSymbol *symbolMesh3d = new QgsMesh3DSymbol;
symbolMesh3d->setMaterial( meshMaterial );
QgsMeshLayer3DRenderer *meshRenderer3d = new QgsMeshLayer3DRenderer( symbolMesh3d );
Expand Down Expand Up @@ -299,7 +299,7 @@ void TestQgs3DRendering::testMesh()
map->setOrigin( QgsVector3D( fullExtent.center().x(), fullExtent.center().y(), 0 ) );
map->setLayers( QList<QgsMapLayer *>() << mLayerMesh );
QgsPointLightSettings defaultLight;
defaultLight.setPosition( QgsVector3D( 1500, 2500, 0 ) );
defaultLight.setPosition( QgsVector3D( 0, 1000, 0 ) );
map->setPointLights( QList<QgsPointLightSettings>() << defaultLight );

QgsFlatTerrainGenerator *flatTerrain = new QgsFlatTerrainGenerator;
Expand All @@ -311,7 +311,7 @@ void TestQgs3DRendering::testMesh()
Qgs3DMapScene *scene = new Qgs3DMapScene( *map, &engine );
engine.setRootEntity( scene );

scene->cameraController()->setLookingAtPoint( QgsVector3D( 1500, 2500, 20 ), 500, 45, 0 );
scene->cameraController()->setLookingAtPoint( QgsVector3D( 0, 0, 0 ), 3000, 25, 45 );
QImage img = Qgs3DUtils::captureSceneImage( engine, scene );

QVERIFY( renderCheck( "mesh3d", img, 40 ) );
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions tests/testdata/mesh/quad_flower.2dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
MESH2D
ND 1 1000.000 2000.000 200.000
ND 2 2000.000 2000.000 200.000
ND 3 2500.000 2500.000 800.000
ND 4 2000.000 3000.000 200.000
ND 5 1000.000 3000.000 200.000
ND 6 500.000 2500.000 800.000
ND 7 1500.000 1500.000 800.000
ND 8 1500.000 3500.000 800.000
E4Q 1 1 2 4 5 1
E3T 2 2 3 4 1
E3T 3 1 5 6 1
E3T 4 2 1 7 1
E3T 5 5 4 8 1

0 comments on commit d2834bb

Please sign in to comment.