Skip to content

Commit

Permalink
Add possibility to shift origin of 3D map scenes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wonder-sk committed Nov 18, 2024
1 parent cbcfe86 commit 50ac9a6
Show file tree
Hide file tree
Showing 26 changed files with 225 additions and 62 deletions.
2 changes: 1 addition & 1 deletion python/3d/auto_additions/qgs3dmapsettings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The following has been generated automatically from src/3d/qgs3dmapsettings.h
try:
Qgs3DMapSettings.__attribute_docs__ = {'settingsChanged': 'Emitted when one of the configuration settings has changed\n\n.. versionadded:: 3.24\n', 'backgroundColorChanged': 'Emitted when the background color has changed\n', 'selectionColorChanged': 'Emitted when the selection color has changed\n', 'layersChanged': 'Emitted when the list of map layers for 3d rendering has changed.\n\n.. seealso:: :py:func:`setLayers`\n\n.. seealso:: :py:func:`layers`\n', 'terrainGeneratorChanged': 'Emitted when the terrain generator has changed\n', 'terrainVerticalScaleChanged': 'Emitted when the vertical scale of the terrain has changed\n', 'mapTileResolutionChanged': 'Emitted when the map tile resoulution has changed\n', 'maxTerrainScreenErrorChanged': 'Emitted when the maximum terrain screen error has changed\n', 'maxTerrainGroundErrorChanged': 'Emitted when the maximum terrain ground error has changed\n', 'terrainElevationOffsetChanged': 'Emitted when the terrain elevation offset is changed\n\n.. versionadded:: 3.16\n', 'terrainShadingChanged': 'Emitted when terrain shading enabled flag or terrain shading material has changed\n\n.. versionadded:: 3.6\n', 'terrainMapThemeChanged': "Emitted when terrain's map theme has changed\n\n.. versionadded:: 3.6\n", 'renderersChanged': "Emitted when the list of map's extra renderers have been modified\n\n.. versionadded:: 3.10\n", 'showTerrainBoundingBoxesChanged': "Emitted when the flag whether terrain's bounding boxes are shown has changed\n", 'showTerrainTilesInfoChanged': "Emitted when the flag whether terrain's tile info is shown has changed\n", 'showCameraViewCenterChanged': "Emitted when the flag whether camera's view center is shown has changed\n\n.. versionadded:: 3.4\n", 'showCameraRotationCenterChanged': "Emitted when the flag whether camera's rotation center is shown has changed\n\n.. versionadded:: 3.24\n", 'showLightSourceOriginsChanged': 'Emitted when the flag whether light source origins are shown has changed.\n\n.. versionadded:: 3.15\n', 'showLabelsChanged': 'Emitted when the flag whether labels are displayed on terrain tiles has changed\n', 'eyeDomeLightingEnabledChanged': 'Emitted when the flag whether eye dome lighting is used has changed\n\n.. versionadded:: 3.18\n', 'eyeDomeLightingStrengthChanged': 'Emitted when the eye dome lighting strength has changed\n\n.. versionadded:: 3.18\n', 'eyeDomeLightingDistanceChanged': 'Emitted when the eye dome lighting distance has changed\n\n.. versionadded:: 3.18\n', 'debugShadowMapSettingsChanged': 'Emitted when shadow map debugging has changed\n\n.. versionadded:: 3.18\n', 'debugDepthMapSettingsChanged': 'Emitted when depth map debugging has changed\n\n.. versionadded:: 3.18\n', 'pointLightsChanged': 'Emitted when the list of point lights changes\n\n.. versionadded:: 3.6\n', 'lightSourcesChanged': 'Emitted when any of the light source settings in the map changes.\n\n.. versionadded:: 3.26\n', 'directionalLightsChanged': 'Emitted when the list of directional lights changes\n\n.. versionadded:: 3.16\n', 'fieldOfViewChanged': 'Emitted when the camera lens field of view changes\n\n.. versionadded:: 3.8\n', 'projectionTypeChanged': 'Emitted when the camera lens projection type changes\n\n.. versionadded:: 3.18\n', 'cameraNavigationModeChanged': 'Emitted when the camera navigation mode was changed\n\n.. versionadded:: 3.18\n', 'cameraMovementSpeedChanged': 'Emitted when the camera movement speed was changed\n\n.. versionadded:: 3.18\n', 'skyboxSettingsChanged': 'Emitted when skybox settings are changed\n\n.. versionadded:: 3.16\n', 'shadowSettingsChanged': 'Emitted when shadow rendering settings are changed\n\n.. versionadded:: 3.16\n', 'ambientOcclusionSettingsChanged': 'Emitted when ambient occlusion rendering settings are changed\n\n.. versionadded:: 3.28\n', 'fpsCounterEnabledChanged': 'Emitted when the FPS counter is enabled or disabled\n\n.. versionadded:: 3.18\n', 'viewFrustumVisualizationEnabledChanged': "Emitted when the camera's view frustum visualization on the main 2D map canvas is enabled or disabled\n\n.. versionadded:: 3.26\n", 'axisSettingsChanged': 'Emitted when 3d axis rendering settings are changed\n\n.. versionadded:: 3.26\n', 'debugOverlayEnabledChanged': 'Emitted when the debug overaly is enabled or disabled\n\n.. versionadded:: 3.26\n', 'extentChanged': "Emitted when the 3d view's 2d extent has changed\n\n.. seealso:: :py:func:`setExtent`\n\n.. versionadded:: 3.30\n", 'showExtentIn2DViewChanged': "Emitted when the parameter to display 3d view's extent in the 2D canvas has changed\n\n.. seealso:: :py:func:`setShowExtentIn2DView`\n\n.. versionadded:: 3.32\n"}
Qgs3DMapSettings.__attribute_docs__ = {'settingsChanged': 'Emitted when one of the configuration settings has changed\n\n.. versionadded:: 3.24\n', 'backgroundColorChanged': 'Emitted when the background color has changed\n', 'selectionColorChanged': 'Emitted when the selection color has changed\n', 'layersChanged': 'Emitted when the list of map layers for 3d rendering has changed.\n\n.. seealso:: :py:func:`setLayers`\n\n.. seealso:: :py:func:`layers`\n', 'terrainGeneratorChanged': 'Emitted when the terrain generator has changed\n', 'terrainVerticalScaleChanged': 'Emitted when the vertical scale of the terrain has changed\n', 'mapTileResolutionChanged': 'Emitted when the map tile resoulution has changed\n', 'maxTerrainScreenErrorChanged': 'Emitted when the maximum terrain screen error has changed\n', 'maxTerrainGroundErrorChanged': 'Emitted when the maximum terrain ground error has changed\n', 'terrainElevationOffsetChanged': 'Emitted when the terrain elevation offset is changed\n\n.. versionadded:: 3.16\n', 'terrainShadingChanged': 'Emitted when terrain shading enabled flag or terrain shading material has changed\n\n.. versionadded:: 3.6\n', 'terrainMapThemeChanged': "Emitted when terrain's map theme has changed\n\n.. versionadded:: 3.6\n", 'renderersChanged': "Emitted when the list of map's extra renderers have been modified\n\n.. versionadded:: 3.10\n", 'showTerrainBoundingBoxesChanged': "Emitted when the flag whether terrain's bounding boxes are shown has changed\n", 'showTerrainTilesInfoChanged': "Emitted when the flag whether terrain's tile info is shown has changed\n", 'showCameraViewCenterChanged': "Emitted when the flag whether camera's view center is shown has changed\n\n.. versionadded:: 3.4\n", 'showCameraRotationCenterChanged': "Emitted when the flag whether camera's rotation center is shown has changed\n\n.. versionadded:: 3.24\n", 'showLightSourceOriginsChanged': 'Emitted when the flag whether light source origins are shown has changed.\n\n.. versionadded:: 3.15\n', 'showLabelsChanged': 'Emitted when the flag whether labels are displayed on terrain tiles has changed\n', 'eyeDomeLightingEnabledChanged': 'Emitted when the flag whether eye dome lighting is used has changed\n\n.. versionadded:: 3.18\n', 'eyeDomeLightingStrengthChanged': 'Emitted when the eye dome lighting strength has changed\n\n.. versionadded:: 3.18\n', 'eyeDomeLightingDistanceChanged': 'Emitted when the eye dome lighting distance has changed\n\n.. versionadded:: 3.18\n', 'debugShadowMapSettingsChanged': 'Emitted when shadow map debugging has changed\n\n.. versionadded:: 3.18\n', 'debugDepthMapSettingsChanged': 'Emitted when depth map debugging has changed\n\n.. versionadded:: 3.18\n', 'pointLightsChanged': 'Emitted when the list of point lights changes\n\n.. versionadded:: 3.6\n', 'lightSourcesChanged': 'Emitted when any of the light source settings in the map changes.\n\n.. versionadded:: 3.26\n', 'directionalLightsChanged': 'Emitted when the list of directional lights changes\n\n.. versionadded:: 3.16\n', 'fieldOfViewChanged': 'Emitted when the camera lens field of view changes\n\n.. versionadded:: 3.8\n', 'projectionTypeChanged': 'Emitted when the camera lens projection type changes\n\n.. versionadded:: 3.18\n', 'cameraNavigationModeChanged': 'Emitted when the camera navigation mode was changed\n\n.. versionadded:: 3.18\n', 'cameraMovementSpeedChanged': 'Emitted when the camera movement speed was changed\n\n.. versionadded:: 3.18\n', 'skyboxSettingsChanged': 'Emitted when skybox settings are changed\n\n.. versionadded:: 3.16\n', 'shadowSettingsChanged': 'Emitted when shadow rendering settings are changed\n\n.. versionadded:: 3.16\n', 'ambientOcclusionSettingsChanged': 'Emitted when ambient occlusion rendering settings are changed\n\n.. versionadded:: 3.28\n', 'fpsCounterEnabledChanged': 'Emitted when the FPS counter is enabled or disabled\n\n.. versionadded:: 3.18\n', 'viewFrustumVisualizationEnabledChanged': "Emitted when the camera's view frustum visualization on the main 2D map canvas is enabled or disabled\n\n.. versionadded:: 3.26\n", 'axisSettingsChanged': 'Emitted when 3d axis rendering settings are changed\n\n.. versionadded:: 3.26\n', 'debugOverlayEnabledChanged': 'Emitted when the debug overaly is enabled or disabled\n\n.. versionadded:: 3.26\n', 'extentChanged': "Emitted when the 3d view's 2d extent has changed\n\n.. seealso:: :py:func:`setExtent`\n\n.. versionadded:: 3.30\n", 'showExtentIn2DViewChanged': "Emitted when the parameter to display 3d view's extent in the 2D canvas has changed\n\n.. seealso:: :py:func:`setShowExtentIn2DView`\n\n.. versionadded:: 3.32\n", 'originChanged': "Emitted when the world's origin point has been shifted\n\n.. seealso:: :py:func:`setOrigin`\n\n.. versionadded:: 3.42\n"}
Qgs3DMapSettings.__signal_arguments__ = {'terrainElevationOffsetChanged': ['newElevation: float'], 'fpsCounterEnabledChanged': ['fpsCounterEnabled: bool'], 'debugOverlayEnabledChanged': ['debugOverlayEnabled: bool']}
except NameError:
pass
9 changes: 9 additions & 0 deletions python/3d/auto_generated/qgs3dmapsettings.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,15 @@ Emitted when the parameter to display 3d view's extent in the 2D canvas has chan
.. seealso:: :py:func:`setShowExtentIn2DView`

.. versionadded:: 3.32
%End

void originChanged();
%Docstring
Emitted when the world's origin point has been shifted

.. seealso:: :py:func:`setOrigin`

.. versionadded:: 3.42
%End

private:
Expand Down
7 changes: 7 additions & 0 deletions python/3d/auto_generated/qgscameracontroller.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ Rotates the camera on itself.
Returns ``True`` if the camera controller will handle the specified key ``event``,
preventing it from being instead handled by parents of the 3D window before
the controller ever receives it.
%End

void setOrigin( const QgsVector3D &origin );
%Docstring
Reacts to the shift of origin of the scene, updating camera pose and
any other member variables so that the origin stays at the same position
relative to other entities.
%End

public slots:
Expand Down
2 changes: 1 addition & 1 deletion python/PyQt6/3d/auto_additions/qgs3dmapsettings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The following has been generated automatically from src/3d/qgs3dmapsettings.h
try:
Qgs3DMapSettings.__attribute_docs__ = {'settingsChanged': 'Emitted when one of the configuration settings has changed\n\n.. versionadded:: 3.24\n', 'backgroundColorChanged': 'Emitted when the background color has changed\n', 'selectionColorChanged': 'Emitted when the selection color has changed\n', 'layersChanged': 'Emitted when the list of map layers for 3d rendering has changed.\n\n.. seealso:: :py:func:`setLayers`\n\n.. seealso:: :py:func:`layers`\n', 'terrainGeneratorChanged': 'Emitted when the terrain generator has changed\n', 'terrainVerticalScaleChanged': 'Emitted when the vertical scale of the terrain has changed\n', 'mapTileResolutionChanged': 'Emitted when the map tile resoulution has changed\n', 'maxTerrainScreenErrorChanged': 'Emitted when the maximum terrain screen error has changed\n', 'maxTerrainGroundErrorChanged': 'Emitted when the maximum terrain ground error has changed\n', 'terrainElevationOffsetChanged': 'Emitted when the terrain elevation offset is changed\n\n.. versionadded:: 3.16\n', 'terrainShadingChanged': 'Emitted when terrain shading enabled flag or terrain shading material has changed\n\n.. versionadded:: 3.6\n', 'terrainMapThemeChanged': "Emitted when terrain's map theme has changed\n\n.. versionadded:: 3.6\n", 'renderersChanged': "Emitted when the list of map's extra renderers have been modified\n\n.. versionadded:: 3.10\n", 'showTerrainBoundingBoxesChanged': "Emitted when the flag whether terrain's bounding boxes are shown has changed\n", 'showTerrainTilesInfoChanged': "Emitted when the flag whether terrain's tile info is shown has changed\n", 'showCameraViewCenterChanged': "Emitted when the flag whether camera's view center is shown has changed\n\n.. versionadded:: 3.4\n", 'showCameraRotationCenterChanged': "Emitted when the flag whether camera's rotation center is shown has changed\n\n.. versionadded:: 3.24\n", 'showLightSourceOriginsChanged': 'Emitted when the flag whether light source origins are shown has changed.\n\n.. versionadded:: 3.15\n', 'showLabelsChanged': 'Emitted when the flag whether labels are displayed on terrain tiles has changed\n', 'eyeDomeLightingEnabledChanged': 'Emitted when the flag whether eye dome lighting is used has changed\n\n.. versionadded:: 3.18\n', 'eyeDomeLightingStrengthChanged': 'Emitted when the eye dome lighting strength has changed\n\n.. versionadded:: 3.18\n', 'eyeDomeLightingDistanceChanged': 'Emitted when the eye dome lighting distance has changed\n\n.. versionadded:: 3.18\n', 'debugShadowMapSettingsChanged': 'Emitted when shadow map debugging has changed\n\n.. versionadded:: 3.18\n', 'debugDepthMapSettingsChanged': 'Emitted when depth map debugging has changed\n\n.. versionadded:: 3.18\n', 'pointLightsChanged': 'Emitted when the list of point lights changes\n\n.. versionadded:: 3.6\n', 'lightSourcesChanged': 'Emitted when any of the light source settings in the map changes.\n\n.. versionadded:: 3.26\n', 'directionalLightsChanged': 'Emitted when the list of directional lights changes\n\n.. versionadded:: 3.16\n', 'fieldOfViewChanged': 'Emitted when the camera lens field of view changes\n\n.. versionadded:: 3.8\n', 'projectionTypeChanged': 'Emitted when the camera lens projection type changes\n\n.. versionadded:: 3.18\n', 'cameraNavigationModeChanged': 'Emitted when the camera navigation mode was changed\n\n.. versionadded:: 3.18\n', 'cameraMovementSpeedChanged': 'Emitted when the camera movement speed was changed\n\n.. versionadded:: 3.18\n', 'skyboxSettingsChanged': 'Emitted when skybox settings are changed\n\n.. versionadded:: 3.16\n', 'shadowSettingsChanged': 'Emitted when shadow rendering settings are changed\n\n.. versionadded:: 3.16\n', 'ambientOcclusionSettingsChanged': 'Emitted when ambient occlusion rendering settings are changed\n\n.. versionadded:: 3.28\n', 'fpsCounterEnabledChanged': 'Emitted when the FPS counter is enabled or disabled\n\n.. versionadded:: 3.18\n', 'viewFrustumVisualizationEnabledChanged': "Emitted when the camera's view frustum visualization on the main 2D map canvas is enabled or disabled\n\n.. versionadded:: 3.26\n", 'axisSettingsChanged': 'Emitted when 3d axis rendering settings are changed\n\n.. versionadded:: 3.26\n', 'debugOverlayEnabledChanged': 'Emitted when the debug overaly is enabled or disabled\n\n.. versionadded:: 3.26\n', 'extentChanged': "Emitted when the 3d view's 2d extent has changed\n\n.. seealso:: :py:func:`setExtent`\n\n.. versionadded:: 3.30\n", 'showExtentIn2DViewChanged': "Emitted when the parameter to display 3d view's extent in the 2D canvas has changed\n\n.. seealso:: :py:func:`setShowExtentIn2DView`\n\n.. versionadded:: 3.32\n"}
Qgs3DMapSettings.__attribute_docs__ = {'settingsChanged': 'Emitted when one of the configuration settings has changed\n\n.. versionadded:: 3.24\n', 'backgroundColorChanged': 'Emitted when the background color has changed\n', 'selectionColorChanged': 'Emitted when the selection color has changed\n', 'layersChanged': 'Emitted when the list of map layers for 3d rendering has changed.\n\n.. seealso:: :py:func:`setLayers`\n\n.. seealso:: :py:func:`layers`\n', 'terrainGeneratorChanged': 'Emitted when the terrain generator has changed\n', 'terrainVerticalScaleChanged': 'Emitted when the vertical scale of the terrain has changed\n', 'mapTileResolutionChanged': 'Emitted when the map tile resoulution has changed\n', 'maxTerrainScreenErrorChanged': 'Emitted when the maximum terrain screen error has changed\n', 'maxTerrainGroundErrorChanged': 'Emitted when the maximum terrain ground error has changed\n', 'terrainElevationOffsetChanged': 'Emitted when the terrain elevation offset is changed\n\n.. versionadded:: 3.16\n', 'terrainShadingChanged': 'Emitted when terrain shading enabled flag or terrain shading material has changed\n\n.. versionadded:: 3.6\n', 'terrainMapThemeChanged': "Emitted when terrain's map theme has changed\n\n.. versionadded:: 3.6\n", 'renderersChanged': "Emitted when the list of map's extra renderers have been modified\n\n.. versionadded:: 3.10\n", 'showTerrainBoundingBoxesChanged': "Emitted when the flag whether terrain's bounding boxes are shown has changed\n", 'showTerrainTilesInfoChanged': "Emitted when the flag whether terrain's tile info is shown has changed\n", 'showCameraViewCenterChanged': "Emitted when the flag whether camera's view center is shown has changed\n\n.. versionadded:: 3.4\n", 'showCameraRotationCenterChanged': "Emitted when the flag whether camera's rotation center is shown has changed\n\n.. versionadded:: 3.24\n", 'showLightSourceOriginsChanged': 'Emitted when the flag whether light source origins are shown has changed.\n\n.. versionadded:: 3.15\n', 'showLabelsChanged': 'Emitted when the flag whether labels are displayed on terrain tiles has changed\n', 'eyeDomeLightingEnabledChanged': 'Emitted when the flag whether eye dome lighting is used has changed\n\n.. versionadded:: 3.18\n', 'eyeDomeLightingStrengthChanged': 'Emitted when the eye dome lighting strength has changed\n\n.. versionadded:: 3.18\n', 'eyeDomeLightingDistanceChanged': 'Emitted when the eye dome lighting distance has changed\n\n.. versionadded:: 3.18\n', 'debugShadowMapSettingsChanged': 'Emitted when shadow map debugging has changed\n\n.. versionadded:: 3.18\n', 'debugDepthMapSettingsChanged': 'Emitted when depth map debugging has changed\n\n.. versionadded:: 3.18\n', 'pointLightsChanged': 'Emitted when the list of point lights changes\n\n.. versionadded:: 3.6\n', 'lightSourcesChanged': 'Emitted when any of the light source settings in the map changes.\n\n.. versionadded:: 3.26\n', 'directionalLightsChanged': 'Emitted when the list of directional lights changes\n\n.. versionadded:: 3.16\n', 'fieldOfViewChanged': 'Emitted when the camera lens field of view changes\n\n.. versionadded:: 3.8\n', 'projectionTypeChanged': 'Emitted when the camera lens projection type changes\n\n.. versionadded:: 3.18\n', 'cameraNavigationModeChanged': 'Emitted when the camera navigation mode was changed\n\n.. versionadded:: 3.18\n', 'cameraMovementSpeedChanged': 'Emitted when the camera movement speed was changed\n\n.. versionadded:: 3.18\n', 'skyboxSettingsChanged': 'Emitted when skybox settings are changed\n\n.. versionadded:: 3.16\n', 'shadowSettingsChanged': 'Emitted when shadow rendering settings are changed\n\n.. versionadded:: 3.16\n', 'ambientOcclusionSettingsChanged': 'Emitted when ambient occlusion rendering settings are changed\n\n.. versionadded:: 3.28\n', 'fpsCounterEnabledChanged': 'Emitted when the FPS counter is enabled or disabled\n\n.. versionadded:: 3.18\n', 'viewFrustumVisualizationEnabledChanged': "Emitted when the camera's view frustum visualization on the main 2D map canvas is enabled or disabled\n\n.. versionadded:: 3.26\n", 'axisSettingsChanged': 'Emitted when 3d axis rendering settings are changed\n\n.. versionadded:: 3.26\n', 'debugOverlayEnabledChanged': 'Emitted when the debug overaly is enabled or disabled\n\n.. versionadded:: 3.26\n', 'extentChanged': "Emitted when the 3d view's 2d extent has changed\n\n.. seealso:: :py:func:`setExtent`\n\n.. versionadded:: 3.30\n", 'showExtentIn2DViewChanged': "Emitted when the parameter to display 3d view's extent in the 2D canvas has changed\n\n.. seealso:: :py:func:`setShowExtentIn2DView`\n\n.. versionadded:: 3.32\n", 'originChanged': "Emitted when the world's origin point has been shifted\n\n.. seealso:: :py:func:`setOrigin`\n\n.. versionadded:: 3.42\n"}
Qgs3DMapSettings.__signal_arguments__ = {'terrainElevationOffsetChanged': ['newElevation: float'], 'fpsCounterEnabledChanged': ['fpsCounterEnabled: bool'], 'debugOverlayEnabledChanged': ['debugOverlayEnabled: bool']}
except NameError:
pass
Loading

0 comments on commit 50ac9a6

Please sign in to comment.