diff options
Diffstat (limited to 'examples/qt3d/shadow-map-qml')
-rw-r--r-- | examples/qt3d/shadow-map-qml/AdsMaterial.qml | 2 | ||||
-rw-r--r-- | examples/qt3d/shadow-map-qml/GroundPlane.qml | 4 | ||||
-rw-r--r-- | examples/qt3d/shadow-map-qml/Light.qml | 2 | ||||
-rw-r--r-- | examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml | 2 | ||||
-rw-r--r-- | examples/qt3d/shadow-map-qml/Toyplane.qml | 47 | ||||
-rw-r--r-- | examples/qt3d/shadow-map-qml/Trefoil.qml | 18 | ||||
-rw-r--r-- | examples/qt3d/shadow-map-qml/main.qml | 1 |
7 files changed, 33 insertions, 43 deletions
diff --git a/examples/qt3d/shadow-map-qml/AdsMaterial.qml b/examples/qt3d/shadow-map-qml/AdsMaterial.qml index 4e02e23e6..184189074 100644 --- a/examples/qt3d/shadow-map-qml/AdsMaterial.qml +++ b/examples/qt3d/shadow-map-qml/AdsMaterial.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ +import QtQuick 2.1 import Qt3D.Core 2.0 import Qt3D.Render 2.0 -import QtQuick 2.1 Material { id: root diff --git a/examples/qt3d/shadow-map-qml/GroundPlane.qml b/examples/qt3d/shadow-map-qml/GroundPlane.qml index 6ccef86ae..3cade62b7 100644 --- a/examples/qt3d/shadow-map-qml/GroundPlane.qml +++ b/examples/qt3d/shadow-map-qml/GroundPlane.qml @@ -50,9 +50,7 @@ Entity { Transform { id: groundTransform - Translate { - dy: -5 - } + translation: Qt.vector3d(0, -5, 0) } components: [ diff --git a/examples/qt3d/shadow-map-qml/Light.qml b/examples/qt3d/shadow-map-qml/Light.qml index 493cf6acf..a0e0306b0 100644 --- a/examples/qt3d/shadow-map-qml/Light.qml +++ b/examples/qt3d/shadow-map-qml/Light.qml @@ -44,7 +44,7 @@ Entity { property vector3d lightIntensity: Qt.vector3d(1.0, 1.0, 1.0) readonly property Camera lightCamera: lightCamera - readonly property matrix4x4 lightViewProjection: lightCamera.projectionMatrix.times(lightCamera.matrix) + readonly property matrix4x4 lightViewProjection: lightCamera.projectionMatrix.times(lightCamera.viewMatrix) Camera { id: lightCamera diff --git a/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml b/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml index 2038d9f9c..63cbfae82 100644 --- a/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml +++ b/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ +import QtQuick 2.2 as QQ2 import Qt3D.Core 2.0 import Qt3D.Render 2.0 -import QtQuick 2.2 as QQ2 FrameGraph { id: root diff --git a/examples/qt3d/shadow-map-qml/Toyplane.qml b/examples/qt3d/shadow-map-qml/Toyplane.qml index 3bc1c0d53..1f883f2bb 100644 --- a/examples/qt3d/shadow-map-qml/Toyplane.qml +++ b/examples/qt3d/shadow-map-qml/Toyplane.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ +import QtQuick 2.1 as QQ2 import Qt3D.Core 2.0 import Qt3D.Render 2.0 -import QtQuick 2.1 as QQ2 Entity { id: root @@ -50,40 +50,27 @@ Entity { Transform { id: toyplaneTransform - property real rollAngle : 0 - property real pitchAngle : 15 - property real altitude : 5 + property real rollAngle: 0 + property real pitchAngle: 15 + property real altitude: 5 property real angle: 0 property real scaleFactor: 10 QQ2.Behavior on rollAngle { QQ2.SpringAnimation { spring: 2; damping: 0.2} } - Scale { - scale: 1.0 / toyplaneTransform.scaleFactor - } - - Rotate { // roll - axis : Qt.vector3d(1, 0, 0) - angle : toyplaneTransform.rollAngle - } - - Rotate { // pitch - axis : Qt.vector3d(0, 0, 1) - angle : toyplaneTransform.pitchAngle - } - - Rotate { - id: toyplaneRotation - axis: Qt.vector3d(0, 1, 0) - angle: toyplaneTransform.angle - } - - Translate { - property real translation: 1 - - dx: Math.sin(toyplaneTransform.angle * Math.PI / 180) * translation * toyplaneTransform.scaleFactor - dy: toyplaneTransform.altitude - dz: Math.cos(toyplaneTransform.angle * Math.PI / 180) * translation * toyplaneTransform.scaleFactor + matrix: { + var m = Qt.matrix4x4(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + m.translate(Qt.vector3d(Math.sin(angle * Math.PI / 180) * scaleFactor, + altitude, + Math.cos(angle * Math.PI / 180) * scaleFactor)); + m.rotate(angle, Qt.vector3d(0, 1, 0)); + m.rotate(pitchAngle, Qt.vector3d(0, 0, 1)); + m.rotate(rollAngle, Qt.vector3d(1, 0, 0)); + m.scale(1.0 / toyplaneTransform.scaleFactor); + return m; } } diff --git a/examples/qt3d/shadow-map-qml/Trefoil.qml b/examples/qt3d/shadow-map-qml/Trefoil.qml index 68a334ef8..4691adbd3 100644 --- a/examples/qt3d/shadow-map-qml/Trefoil.qml +++ b/examples/qt3d/shadow-map-qml/Trefoil.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ +import QtQuick 2.1 as QQ2 import Qt3D.Core 2.0 import Qt3D.Render 2.0 -import QtQuick 2.1 as QQ2 Entity { id: root @@ -49,20 +49,24 @@ Entity { Transform { id: trefoilMeshTransform - - Rotate { - id: trefoilMeshRotation - axis: Qt.vector3d(0, 1, 0) + property real userAngle: 0.0 + matrix: { + var m = Qt.matrix4x4(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + m.rotate(userAngle, Qt.vector3d(0, 1, 0)); + return m; } } QQ2.NumberAnimation { - target: trefoilMeshRotation + target: trefoilMeshTransform running: true loops: QQ2.Animation.Infinite - property: "angle" + property: "userAngle" duration: 5000 from: 360 to: 0 diff --git a/examples/qt3d/shadow-map-qml/main.qml b/examples/qt3d/shadow-map-qml/main.qml index 3b79213a8..f05bbbc8a 100644 --- a/examples/qt3d/shadow-map-qml/main.qml +++ b/examples/qt3d/shadow-map-qml/main.qml @@ -34,6 +34,7 @@ ** ****************************************************************************/ +import QtQuick 2.1 as QQ2 import Qt3D.Core 2.0 import Qt3D.Render 2.0 |