summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/gltf/main.qml
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@theqtcompany.com>2015-07-15 23:39:58 +0200
committerAndy Nichols <andy.nichols@theqtcompany.com>2015-08-08 12:55:31 +0000
commit473bd13ed373c4cc24bdd3211ee90a070a466ce2 (patch)
tree4dbfd0bc5ea908a3feb20fed8ad5242c6cef56bb /examples/qt3d/gltf/main.qml
parenta1a7e3661bce196a633ef3edd7d905c215bf9031 (diff)
Add support for loading scenes from glTF 0.8 files
This patch includes a new scene parser plugin which enables the loading of glTF files (using the 0.8 spec) into Qt3D scenes. The gltf example has been updated to work with the current APIs and the asset files it used have been updated to match the glTF 0.8 spec requrements. Previously an unused copy of the GLTF scene parser was located in render/io. It was being built, but not used as only plugin based sceneloaders were loaded by the renderer. Now it should be usable and always available. Change-Id: Ic2e31e2b63a871559aad9bad90ec2820988a1571 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'examples/qt3d/gltf/main.qml')
-rw-r--r--examples/qt3d/gltf/main.qml164
1 files changed, 29 insertions, 135 deletions
diff --git a/examples/qt3d/gltf/main.qml b/examples/qt3d/gltf/main.qml
index acce5d7ac..c58aaf5d4 100644
--- a/examples/qt3d/gltf/main.qml
+++ b/examples/qt3d/gltf/main.qml
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt3D module of the Qt Toolkit.
@@ -36,150 +37,43 @@
import Qt3D 2.0
import Qt3D.Renderer 2.0
-import QtQuick 2.1 as QQ2
Entity {
- id: root
- objectName: "root"
-
- Scene {
- id: wineScene
- source: ":/assets/gltf/wine/wine.json"
-
- Entity {
- transforms: [
- Translate {
- dx: 100
- dy: 0
- dz: -100
- }
-
- ]
-
- property Mesh myMesh: ballmesh
- }
-
- Entity {
- property Mesh myMesh: ballmesh
-
- transforms: [
- Translate {
- dx: 0
- dy: 100
- }
-
- ]
-
- property Material mat: greenMaterial
- }
-
- Entity {
- property Shape myShape: sphere1
-
- transforms: [
- Translate {
- dx: 50
- dy: 50
- }
-
- ]
-
- property Material mat: greenMaterial
-
- Shape {
- id: sphere1
- radius: 25
- rings: 32
- slices: 32
- }
- }
-
- Entity {
- property Shape myShape: torus1
-
- transforms: [
- Translate {
- dx: 50
- dy: 120
- }
-
- ]
-
- property Material mat: blueMaterial
-
- Shape {
- id: torus1
- radius: 40
- minorRadius: 15
- type: Shape.ShapeTorus
- }
- }
-
-
- Entity {
- property Mesh myMesh: ballmesh
-
- transforms: [
- Rotate {
- angle: 45
- axis: Qt.vector3d(0, 1, 0)
- },
-
- Translate {
- dx: 40
- dy: 100
- }
- ]
-
- property Material mat: blueMaterial
- }
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 20.0, -120.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
}
- Mesh {
- id: ballmesh
- source: ":/assets/obj/ball.obj"
+ Configuration {
+ controlledCamera: camera
}
- Material {
- id: greenMaterial
-
- parameters: [
- /*
- Tag {
- name: "kd"
- value: Qt.green
- }
- */
-
- Tag {
- name: "kd"
- value: Qt.vector3d( 0.2, 1.0, 0.1 )
-
- QQ2.Vector3dAnimation on value {
- from: Qt.vector3d(0.0, 1.0, 0.1)
- to: Qt.vector3d(1.0, 1.0, 0.1)
- duration: 1000
- loops: QQ2.Animation.Infinite
- }
- },
-
- Tag {
- name: "diffuse"
- value: brick
- }
- ]
+ FrameGraph {
+ id : external_forward_renderer
+ activeFrameGraph : ForwardRenderer {
+ camera: camera
+ clearColor: "black"
+ }
}
- Material {
- id: blueMaterial
+ components: [external_forward_renderer]
- parameters: [
- Tag { name: "kd"; value: Qt.vector3d(0.2, 0.2, 1.0) }
- ]
+ Wine {
+ id: wineRack
+ scale: 1
+ x: -60.0
+ y: -20.0
+ z: 0.0
+ angleX: 180
}
- Texture {
- id: brick
- source: "/Users/jmt/KDAB/Qt3D/qt3d-ng/assets/textures/brick1.jpg"
- }
}