summaryrefslogtreecommitdiffstats
path: root/examples/simple-qml
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2014-03-24 11:02:10 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-30 14:42:40 +0200
commit1aa17e9bdffae08e9c5c2a6bbf1c5affce73c802 (patch)
tree108693a3514c55a3b75c116c466f5731696c9d00 /examples/simple-qml
parent3aab83685122e2391c3080f250d334a923a8b3f4 (diff)
FrameGraph and frontend FrameGraphNode
All framegraph building blocks are now subclasses of FrameGraphNode. An Entity can reference the framegraph configuration to use by by declaring inline a FrameGraphBuildingBlock or referencing it. RenderSceneBuilder retrieves the first FrameGraph in the scene and builds a tree of Render::FrameGraphNodes from the activeFrameGraph it references. The Render::FrameGraphNodes are empty at the moment and will be filled in follow-up commmits Change-Id: Id5f90421be16c3c979a6da2dccf19068bf7921ec Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/simple-qml')
-rw-r--r--examples/simple-qml/ForwardRenderer.qml31
-rw-r--r--examples/simple-qml/elements/CameraSelectorEntity.qml52
-rw-r--r--examples/simple-qml/elements/RenderPassFilterEntity.qml52
-rw-r--r--examples/simple-qml/elements/TechniqueFilterEntity.qml52
-rw-r--r--examples/simple-qml/elements/ViewportEntity.qml52
-rw-r--r--examples/simple-qml/main.cpp1
-rw-r--r--examples/simple-qml/main.qml104
-rw-r--r--examples/simple-qml/simple-qml.qrc1
8 files changed, 85 insertions, 260 deletions
diff --git a/examples/simple-qml/ForwardRenderer.qml b/examples/simple-qml/ForwardRenderer.qml
index 0928931a4..2b2f52008 100644
--- a/examples/simple-qml/ForwardRenderer.qml
+++ b/examples/simple-qml/ForwardRenderer.qml
@@ -40,11 +40,13 @@
****************************************************************************/
import Qt3D 2.0
-import "elements/"
+import Qt3D.Render 2.0
-Entity {
+TechniqueFilter {
id: root
+ objectName : "techniqueFilter"
+
// Expose the viewport rect and camera. This allows users of this
// forward rendering framegraph to decide which camera in the
// scene renders to a given viewport region.
@@ -52,23 +54,24 @@ Entity {
// Using this as a building block for a larger framegraph would
// allow a scene to be rendered multiple times to different
// viewports using different cameras for e.g.
- property alias viewportRect: viewport.viewportRect
+ property alias viewportRect: viewport.rect
property alias camera: cameraSelector.camera
- TechniqueFilterEntity {
- filterTags: [
- Tag { name: "style"; value: "forward"}
- ]
+ tags: [
+ Tag { name: "style"; value: "forward"}
+ ]
+
+ Viewport {
+ id: viewport
+ objectName : "viewport"
- ViewportEntity {
- id: viewport
- CameraSelectorEntity {
- id: cameraSelector
+ CameraSelector {
+ id: cameraSelector
+ objectName : "cameraSelector"
- RenderPassFilterEntity { renderPassNames: "zFill" }
- RenderPassFilterEntity { renderPassNames: "lighting" }
- }
+ RenderPassFilter { renderPassNames: "zFill" }
+ RenderPassFilter { renderPassNames: "lighting" }
}
}
}
diff --git a/examples/simple-qml/elements/CameraSelectorEntity.qml b/examples/simple-qml/elements/CameraSelectorEntity.qml
deleted file mode 100644
index 0bd8d64db..000000000
--- a/examples/simple-qml/elements/CameraSelectorEntity.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** 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
-
-Entity {
- property alias camera: selector.camera
-
- property CameraSelector _cameraSelector: selector
-
- CameraSelector {
- id: selector
- }
-}
diff --git a/examples/simple-qml/elements/RenderPassFilterEntity.qml b/examples/simple-qml/elements/RenderPassFilterEntity.qml
deleted file mode 100644
index 5bd902c1a..000000000
--- a/examples/simple-qml/elements/RenderPassFilterEntity.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** 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
-
-Entity {
- property alias renderPassNames: filter.renderPassNames
-
- property RenderPassFilter _renderPassFilter: filter
-
- RenderPassFilter {
- id: filter
- }
-}
diff --git a/examples/simple-qml/elements/TechniqueFilterEntity.qml b/examples/simple-qml/elements/TechniqueFilterEntity.qml
deleted file mode 100644
index 2b9c2cfda..000000000
--- a/examples/simple-qml/elements/TechniqueFilterEntity.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** 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
-
-Entity {
- property alias filterTags: filter.tags
-
- property TechniqueFilter _techniqueFilter: filter
-
- TechniqueFilter {
- id: filter
- }
-}
diff --git a/examples/simple-qml/elements/ViewportEntity.qml b/examples/simple-qml/elements/ViewportEntity.qml
deleted file mode 100644
index 5d1fd4e18..000000000
--- a/examples/simple-qml/elements/ViewportEntity.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** 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
-
-Entity {
- property alias viewportRect: defaultViewport.rect
-
- property Viewport _viewport: defaultViewport
-
- Viewport {
- id: defaultViewport
- }
-}
diff --git a/examples/simple-qml/main.cpp b/examples/simple-qml/main.cpp
index a1f963a85..b54c802de 100644
--- a/examples/simple-qml/main.cpp
+++ b/examples/simple-qml/main.cpp
@@ -42,6 +42,7 @@
#include <window.h>
#include <rendereraspect.h>
+
#include <QGuiApplication>
#include <QtQml>
diff --git a/examples/simple-qml/main.qml b/examples/simple-qml/main.qml
index 919aafcec..3e09acb57 100644
--- a/examples/simple-qml/main.qml
+++ b/examples/simple-qml/main.qml
@@ -42,6 +42,7 @@
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
@@ -54,21 +55,47 @@ Node {
objectName: "root"
// Scene graph
- Node {
+ Entity {
id: sceneRoot
- objectName: "sceneRoot"
+ objectName: "sceneRootTest"
+
+ property FrameGraph frameGraph : FrameGraph {
+ objectName : "frameGraph"
+ // activeFrameGraph can be defined inline or by reference
+ // activeFrameGraph : ForwardRenderer {objectName :"innerExternalRenderer"}
+ activeFrameGraph : external_forward_renderer
+ }
+
+ ForwardRenderer {
+ id : external_forward_renderer
+ objectName : "externalRenderer"
+ camera: mainCamera
+ viewportRect: Qt.rect(0, 0, 1, 1)
+ }
+
+ property Entity testEntity : Entity {
+ objectName : "testInlineEntity"
+ }
+
+ property Transform transform: Transform {
+ transforms: Rotate {objectName : "scaleTransform"}
+ }
+
+ property Mesh toto : Mesh {
+ Material {
+
+ }
+ }
+
+ Entity {
+ id : test_entity
+ objectName : "test_entity"
+ }
Entity {
id: mainCamera
objectName: "mainCamera"
- property Transform transform: Transform {
- transforms: LookAt {
- position: Qt.vector3d(0.0, 2.0, 0.0)
- viewCenter: Qt.vector3d(0.0, 0.0, 0.5)
- upVector: Qt.vector3d(0.0, 1.0, 0.0)
- }
- }
property Camera camera: Camera {
objectName: "cameraComponent"
@@ -83,10 +110,10 @@ Node {
}
}
- AdsEffect {
- id: adsEffect
- objectName: "adsEffect"
- }
+ // AdsEffect {
+ // id: adsEffect
+ // objectName: "adsEffect"
+ // }
Mesh {
id: ballMesh
@@ -120,36 +147,37 @@ Node {
property Material material: ballMaterial
}
+ Translate {
+ id: ball2Translation
+ objectName : "ball2Translation"
+ dx: 0; dy: 0
+ QQ2.SequentialAnimation {
+ running: true
+ loops: QQ2.Animation.Infinite
+
+ QQ2.NumberAnimation {
+ target: ball2Translation
+ property: "dx"
+ duration: 1000
+ easing.type: QQ2.Easing.InOutQuad
+ from: 0; to: 100
+ }
+ QQ2.NumberAnimation {
+ target: ball2Translation
+ property: "dx"
+ duration: 1000
+ easing.type: QQ2.Easing.InOutQuad
+ from: 100; to: 0
+ }
+ }
+ }
+
Entity {
id: ball2
objectName: "ball2"
property Transform transform: Transform {
- Translate {
- id: ball2Translation
- dx: 0; dy: 0
-
- QQ2.SequentialAnimation {
- running: true
- loops: QQ2.Animation.Infinite
-
- QQ2.NumberAnimation {
- target: ball2Translation
- property: "dx"
- duration: 1000
- easing.type: Easing.InOutQuad
- from: 0; to: 100
- }
- QQ2.NumberAnimation {
- target: ball2Translation
- property: "dx"
- duration: 1000
- easing.type: Easing.InOutQuad
- from: 100; to: 0
- }
- }
- }
- }
+ transforms: ball2Translation}
property Mesh mesh: ballMesh
property Material material: ballMaterial
}
diff --git a/examples/simple-qml/simple-qml.qrc b/examples/simple-qml/simple-qml.qrc
index 568337235..b20d8aee6 100644
--- a/examples/simple-qml/simple-qml.qrc
+++ b/examples/simple-qml/simple-qml.qrc
@@ -5,5 +5,6 @@
<file>Renderable.qml</file>
<file>AdsEffect.qml</file>
<file>assets/ball.obj</file>
+ <file>ForwardRenderer.qml</file>
</qresource>
</RCC>