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
This method attempts to interpolate the point on a linestringM
where a specified m value falls. It does this by interpolating
M values along the line string segments, finding the first
segment at which the target M value falls. If the M value
corresponds to a part of the line with constant m values, then
the center point of this constant m value portion will be
returned.
The simplification MUST be applied prior to transforming geometries,
or the precalculated simplification tolerance will no be correct
and may be excessive (eg when the simplification tolerance
was calculated for a map in meters, yet the rendered layer is
in degrees -- in this case we would simplify the inverted geometry
with a tolerance of ~1 degree!)
Ensure that we apply the simplification FIRST, then transform,
and disable further simplification when rendering the calculated
inverted feature. This is also a performance boost, because we
are simplifying geometries prior to transforming + calculating
the inversion, so usually end up with a lot less vertices
to handle in those operations...
* 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.