QgsTerrainTileLoader::QgsTerrainTileLoader( QgsTerrainEntity *terrain, QgsChunkNode *node ) : QgsChunkLoader( node ) , mTerrain( terrain ) { const Qgs3DMapSettings &map = mTerrain->map3D(); int tx, ty, tz; #if 0 if ( map.terrainGenerator->type() == TerrainGenerator::QuantizedMesh ) { // TODO: sort out - should not be here QuantizedMeshTerrainGenerator *generator = static_cast<QuantizedMeshTerrainGenerator *>( map.terrainGenerator.get() ); generator->quadTreeTileToBaseTile( node->x, node->y, node->z, tx, ty, tz ); } else #endif { tx = node->tileX(); ty = node->tileY(); tz = node->tileZ(); } QgsRectangle extentTerrainCrs = map.terrainGenerator()->tilingScheme().tileToExtent( tx, ty, tz ); mExtentMapCrs = terrain->terrainToMapTransform().transformBoundingBox( extentTerrainCrs ); mTileDebugText = QString( "%1 | %2 | %3" ).arg( tx ).arg( ty ).arg( tz ); }
QuantizedMeshTerrainChunkLoader( Terrain *terrain, ChunkNode *node ) : TerrainChunkLoader( terrain, node ) , qmt( nullptr ) { const Map3D &map = mTerrain->map3D(); QuantizedMeshTerrainGenerator *generator = static_cast<QuantizedMeshTerrainGenerator *>( map.terrainGenerator.get() ); generator->quadTreeTileToBaseTile( node->x, node->y, node->z, tx, ty, tz ); tileRect = map.terrainGenerator->terrainTilingScheme.tileToExtent( tx, ty, tz ); // we need map settings here for access to mapToPixel mapSettings.setLayers( map.layers() ); mapSettings.setOutputSize( QSize( map.tileTextureSize, map.tileTextureSize ) ); mapSettings.setDestinationCrs( map.crs ); mapSettings.setExtent( mTerrain->terrainToMapTransform().transformBoundingBox( tileRect ) ); }