Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to shift origin of 3D map scenes #59468

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

wonder-sk
Copy link
Member

@wonder-sk wonder-sk commented Nov 17, 2024

This introduces a new class QgsGeoTransform (derived from QTransform) that keeps chunk's translation vector as a QgsVector3D (i.e. in double coordinates) and if there is a shift of the origin, 3D map scene and chunk entities react to it by adjusting the underlying QTransform.

@wonder-sk wonder-sk added the 3D Relates to QGIS' 3D engine or rendering label Nov 17, 2024
@github-actions github-actions bot added this to the 3.42.0 milestone Nov 17, 2024
Copy link

github-actions bot commented Nov 17, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 61ea829)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 61ea829)

@wonder-sk wonder-sk force-pushed the 3d-scene-origin-shifting branch 2 times, most recently from 50ac9a6 to 4793118 Compare November 18, 2024 10:56
@qgis qgis deleted a comment from github-actions bot Nov 18, 2024
@qgis qgis deleted a comment from github-actions bot Nov 18, 2024
@nyalldawson
Copy link
Collaborator

@wonder-sk this is marked as a draft -- is it ready for a review as is?

@wonder-sk wonder-sk marked this pull request as ready for review November 18, 2024 21:41
@wonder-sk
Copy link
Member Author

@nyalldawson yeah I think it is good for review now - originally I wanted to include automatic origin shifts in the PR, but it has already enough content on its own, so I would do the automatic shifts as a followup...

This introduces a new class QgsGeoTransform (derived from QTransform)
that keeps chunk's translation vector as a QgsVector3D (i.e. in double
coordinates) and if there is a shift of the origin, 3D map scene and
chunk entities react to it by adjusting the underlying QTransform.
@@ -513,7 +513,11 @@ void Qgs3DMapSettings::setOrigin( const QgsVector3D &origin )
{
QGIS_PROTECT_QOBJECT_THREAD_ACCESS

if ( origin == mOrigin )
Copy link
Collaborator

@nyalldawson nyalldawson Nov 25, 2024

Choose a reason for hiding this comment

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

QgsVector3D== operator uses double == comparison. I think we should change that to use qgsDoubleNear so that this early-exit path has greater chance of being hit.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually I quite like the idea of having exact comparison here - and we should rather try not to request any small origin shifts - e.g. skip origin rebase as long as the magnitude is less than 1000 or so - to avoid recalculation of transforms.

src/3d/qgscameracontroller.h Outdated Show resolved Hide resolved
@wonder-sk wonder-sk merged commit 6defbc6 into qgis:master Nov 25, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3D Relates to QGIS' 3D engine or rendering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants