| 1 |
// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 |
|
| 4 |
import QtQuick 2.1 as QQ2 |
| 5 |
import Qt3D 2.0 |
| 6 |
|
| 7 |
Node { |
| 8 |
// Node can contains any type of Node or QObject |
| 9 |
id : root |
| 10 |
objectName : "root" |
| 11 |
|
| 12 |
|
| 13 |
// Entity can be composed of components and child entities |
| 14 |
// than inherit its attributes (transformations, framegraph rendering) |
| 15 |
Entity { |
| 16 |
id : sceneRoot |
| 17 |
objectName : sceneRoot |
| 18 |
|
| 19 |
|
| 20 |
property FrameGraph frameGraph : FrameGraph { // subclass of Component |
| 21 |
// activeFrameGraph: references the frameGraph |
| 22 |
// configuration |
| 23 |
activeFrameGraph : SampleFrameGraphConfiguration { |
| 24 |
camera : camera1 |
| 25 |
viewportRect : Qt.rect(0, 0, 1, 1) |
| 26 |
} |
| 27 |
} // frameGraph |
| 28 |
|
| 29 |
// Cameras are Entity composed of an Optic component called Camera |
| 30 |
Entity { |
| 31 |
id : camera1 |
| 32 |
objectName : "camera1" |
| 33 |
|
| 34 |
// Transform is a component |
| 35 |
// Contains transformation childComponents |
| 36 |
property Transform transform : Transform { |
| 37 |
LookAt {} |
| 38 |
Translate {} |
| 39 |
Scale {} |
| 40 |
Rotate {} |
| 41 |
} |
| 42 |
|
| 43 |
property Camera optics : Camera { |
| 44 |
projectionType: Camera.PerspectiveProjection |
| 45 |
fieldOfView: 22.5 |
| 46 |
aspectRatio: 1920.0 / 1080.0 |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
Entity { |
| 51 |
id : testMesh |
| 52 |
objectName : "testMesh" |
| 53 |
|
| 54 |
property Mesh mesh : Mesh { // subclass of Component |
| 55 |
source : "test_mesh.obj" |
| 56 |
} |
| 57 |
|
| 58 |
property Material material : Material { // subclass of Component |
| 59 |
diffuseColor : "#00ff00" |
| 60 |
specularColor : "#00ff00" |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
} // sceneRoot |
| 66 |
|
| 67 |
} // root |