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()`.
This adds the `setClipDistance` function which allows to compute
`gl_ClipDistance`. It will be added to the different shaders in the
following commits.
This changes allows to enable or disable clip planes on a
material. Indeed, to enable clipping, it is necessary to compute
`gl_ClipDistance` in the vertex or the geometry shader (where the
`gl_Position` is computed). `gl_ClipDistance` needs to have the clip
plane equations.
With this change, two `uniform` parameters are set in the shaders of a
`QgsMaterial` if clipping is enabled:
- the clip plane equations as an array
- the number of equations
Also, it is necessary to ensure that the clipping is not computed if
is not needed. This is achieved by adding a `#define CLIPPING` macro
to the shaders if the clipping is enabled.
There are two opposites functions:
- `enableClipping` which adds the `#define CLIPPING` macro
to the relevant shaders and adds the two uniform parameters
- `disableClipping` which disables the `#define CLIPPING`
macro from the relevant shaders and removes the two uniform parameters
if necessary
`Qt3DRender::QClipPlane` enable OpenGL clipping plane that can be used
in shaders using gl_ClipDistance.
This change allows to enable `N` clipPlanes. This change has no effect
at the moment because `gl_ClipDistance` needs to be computed in each
vertex or geometry shader file. This will be achieved in the following
commits.
With this change, the materials used by the renderers now inherit from
`QgsMaterial`. `QgsMaterial` is just a child of
`Qt3DRender::QMaterial` and does nothing at the moment. In the
following commits, `QgsMaterial` will be extend to allow to enable or
disable clip planes on the material.
`QgsTextureMaterial` does exactly the same things as
`Qt3DExtras::QTextureMaterial`. However it has 2 advantages:
- it allows to easily customize the shader code if necessary
- it will inherit from `QgsMaterial` in the next commit which will
allow to add support gl_clipDistance
Currently the HTML page returned after logging in to the authentication
server is hardcoded in English. Let's make it translatable.
Funded by Régie de Gestion des Données Savoie Mont Blanc (rgd.fr)
Fix an unreported issue with WMS client ignoring the advertised tile
size from GetCapabilities (because the raster iterator always used
its own hardcoded default).
A new method was added to retrieve this information from data providers
only implemented for WMS at the moment.
The test has been reformatted for consistency with other core tests
by moving the implementation outside of the class. The actual change is
the addition of TestQgsWmsProvider::testMaxTileSize().
Funded by: M.O.S.S. Computer Grafik Systeme GmbH https://www.moss.de/