| 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 |
FrameGraph { |
| 20 |
SampleFrameGraphConfiguration { |
| 21 |
viewportRect : Qt.rect(0,0,1,1) |
| 22 |
camera : camera1 // Problem here, we cannot reference an Entity |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
// Cameras are Entity composed of an Optic component called Camera |
| 27 |
// Maybe Camera should be its own Entity subclass |
| 28 |
Entity { |
| 29 |
id : camera1 |
| 30 |
objectName : "camera1" |
| 31 |
|
| 32 |
Transform { |
| 33 |
LookAt {} |
| 34 |
Translate {} |
| 35 |
Scale {} |
| 36 |
Rotate {} |
| 37 |
} |
| 38 |
|
| 39 |
Camera { // Maybe this should be rename to optics |
| 40 |
projectionType: Camera.PerspectiveProjection |
| 41 |
fieldOfView: 22.5 |
| 42 |
aspectRatio: 1920.0 / 1080.0 |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
Entity { |
| 47 |
id : testMesh |
| 48 |
objectName : "testMesh" |
| 49 |
|
| 50 |
Mesh mesh : Mesh { // subclass of Component |
| 51 |
source : "test_mesh.obj" |
| 52 |
|
| 53 |
Material { // subclass of Component |
| 54 |
diffuseColor : "#00ff00" |
| 55 |
specularColor : "#00ff00" |
| 56 |
} |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
} // sceneRoot |
| 61 |
|
| 62 |
} // root |