| 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 |
// This could be moved to another file |
| 20 |
FrameGraphConfiguration { // subclass of Component |
| 21 |
|
| 22 |
id : frameGraphConfiguration |
| 23 |
|
| 24 |
TechniqueFilter { // subclass of FrameGraphComponent |
| 25 |
|
| 26 |
Viewport { // subclass of FrameGraphComponent |
| 27 |
|
| 28 |
viewportRect : Qt.rect(0,0,1,1) |
| 29 |
|
| 30 |
CameraSelector { |
| 31 |
|
| 32 |
camera : camera1 // Problem here, we cannot reference an Entity |
| 33 |
|
| 34 |
} // CameraSelector |
| 35 |
} // ViewPort |
| 36 |
} // TechniqueFilter |
| 37 |
} // FrameGraphConfiguration |
| 38 |
|
| 39 |
property FrameGraph frameGraph : FrameGraph { // subclass of Component |
| 40 |
// activeFrameGraph: references the frameGraph |
| 41 |
// configuration |
| 42 |
activeFrameGraph : frameGraphConfiguration |
| 43 |
} // frameGraph |
| 44 |
|
| 45 |
// Cameras are Entity composed of an Optic component called Camera |
| 46 |
Entity { |
| 47 |
id : camera1 |
| 48 |
objectName : "camera1" |
| 49 |
|
| 50 |
// Transform is a component |
| 51 |
// Contains transformation childComponents |
| 52 |
property Transform transform : Transform { |
| 53 |
LookAt {} |
| 54 |
Translate {} |
| 55 |
Scale {} |
| 56 |
Rotate {} |
| 57 |
} |
| 58 |
|
| 59 |
property Camera optics : Camera { |
| 60 |
projectionType: Camera.PerspectiveProjection |
| 61 |
fieldOfView: 22.5 |
| 62 |
aspectRatio: 1920.0 / 1080.0 |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
Entity { |
| 67 |
id : testMesh |
| 68 |
objectName : "testMesh" |
| 69 |
|
| 70 |
property Mesh mesh : Mesh { // subclass of Component |
| 71 |
source : "test_mesh.obj" |
| 72 |
} |
| 73 |
|
| 74 |
property Material material : Material { // subclass of Component |
| 75 |
diffuseColor : "#00ff00" |
| 76 |
specularColor : "#00ff00" |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
} // sceneRoot |
| 82 |
|
| 83 |
} // root |