Skip to content

remove lines geometry shader, make 3d lines instanced - #9

Open
ViperMiniQ wants to merge 3 commits into
masterfrom
remove-lines-geom-shader
Open

remove lines geometry shader, make 3d lines instanced#9
ViperMiniQ wants to merge 3 commits into
masterfrom
remove-lines-geom-shader

Conversation

@ViperMiniQ

Copy link
Copy Markdown
Owner

@wonder-sk

Screencast_20260824_102534.webm

- build line segments using pointA and pointB attributes
- pass additional pointC to line_joins shader for calculating the joins
- render joins as a separate instances (second pass)
@github-actions github-actions Bot added the 3D label Aug 24, 2026
Comment thread src/3d/materials/qgssimplelinematerial3dhandler.cpp Outdated
Comment thread src/3d/materials/qgssimplelinematerial3dhandler.cpp Outdated
Comment thread src/3d/symbols/qgslinematerial_p.cpp Outdated
Comment thread src/3d/symbols/qgslinematerial_p.h Outdated
Comment thread src/3d/shaders/line_joins.vert Outdated
out << " " << getVertexIndex( i );
out << "\n";
for ( int i = 0; i + 1 < mIndexes.size(); i += 2 )
out << "l " << getVertexIndex( i ) << " " << getVertexIndex( i + 1 ) << "\n";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this valid? we're not using LineStrip geometry type anymore...

Qt3DCore::QAttribute *pointBAttribute = findAttribute( geom, u"pointB"_s, Qt3DCore::QAttribute::VertexAttribute );
Qt3DCore::QAttribute *pointCAttribute = findAttribute( geom, u"pointC"_s, Qt3DCore::QAttribute::VertexAttribute );
if ( !pointAAttribute || !pointBAttribute || pointCAttribute )
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is looking at pointA+B+C - does it mean this is using attributes from line joins? if that's the case - a line with 3 segments has just 2 joins, so we will be missing one segment from linestring?

calloutRenderer->setPrimitiveRestartEnabled( true );
calloutRenderer->setRestartIndexValue( 0 );
calloutRenderer->setVertexCount( 6 );
calloutRenderer->setInstanceCount( lineData.pointsA.size() );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here, shall we have a method that creates line segment QEntity?

mLineGeometryRenderer->setPrimitiveRestartEnabled( true );
mLineGeometryRenderer->setRestartIndexValue( 0 );
mLineGeometryRenderer->setVertexCount( 6 );
mLineGeometryRenderer->setInstanceCount( 0 );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here

Comment thread src/3d/symbols/qgsline3dsymbol_p.cpp Outdated
renderer->setPrimitiveRestartEnabled( true );
renderer->setRestartIndexValue( 0 );
renderer->setVertexCount( 6 );
renderer->setInstanceCount( lineVertexData.pointsA.size() );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here - use utility method to create QEntity for segments?

- handle duplicates in cpp, rather than in shaders
- introduce enum to distinguish between segments and joins
- clip away the segments at joins, two segments should not overlap at joins and joins are also clipped to fill the space between the segments, but not to overlap them
- rename shader
- fix joins not showing from certain angles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants