244 Commits

Author SHA1 Message Date
Nyall Dawson
25313dd530 Registry can create terrain generators 2024-12-13 14:21:51 +10:00
Nyall Dawson
c1bd66a54d Online DEM 2024-12-13 14:21:51 +10:00
Nyall Dawson
ed9b2784b0 Quantized mesh settings 2024-12-13 14:21:51 +10:00
Nyall Dawson
293b7afadd Implement a registry for terrain objects 2024-12-13 14:21:51 +10:00
Nyall Dawson
8af23b1002 Initial framework for terrain settings refactoring 2024-12-13 14:21:51 +10:00
Denis Rouzaud
30ea619861
sipify 2024-12-10 14:52:35 +01:00
Nyall Dawson
0dbf6e730b Add equality operator for QgsMesh3DSymbol 2024-11-27 10:53:53 +10:00
Nyall Dawson
eb750fb7a8 Use doubles for properties in QgsAbstractMaterialSettings subclasses
These classes are supposed to store the original setting values,
so doubles are more appropriate as they won't slightly change
eg when round-tripping through qgis project XML.

(The actual 3d material classes still use floats, this is just
for the settings classes)
2024-11-26 20:05:30 +10:00
Nyall Dawson
0dc89613df Expose equals method for QgsAbstractMaterialSettings subclasses 2024-11-26 20:05:30 +10:00
Nyall Dawson
373b48ce10
Expose QgsMesh3DSymbol to Python 2024-11-26 14:42:21 +10:00
Martin Dobias
6defbc68c4 Review: add missing \since 2024-11-25 17:16:28 +01:00
Martin Dobias
60554195dc Add possibility to shift origin of 3D map scenes
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.
2024-11-25 17:16:28 +01:00
Jean Felder
dfce7dc231 qgs3dmapscene: Compute max clip planes
The number of available clip planes depends on the OpenGL
implementation.

This change Introduces a new function in Qgs3DUtils function called
`Qgs3DUtils::getOpenGLMaxClipPlanes` to compute this
number (`GL_MAX_CLIP_PLANES`) and use it in the 3D scene.

See: https://registry.khronos.org/OpenGL-Refpages/gl2.1/xhtml/glClipPlane.xml
2024-11-21 17:08:41 +01:00
Withalion
5f6259ac10 Fix issues found in review 2024-11-21 09:30:45 +01:00
Withalion
1551449df3 Move debug panel icon from toolbar
Debug panel in 3d map view can be set in advanced settings or by
keyboard shortcut CTRL + SHIFT + d
2024-11-21 09:30:45 +01:00
Withalion
c76455bcc6 Add stop updates checkbox in 3D View options 2024-11-21 09:30:45 +01:00
Nyall Dawson
aaf4b90911
Fix malformed docstrings (#59244)
* Fix malformed docstrings

Fixes https://github.com/qgis/pyqgis-api-docs-builder/issues/188

* Fix malformed docstrings

* Fix more malformed docs
2024-10-28 14:29:21 +01:00
Martin Dobias
68a76bc407 Update python/3d/auto_generated/symbols/qgspoint3dsymbol.sip.in
Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
2024-10-26 04:35:12 +10:00
Martin Dobias
04d5369d4d Fix sip bindings 2024-10-26 04:35:12 +10:00
Jean Felder
e38ac6c7b9 qgs3dmapscene: Add support to setup clipping
This adds two functions to setup clip planes on a 3d scene:
- enableClipping() to enable opengl clipping
- disableClipping() to disable opengl clipping

The `enableClipping()` function achieves 3 things:
- it stores the clipping plane equations
- it adds clip planes to the framegraph
- it enables the clipping on the material of the existing entities

`disableClipping()` does the opposite things.

The clip planes equations need to be stored to handle the dynamic
addition of new entities. Indeed, when a new entity is added, clipping
needs to be enabled on its material if necessary. This is achieved
in `finalizeNewEntity` which is called on all new entities.
However, this is not true for the terrain entity. That's why,
`mTerrain` now listens to the `newEntityCreated` signal to call
`handleClippingOnEntity()`.
2024-10-17 10:31:40 +02:00
Martin Dobias
b02813e657 Add API to temporarily disable updates in 3D map scene
This is useful for debugging 3D views, to pause scene updates and
inspect some parts of the scene in detail.
2024-10-03 08:09:04 +10:00
Nyall Dawson
534ca73c59 Fix missing see also trailing notes in PyQGIS documentation 2024-09-04 06:32:03 +10:00
Nyall Dawson
0f1daa11f3 Fix formatting of some \see links 2024-09-04 06:32:03 +10:00
Nyall Dawson
ef0289f3ec Fix formatting of Python ..deprecated annotations in docstrings
Fixes https://github.com/qgis/pyqgis-api-docs-builder/issues/174
2024-09-02 11:42:12 +10:00
Nyall Dawson
765cbb32db Standardise some deprecated annotations 2024-09-02 11:42:12 +10:00
Nyall Dawson
e161d0bd60 Enforce thread safety for Qgs3DMapSettings 2024-08-28 12:38:16 +10:00
Nyall Dawson
9391a62664 Refactor so Qgs3DMapSettings is a member of Qgs3DSceneEntity 2024-08-28 12:38:16 +10:00
Nyall Dawson
1f94f9bc4e Rework to use Qgs3DRenderContext instead 2024-08-28 12:38:16 +10:00
Nyall Dawson
5e33ee4a57 Add some thread safety to Qgs3DMapSettings usage
Create a small, cheap to copy (non-qobject) class
Qgs3DMapSettingsSnapshot which is designed to store
just cheap properties of Qgs3DMapSettings. Then use this
object wherever possible to avoid accessing the (non-thread
safe) Qgs3DMapSettings object for retrieval of simple
map properties (eg crs, extent, ...)

Refs https://github.com/qgis/QGIS-Enhancement-Proposals/issues/301
2024-08-28 12:38:16 +10:00
Nyall Dawson
bc52832b47 Lazily hack around markdown title underline not being long enough
Causes a bunch of warnings when building the PyQGIS docs
2024-08-28 11:58:21 +10:00
Nyall Dawson
6a936472d4 Remove incorrect 'not available in python' note 2024-08-28 11:58:21 +10:00
Jean Felder
8dab246707
[3D] Use QGIS material for the terrain (#58134)
* terrain: Use PhongMaterialSettings material for the non texture case

There is no functional change. With this change, the terrain uses a
material defined by QGIS instead of a default Qt3D. This will make it
easier to customize the shader in the future.

* qgsphongmaterialsettings: Fix setShininess signature

`mShininess` is a double.

* qgsphongtexturedmaterialsettings: Use a double to store shininess

This is already waht QgsPhongTexturedMaterialSettings does. The reason
for this change is to avoid the user-set values changing for them when
saving/restoring projects.

* qgsphongtexturedmaterialsettings: Use a double to store opacity

This is already waht QgsPhongTexturedMaterialSettings does. The reason
for this change is to avoid the user-set values changing for them when
saving/restoring projects.

* qgsphongtexturedmaterialsettings: Do proper opacity cast in toMaterial

* qgsphongtexturedmaterialsettings: Factor out material creation

This introduces a new class `QgsPhongTexturedMaterial` which is
similar to Qt3D `QDiffuseSpecularMaterial`.
`QgsPhongTexturedMaterial::toMaterial()` now calls
`QgsPhongTexturedMaterial` to create the material. This has no
functional change.

This will make it possible to directly use `QgsPhongTexturedMaterial`
for the terrain in the next commit. Indeed, the texture case needs to
use a `QTexture2D` which cannot be stored in a settings class. This
issue is avoided by directly creating the material instead of using
`QgsPhongTexturedMaterial::toMaterial()`.

* qgsterraintileloader: Fix typo

* terrain: Use QgsPhongTexturedMaterial for shading texture

There is no functional change. With this change, the terrain uses a
material defined by QGIS instead of a default Qt3D. This will make it
easier to customize the shader in the future.

* 3d/material: Introduce QgsTextureMaterial

This is the same material as the qt3d one:
`Qt3DExtras::QTextureMaterial`. It will also be used in the following
commit by the terrain.

* terrain: Use QgsTextureMaterial for non shading texture

There is no functional change. With this change, the terrain uses a
material defined by QGIS instead of a default Qt3D. This will make it
easier to customize the shader in the future.
2024-08-19 23:01:06 +02:00
Nyall Dawson
bc331f6a98 Add documentation for QgsPoint3DSymbol properties
Fixes https://github.com/qgis/pyqgis-api-docs-builder/issues/140
2024-08-19 11:16:01 +02:00
Nyall Dawson
774ad87251 Remove orphaned sip files
These headers are marked SIP_NO_FILE, these files are not
referenced anywhere
2024-08-13 20:28:55 +10:00
Nyall Dawson
3a578d6712 Header update 2024-08-13 20:28:55 +10:00
Nyall Dawson
c2c75f3b19
More no-value dox removal 2024-07-25 09:04:22 +10:00
Nyall Dawson
6f652d251b Drop no-value copy constructor dox 2024-07-25 04:02:55 +10:00
Nyall Dawson
28943f9c1b Remove a bunch of useless default constructor doxygen 2024-07-23 02:08:28 +10:00
Jean Felder
2682a2ee2d qgs3dmapsettings: Fix extent methods documention
The 3D scene's CRS is not necessarily the same as the project's
CRS. For example, it can be "EPSG:3857" if the project's CRS is
geographic.

The stored extent in the settings is always the 3D scene's extent.

See:
b0d1a4f8b1
2024-05-30 05:28:33 +10:00
Jean Felder
13109d7577 qgs3dmapscene: Fix python bindings availability note
Qgs3DMapScene is now available in Python bindings.

See: 176807bc35
2024-05-04 06:31:11 +10:00
Even Rouault
15ea5c46bc
Header files: remove all mentions of '\since QGIS 3.0' 2024-02-18 20:57:23 +01:00
uclaros
38db09fa39 deprecate Qgs3DMapScene::openScenes() hack
fix docstrings
2024-01-19 06:51:53 -08:00
uclaros
652b6a630d limit what's exposed to python 2024-01-19 06:51:53 -08:00
uclaros
2f98809d2c cleanup 2024-01-19 06:51:53 -08:00
uclaros
75607c05f8 Qgs3DMapCanvas + Qgs3DWindow = <3 2024-01-19 06:51:53 -08:00
Nyall Dawson
da06bde051 Use double instead of float in high level class to avoid
user set values changing when saving/restoring material settings

Convert to float when creating low level, performance critical
objects only.
2024-01-16 13:20:47 +10:00
Nyall Dawson
0215bf01a3 Add API to control coefficients (strength) of ambient/diffuse/specular
contributions to phong shader
2024-01-16 13:20:47 +10:00
Nyall Dawson
9099fa4f3e Add a physically based metal rough material
Adds a new material choice for a physically based metal/roughness
material. Options are available for setting the material base color,
metalness and roughness.

Internally this uses a clone of Qt's QMetalRoughMaterial class. We
use a copy of the Qt class instead of relying on Qt's implementation
as longer-term improvements (such as data defined base color) will
require a re-implementation anyway. By using our own material we
will avoid having two different code paths for the data-defined/
non-data defined scenarios.
2024-01-11 11:43:01 +10:00
Nyall Dawson
f6addcd0ca Promote 3d point symbol shape to enum class 2023-12-25 17:54:44 +10:00
Nyall Dawson
7b41268c99 Ensure that default shape properties for 3d symbols are only
stored in a single place, and that we always use the default
value when its not overwise set

This has two benefits:
1. The user doesn't see confusing "0" values for radius/length etc,
which are silently treated as some other fixed value when rendering
2. The default values are correctly accounted for when calculating
the layer's AABB, otherwise we end up with a flat AABB by
default
2023-12-23 06:38:43 +10:00