-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[3D] Fix reset view button #60413
base: master
Are you sure you want to change the base?
[3D] Fix reset view button #60413
Conversation
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
Tests failed for Qt 6One or more tests failed using the build from commit 7524667 virtual_pointcloud_3d_overview (testPointCloud3DOverview)virtual_pointcloud_3d_overviewTest failed at testPointCloud3DOverview at tests/src/3d/testqgspointcloud3drendering.cpp:603
The full test report (included comparison of rendered vs expected images) can be found here. Further documentation on the QGIS test infrastructure can be found in the Developer's Guide. |
Tests failed for Qt 5One or more tests failed using the build from commit 7524667 virtual_pointcloud_3d_overview (testPointCloud3DOverview)virtual_pointcloud_3d_overviewTest failed at testPointCloud3DOverview at tests/src/3d/testqgspointcloud3drendering.cpp:603
The full test report (included comparison of rendered vs expected images) can be found here. Further documentation on the QGIS test infrastructure can be found in the Developer's Guide. |
src/3d/qgscameracontroller.cpp
Outdated
mCamera->setFarPlane( distance * 2 ); | ||
// we force the updateCameraNearFarPlanes() in Qgs3DMapScene to properly set the planes | ||
// by making sure the cameraPose is never the same, which will emit cameraChanged() | ||
mCameraPose.setDistanceFromCenterPoint( camPose.distanceFromCenterPoint() + 1 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just emit cameraChanged() directly here, after calling setCameraPos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to call updateCameraFromPose()
directly, which updates QCamera
and emits the signal
7524667
to
fe4424e
Compare
|
b6d44f7
to
0995c8d
Compare
mCameraPose = camPose; | ||
updateCameraFromPose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not calling setCameraPose( camPose );
and add a call to updateCameraFromPose()
in it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setCameraPose( camPose )
already calls updateCameraFromPose()
, however the issue was that the setCameraPose( camPose )
would return early as camPose
was the same and the near & far plane would not be recalculated according to layers
zMin = virtualProvider->subIndexes()[0].zRange().lower(); | ||
zMax = virtualProvider->subIndexes()[0].zRange().upper(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why check against [0]
first? all sub indexes will be checked in the iteration below.
([0]
could also be out of range for some weird bad vpc file!)
zMax = virtualProvider->subIndexes()[0].zRange().upper(); | ||
for ( QgsPointCloudSubIndex subIndex : virtualProvider->subIndexes() ) | ||
{ | ||
const QgsDoubleRange newRange = subIndex.zRange(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While not very probable, subIndex.zRange()
may be also a default constructed infinite range if the vpc has 4 coordinate instead of 6 coordinate bboxes.
These infinite range subindexes should be skipped or the zMin/zMax doubles will overflow after the multiplication later on.
Description
This PR fixes reset view button giving wrong camera positions for virtual point clouds, and also fixes a bug where resetting view multiple times would set near & far planes incorrectly. Also it fixes initial position setting of camera after opening 3D view, which should be set to top down view of whole scene.