diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2014-07-26 19:53:23 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2014-07-27 11:34:33 +0200 |
commit | f023d4dad7c4fd5df26e7b8a5a342f866b20bb66 (patch) | |
tree | 2f0a5ebf3cbd272980d904076614309056283cf9 /examples | |
parent | e2732cfdd9c86322a7a76de39eb9ad194ce9be47 (diff) |
Add PlaneMesh and use it in rollerball example as the floor
Change-Id: I566c94feb377ccb0d71a379094ff1eb7faefccef
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/rollerball/BallEntity.qml | 2 | ||||
-rw-r--r-- | examples/rollerball/BasicCamera.qml | 4 | ||||
-rw-r--r-- | examples/rollerball/PlaneEntity.qml | 75 | ||||
-rw-r--r-- | examples/rollerball/main.qml | 9 | ||||
-rw-r--r-- | examples/rollerball/rollerball.qrc | 1 |
5 files changed, 88 insertions, 3 deletions
diff --git a/examples/rollerball/BallEntity.qml b/examples/rollerball/BallEntity.qml index 458e15b77..185ccc89c 100644 --- a/examples/rollerball/BallEntity.qml +++ b/examples/rollerball/BallEntity.qml @@ -53,7 +53,7 @@ Entity { id: root property real x: 0.0 - property real y: 0.0 + property real y: 1.0 property real z: 0.0 property real scale: 1.0 property Material material diff --git a/examples/rollerball/BasicCamera.qml b/examples/rollerball/BasicCamera.qml index add3de557..f465b74bd 100644 --- a/examples/rollerball/BasicCamera.qml +++ b/examples/rollerball/BasicCamera.qml @@ -64,8 +64,8 @@ Camera { transform: Transform { LookAt { - position: Qt.vector3d( 0.0, 0.0, 50.0 ) - viewCenter: Qt.vector3d( 0.0, 0.0, 10.0 ) + position: Qt.vector3d( 0.0, 20.0, 50.0 ) + viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) } } diff --git a/examples/rollerball/PlaneEntity.qml b/examples/rollerball/PlaneEntity.qml new file mode 100644 index 000000000..b847bc2a9 --- /dev/null +++ b/examples/rollerball/PlaneEntity.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt3D 2.0 +import Qt3D.Render 2.0 + +// For Qt.vector3d() and friends. For some reason this is provided by +// QQuickValueTypeProvider in QtQuick rather than the default value +// type provider in QtQml. So we will need to replicate this in Qt3D +// for the types that we wish to support. Otherwise we'll have to import +// QtQuick 2.1 all over the place. +import QtQuick 2.1 as QQ2 + +Entity { + id: root + + property real x: 0.0 + property real y: 0.0 + property real z: 0.0 + property real scale: 1.0 + property Material material + + components: [ transform, mesh, root.material ] + + Transform { + id: transform + Translate { dx: root.x; dy: root.y; dz: root.z } + Scale { scale: root.scale } + } + + PlaneMesh { + id: mesh + width: 1.0 + height: 1.0 + meshResolution: Qt.size(20, 20) + } +} diff --git a/examples/rollerball/main.qml b/examples/rollerball/main.qml index c6e56d7f4..50d6a1355 100644 --- a/examples/rollerball/main.qml +++ b/examples/rollerball/main.qml @@ -76,6 +76,15 @@ Entity { id: adsEffect } + PlaneEntity { + id: floor + scale: 50 + material: AdsMaterial { + effect: adsEffect + ambient: Qt.rgba( 1.0, 1.0, 1.0, 1.0 ) + } + } + AdsMaterial { id: redMaterial effect: adsEffect diff --git a/examples/rollerball/rollerball.qrc b/examples/rollerball/rollerball.qrc index e51927697..eb5e180b8 100644 --- a/examples/rollerball/rollerball.qrc +++ b/examples/rollerball/rollerball.qrc @@ -6,5 +6,6 @@ <file>BasicCamera.qml</file> <file>AdsMaterial.qml</file> <file>BallEntity.qml</file> + <file>PlaneEntity.qml</file> </qresource> </RCC> |