18 #include <Qt3DRender/QGeometryRenderer>
31 FlatTerrainChunkLoader::FlatTerrainChunkLoader( QgsTerrainEntity *terrain, QgsChunkNode *node )
32 : QgsTerrainTileLoader( terrain, node )
38 Qt3DCore::QEntity *FlatTerrainChunkLoader::createEntity( Qt3DCore::QEntity *parent )
40 QgsTerrainTileEntity *entity =
new QgsTerrainTileEntity( mNode->tileId() );
47 mTileGeometry =
new Qt3DExtras::QPlaneGeometry;
49 Qt3DRender::QGeometryRenderer *mesh =
new Qt3DRender::QGeometryRenderer;
50 mesh->setGeometry( mTileGeometry );
51 entity->addComponent( mesh );
60 Qt3DCore::QTransform *transform =
nullptr;
61 transform =
new Qt3DCore::QTransform();
62 entity->addComponent( transform );
67 double half = side / 2;
69 transform->setScale( side );
70 transform->setTranslation( QVector3D( bbox.
xMin + half, 0, bbox.
zMin + half ) );
72 entity->setEnabled(
false );
73 entity->setParent( parent );
83 return new FlatTerrainChunkLoader(
mTerrain, node );
90 cloned->mExtent = mExtent;
91 cloned->updateTilingScheme();
114 QDomElement elemExtent = elem.ownerDocument().createElement( QStringLiteral(
"extent" ) );
115 elemExtent.setAttribute( QStringLiteral(
"xmin" ), QString::number( r.
xMinimum() ) );
116 elemExtent.setAttribute( QStringLiteral(
"xmax" ), QString::number( r.
xMaximum() ) );
117 elemExtent.setAttribute( QStringLiteral(
"ymin" ), QString::number( r.
yMinimum() ) );
118 elemExtent.setAttribute( QStringLiteral(
"ymax" ), QString::number( r.
yMaximum() ) );
125 QDomElement elemExtent = elem.firstChildElement( QStringLiteral(
"extent" ) );
126 double xmin = elemExtent.attribute( QStringLiteral(
"xmin" ) ).toDouble();
127 double xmax = elemExtent.attribute( QStringLiteral(
"xmax" ) ).toDouble();
128 double ymin = elemExtent.attribute( QStringLiteral(
"ymin" ) ).toDouble();
129 double ymax = elemExtent.attribute( QStringLiteral(
"ymax" ) ).toDouble();
139 updateTilingScheme();
145 updateTilingScheme();
148 void QgsFlatTerrainGenerator::updateTilingScheme()