Skip to content
Permalink
Browse files

fix 3d mesh test

  • Loading branch information
wonder-sk authored and PeterPetrik committed Jan 16, 2019
1 parent d695c4b commit d2834bbb44192ce71a9320dae5050a7fc3dc9a37
@@ -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 );
@@ -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;
@@ -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 ) );
Binary file not shown.
@@ -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.
You can’t perform that action at this time.