Skip to content

Commit

Permalink
fix rendering when no preview painter is allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
uclaros authored and wonder-sk committed Feb 5, 2024
1 parent 4ecc52a commit 8dc3558
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/core/pointcloud/qgspointcloudattributebyramprenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,14 @@ void QgsPointCloudAttributeByRampRenderer::renderBlock( const QgsPointCloudBlock
mColorRampShader.shade( attributeValue, &red, &green, &blue, &alpha );

if ( renderAsTriangles() )
{
addPointToTriangulation( x, y, z, QColor( red, green, blue, alpha ), context );

// We don't want to render any points if we're rendering triangles and there is no preview painter
if ( !context.renderContext().previewRenderPainter() )
continue;
}

drawPoint( x, y, QColor( red, green, blue, alpha ), context );
if ( renderElevation )
drawPointToElevationMap( x, y, z, context );
Expand Down
6 changes: 6 additions & 0 deletions src/core/pointcloud/qgspointcloudclassifiedrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,14 @@ void QgsPointCloudClassifiedRenderer::renderBlock( const QgsPointCloudBlock *blo
}

if ( renderAsTriangles() )
{
addPointToTriangulation( x, y, z, color, context );

// We don't want to render any points if we're rendering triangles and there is no preview painter
if ( !context.renderContext().previewRenderPainter() )
continue;
}

const double size = pointSizes.value( attributeValue );
drawPoint( x, y, color, size, context );
if ( renderElevation )
Expand Down
5 changes: 4 additions & 1 deletion src/core/pointcloud/qgspointcloudlayerrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,10 @@ Qgis::MapLayerRendererFlags QgsPointCloudLayerRenderer::flags() const
// when rendering as triangles we still want to show temporary incremental renders as points until
// the final triangulated surface is ready, which may be slow
// So we request here a preview render image for the temporary incremental updates:
return Qgis::MapLayerRendererFlag::RenderPartialOutputs | Qgis::MapLayerRendererFlag::RenderPartialOutputOverPreviousCachedImage;
if ( mRenderer->renderAsTriangles() )
return Qgis::MapLayerRendererFlag::RenderPartialOutputs | Qgis::MapLayerRendererFlag::RenderPartialOutputOverPreviousCachedImage;

return Qgis::MapLayerRendererFlags();
}

bool QgsPointCloudLayerRenderer::forceRasterRender() const
Expand Down
6 changes: 6 additions & 0 deletions src/core/pointcloud/qgspointcloudrgbrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,14 @@ void QgsPointCloudRgbRenderer::renderBlock( const QgsPointCloudBlock *block, Qgs
blue = std::max( 0, std::min( 255, blue ) );

if ( renderAsTriangles() )
{
addPointToTriangulation( x, y, z, QColor( red, green, blue ), context );

// We don't want to render any points if we're rendering triangles and there is no preview painter
if ( !context.renderContext().previewRenderPainter() )
continue;
}

drawPoint( x, y, QColor( red, green, blue ), context );
if ( renderElevation )
drawPointToElevationMap( x, y, z, context );
Expand Down

0 comments on commit 8dc3558

Please sign in to comment.