| 1 |
// Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import QtQuick 2.10 |
| 5 |
import QtQuick.Scene3D 2.0 |
| 6 |
import Qt3D.Core 2.10 |
| 7 |
import Qt3D.Render 2.13 |
| 8 |
import Qt3D.Input 2.0 |
| 9 |
import Qt3D.Extras 2.0 |
| 10 |
|
| 11 |
Item { |
| 12 |
width: 800 |
| 13 |
height: 600 |
| 14 |
|
| 15 |
Scene3D { |
| 16 |
anchors.fill: parent |
| 17 |
|
| 18 |
Entity { |
| 19 |
id: sceneRoot |
| 20 |
|
| 21 |
Camera { |
| 22 |
id: camera |
| 23 |
projectionType: CameraLens.PerspectiveProjection |
| 24 |
fieldOfView: 45 |
| 25 |
aspectRatio: 16/9 |
| 26 |
nearPlane : 0.1 |
| 27 |
farPlane : 1000.0 |
| 28 |
position: Qt.vector3d( 0.0, 0.0, -4.0 ) |
| 29 |
upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) |
| 30 |
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) |
| 31 |
} |
| 32 |
|
| 33 |
OrbitCameraController { |
| 34 |
camera: camera |
| 35 |
} |
| 36 |
|
| 37 |
components: [ |
| 38 |
RenderSettings { |
| 39 |
activeFrameGraph: ForwardRenderer { |
| 40 |
clearColor: Qt.rgba(0, 0.5, 1, 1) |
| 41 |
camera: camera |
| 42 |
} |
| 43 |
}, |
| 44 |
// Event Source will be set by the Qt3DQuickWindow |
| 45 |
InputSettings { }, |
| 46 |
DirectionalLight { |
| 47 |
intensity: 0.8 |
| 48 |
worldDirection: camera.viewVector |
| 49 |
} |
| 50 |
] |
| 51 |
|
| 52 |
|
| 53 |
NumberAnimation { |
| 54 |
target: cubeTransform |
| 55 |
property: "rotationY" |
| 56 |
duration: 10000 |
| 57 |
from: 0 |
| 58 |
to: 360 |
| 59 |
|
| 60 |
loops: Animation.Infinite |
| 61 |
running: true |
| 62 |
} |
| 63 |
|
| 64 |
SharedGLTexture { |
| 65 |
id: shaderGLTexture |
| 66 |
textureId: _textureWidget.textureId |
| 67 |
} |
| 68 |
|
| 69 |
Entity { |
| 70 |
id: cubeEntity |
| 71 |
readonly property GeometryRenderer cuboid: CuboidMesh { } |
| 72 |
readonly property DiffuseMapMaterial material: DiffuseMapMaterial { |
| 73 |
diffuse: shaderGLTexture |
| 74 |
} |
| 75 |
Transform { |
| 76 |
id: cubeTransform |
| 77 |
rotationX: 180 |
| 78 |
} |
| 79 |
|
| 80 |
components: [ cuboid, material, cubeTransform ] |
| 81 |
} |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
Grid { |
| 86 |
spacing: 10 |
| 87 |
columns: 2 |
| 88 |
Text { text: "Target: " + _nameMapper.targetName(shaderGLTexture.target) } |
| 89 |
Text { text: "Format: " + _nameMapper.formatName(shaderGLTexture.format) } |
| 90 |
Text { text: "Width: " + shaderGLTexture.width } |
| 91 |
Text { text: "Height: " + shaderGLTexture.height } |
| 92 |
Text { text: "Depth: " + shaderGLTexture.depth } |
| 93 |
Text { text: "Layers: " + shaderGLTexture.layers } |
| 94 |
Text { text: "GL Texture Id: " + shaderGLTexture.textureId } |
| 95 |
} |
| 96 |
|
| 97 |
} |