Skip to content
Snippets Groups Projects
Commit 065f2258 authored by Johan Helsing's avatar Johan Helsing
Browse files

WIP: 3dcompositor manual test

parent c13a6454
No related branches found
No related tags found
No related merge requests found
Pipeline #3888 passed
QT += quick quick3d waylandcompositor
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtQuick3D/QQuick3DViewport>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QSurfaceFormat::setDefaultFormat(QQuick3DViewport::idealSurfaceFormat());
QQmlApplicationEngine engine;
engine.load(QUrl(QLatin1String("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick3D 1.12
import QtWayland.Compositor 1.3
import QtQuick.Controls 2.12
WaylandCompositor {
WaylandOutput {
window: Window {
id: window
width: 1280
height: 720
visible: true
View3D {
id: view
anchors.fill: parent
focus: true
environment: SceneEnvironment {
id: environment
probeBrightness: 5
clearColor: "#cceeff"
backgroundMode: SceneEnvironment.Color
}
Node {
id: shapeSpawner
}
Camera {
id: camera
position: Qt.vector3d(0, 0, 0)
}
}
}
}
Component {
id: toplevelComponent
Model {
id: model
NumberAnimation on rotation.y {
duration: 6000
from: 0
to: 360
loops: Animation.Infinite
}
NumberAnimation on rotation.x {
duration: 12000
from: 0
to: 360
loops: Animation.Infinite
}
property alias shellSurface: ssItem.shellSurface
Component.onCompleted: console.log("loaded model")
position: Qt.vector3d(0, 0, 300)
source: "#Cube"
materials: [
DefaultMaterial {
lighting: DefaultMaterial.NoLighting
diffuseMap: Texture {
sourceItem: ShellSurfaceItem {
id: ssItem
autoCreatePopupItems: true
shellSurface: xdgSurface
onSurfaceDestroyed: model.destroy()
}
scaleU: 1
scaleV: -1 // TODO: shouldn't be needed
tilingModeHorizontal: Texture.Repeat // TODO: shouldn't be needed
tilingModeVertical: Texture.Repeat
}
}
]
}
}
XdgShell {
onToplevelCreated: {
toplevelComponent.createObject(shapeSpawner, {shellSurface: xdgSurface});
toplevel.sendMaximized(Qt.size(256, 256))
}
}
}
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment