mirror of
https://github.com/qgis/QGIS.git
synced 2025-07-03 00:03:10 -04:00
Compare commits
2 Commits
75f4322f07
...
c34e3af96a
Author | SHA1 | Date | |
---|---|---|---|
|
c34e3af96a | ||
|
ca5ac93290 |
@ -41,10 +41,6 @@ QgsPoint3DSymbol::QgsPoint3DSymbol()
|
||||
: mMaterialSettings( std::make_unique<QgsPhongMaterialSettings>() )
|
||||
{
|
||||
setBillboardSymbol( static_cast<QgsMarkerSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ) );
|
||||
|
||||
// our built-in 3D geometries (e.g. cylinder, plane, ...) assume Y axis going "up",
|
||||
// let's rotate them by default so that their Z axis goes "up" (like the rest of the scene)
|
||||
mTransform.rotate( QQuaternion::fromAxisAndAngle( QVector3D( 1, 0, 0 ), 90 ) );
|
||||
}
|
||||
|
||||
QgsPoint3DSymbol::QgsPoint3DSymbol( const QgsPoint3DSymbol &other )
|
||||
|
@ -249,8 +249,15 @@ QgsMaterial *QgsInstancedPoint3DSymbolHandler::material( const QgsPoint3DSymbol
|
||||
technique->graphicsApiFilter()->setMajorVersion( 3 );
|
||||
technique->graphicsApiFilter()->setMinorVersion( 2 );
|
||||
|
||||
const QMatrix4x4 transformMatrix = symbol->transform();
|
||||
QMatrix3x3 normalMatrix = transformMatrix.normalMatrix(); // transponed inverse of 3x3 sub-matrix
|
||||
const QMatrix4x4 tempTransformMatrix = symbol->transform();
|
||||
// our built-in 3D geometries (e.g. cylinder, plane, ...) assume Y axis going "up",
|
||||
// let's rotate them by default so that their Z axis goes "up" (like the rest of the scene)
|
||||
QMatrix4x4 id;
|
||||
id.rotate( QQuaternion::fromAxisAndAngle( QVector3D( 1, 0, 0 ), 90 ) );
|
||||
QMatrix4x4 transformMatrix = tempTransformMatrix * id;
|
||||
|
||||
// transponed inverse of 3x3 sub-matrix
|
||||
QMatrix3x3 normalMatrix = transformMatrix.normalMatrix();
|
||||
|
||||
// QMatrix3x3 is not supported for passing to shaders, so we pass QMatrix4x4
|
||||
float *n = normalMatrix.data();
|
||||
|
@ -1731,10 +1731,15 @@ void TestQgs3DRendering::testInstancedRendering()
|
||||
cylinder3DSymbol->setShape( Qgis::Point3DShape::Cylinder );
|
||||
QVariantMap vmCylinder;
|
||||
vmCylinder[QStringLiteral( "radius" )] = 20.0f;
|
||||
vmCylinder[QStringLiteral( "length" )] = 200.0f;
|
||||
vmCylinder[QStringLiteral( "length" )] = 300.0f;
|
||||
cylinder3DSymbol->setShapeProperties( vmCylinder );
|
||||
cylinder3DSymbol->setMaterialSettings( materialSettings.clone() );
|
||||
|
||||
// simulate call to set transform as the symbol widget will do
|
||||
QMatrix4x4 id;
|
||||
id.translate( 10.0, 0.0, 10.0 );
|
||||
cylinder3DSymbol->setTransform( id );
|
||||
|
||||
layerPointsZ->setRenderer3D( new QgsVectorLayer3DRenderer( cylinder3DSymbol ) );
|
||||
|
||||
scene->cameraController()->setLookingAtPoint( QgsVector3D( 0, 0, 0 ), 2500, 60, 0 );
|
||||
@ -1818,10 +1823,15 @@ void TestQgs3DRendering::testInstancedRenderingClipping()
|
||||
cylinder3DSymbol->setShape( Qgis::Point3DShape::Cylinder );
|
||||
QVariantMap vmCylinder;
|
||||
vmCylinder[QStringLiteral( "radius" )] = 20.0f;
|
||||
vmCylinder[QStringLiteral( "length" )] = 200.0f;
|
||||
vmCylinder[QStringLiteral( "length" )] = 300.0f;
|
||||
cylinder3DSymbol->setShapeProperties( vmCylinder );
|
||||
cylinder3DSymbol->setMaterialSettings( materialSettings.clone() );
|
||||
|
||||
// simulate call to set transform as the symbol widget will do
|
||||
QMatrix4x4 id;
|
||||
id.translate( 10.0, 0.0, 10.0 );
|
||||
cylinder3DSymbol->setTransform( id );
|
||||
|
||||
layerPointsZ->setRenderer3D( new QgsVectorLayer3DRenderer( cylinder3DSymbol ) );
|
||||
|
||||
scene->cameraController()->setLookingAtPoint( QgsVector3D( 0, 0, 0 ), 2500, 60, 0 );
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.8 KiB |
Loading…
x
Reference in New Issue
Block a user