diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-12-07 14:20:01 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-12-09 13:53:23 +0000 |
commit | 94f3df1aacab5853d09e79596eb3bdae3aecae0a (patch) | |
tree | 4db06240d22462becc9ad5b499926aa11316b88d /examples/qt3d/lights/main.qml | |
parent | 3655c334b0f4a28a1487c918384da50498ef9418 (diff) |
Add support for spotlights
Change-Id: I61a4e072c1a2e00cdbcee917aa557e56fb8cb7c0
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/qt3d/lights/main.qml')
-rw-r--r-- | examples/qt3d/lights/main.qml | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/examples/qt3d/lights/main.qml b/examples/qt3d/lights/main.qml index 0d9e953a4..85af9b6cd 100644 --- a/examples/qt3d/lights/main.qml +++ b/examples/qt3d/lights/main.qml @@ -54,9 +54,9 @@ Entity aspectRatio: 16/9 nearPlane : 0.1 farPlane : 1000.0 - position: Qt.vector3d( 0.0, 0.0, 50.0 ) + position: Qt.vector3d( 0.0, 40.0, 300.0 ) upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) - viewCenter: Qt.vector3d( 0.0, 0.0, -1.0 ) + viewCenter: Qt.vector3d( 0.0, -10.0, -1.0 ) } Configuration { @@ -69,7 +69,6 @@ Entity DirectionalLight { color: Qt.rgba(0.9, 0.9, 0.0, 1.0) direction: Qt.vector3d(-1, -1, 0) - intensity: 0.5 } ] } @@ -115,6 +114,46 @@ Entity } Entity { + id: spotLight + components: [ + SphereMesh { + radius: 1 + }, + Transform { + translation: Qt.vector3d(-5.0, 40.0, -5.0) + }, + SpotLight { + direction: Qt.vector3d(1.0, -4.0, 0.0) + Quick.SequentialAnimation on direction.x { + Quick.NumberAnimation { from: -4.0; to: 4.0; duration: 5000 } + Quick.NumberAnimation { from: 4.0; to: -4.0; duration: 5000 } + loops: Quick.Animation.Infinite + } + cutOffAngle: 30 + attenuation: Qt.vector3d(1, 0, 0) + intensity: 4 + } + ] + } + + PlaneEntity { + id: floor + + width: 600 + height: 600 + resolution: Qt.size(20, 20) + position: Qt.vector3d(0, -30, 0) + + material: NormalDiffuseMapMaterial { + ambient: Qt.rgba( 0.2, 0.2, 0.2, 1.0 ) + diffuse: "assets/textures/pattern_09/diffuse.webp" + normal: "assets/textures/pattern_09/normal.webp" + textureScale: 10 + shininess: 10 + } + } + + Entity { components: [ Mesh { source: "assets/obj/toyplane.obj" |