diff --git a/kria-cluster-3d-demo/kria-cluster-3d-demo.pro b/kria-cluster-3d-demo/kria-cluster-3d-demo.pro
index 198ad2cba688a172195767310ff011de36ebfad7..24c4f1866d8461a55896049ad8b8d66195316b4c 100644
--- a/kria-cluster-3d-demo/kria-cluster-3d-demo.pro
+++ b/kria-cluster-3d-demo/kria-cluster-3d-demo.pro
@@ -2,7 +2,8 @@ TEMPLATE = app
QT += qml quick 3dstudioruntime2
-target.path = $$[QT_INSTALL_EXAMPLES]/studio3d/$$TARGET
+#target.path = $$[QT_INSTALL_EXAMPLES]/studio3d/$$TARGET
+target.path = /opt/$$TARGET
INSTALLS += target
SOURCES += main.cpp
diff --git a/kria-cluster-3d-demo/kria3dclusterdemo.qrc b/kria-cluster-3d-demo/kria3dclusterdemo.qrc
index 68f5425255911052803bdf49cc8e15fa28aedae4..9c4eb3a441531964c20e7a0541ef1fe02f5bf813 100644
--- a/kria-cluster-3d-demo/kria3dclusterdemo.qrc
+++ b/kria-cluster-3d-demo/kria3dclusterdemo.qrc
@@ -39,5 +39,6 @@
presentation/GaugeCenter/gaugecenter.import
presentation/Gauges/Gauges.import
presentation/Needle/needle.import
+ qml/FpsDisplay.qml
diff --git a/kria-cluster-3d-demo/main.cpp b/kria-cluster-3d-demo/main.cpp
index c15022adcc2ff948dc7214c16659bd09bf97b0f7..89ef213df4108f70ade99c0761f6f6a0bcda147c 100644
--- a/kria-cluster-3d-demo/main.cpp
+++ b/kria-cluster-3d-demo/main.cpp
@@ -47,42 +47,47 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-#include
-#include
-#include
-#include
+#include
+#include
#include
#include
int main(int argc, char *argv[])
{
- qputenv("QML_DISABLE_DISK_CACHE", "true");
+// qputenv("Q3DS_NO_DRAGONWINGS", "1");
+ qputenv("Q3DS_DRAGON", "1");
+ qputenv("QT_QPA_EGLFS_HIDECURSOR", "1");
+// qputenv("QT_QPA_EGLFS_DISABLE_INPUT", "1");
+ qputenv("QT_QPA_EGLFS_WIDTH", "1920");
+ qputenv("QT_QPA_EGLFS_HEIGHT", "1080");
+ qputenv("QT_QPA_EGLFS_PHYSICAL_WIDTH", "293");
+ qputenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT", "110");
+// qputenv("QSG_RENDER_LOOP", "basic");
+ qputenv("QSG_RENDER_LOOP", "threaded");
+
+ // Debugging
+// qputenv("QT_QPA_EGLFS_DEBUG", "1");
+// qputenv("QSG_INFO", "1");
+// qputenv("QT_LOGGING_RULES", "qt.qpa.*=true");
+
+ // Disable all extra logging
+ qputenv("QT_LOGGING_RULES", "*=false");
+
+// QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QSurfaceFormat::setDefaultFormat(Q3DS::surfaceFormat());
- QQuickView viewer;
-
QFontDatabase::addApplicationFont("qrc:/qml/fonts/TitilliumWeb-SemiBold.ttf");
QFont defaultFont;
defaultFont.setFamily("Titillium Web");
QGuiApplication::setFont(defaultFont);
- viewer.setSource(QUrl("qrc:/main.qml"));
-
- viewer.setTitle(QStringLiteral("Qt 3D Studio Kria 3D Cluster Demo"));
- viewer.setResizeMode(QQuickView::SizeRootObjectToView);
- viewer.setWidth(1920);
- viewer.setHeight(720);
- viewer.setColor(QColor("black"));
-#if (defined Q_OS_ANDROID)
- viewer.showFullScreen();
-#else
- viewer.show();
-#endif
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ if (engine.rootObjects().isEmpty())
+ return -1;
return app.exec();
}
diff --git a/kria-cluster-3d-demo/qml/FpsDisplay.qml b/kria-cluster-3d-demo/qml/FpsDisplay.qml
new file mode 100644
index 0000000000000000000000000000000000000000..2e7667edc53a709f1cef09b67daf55bc756b9c2e
--- /dev/null
+++ b/kria-cluster-3d-demo/qml/FpsDisplay.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.11
+
+Rectangle {
+ id: fpsDisplayControl
+
+ property real fps: 0.0
+ property alias textcolor: fpsText.color
+ property alias fpslabel: fpsLabelText.text
+ color: "black"
+
+ Text {
+ id: fpsText
+ text: fps.toFixed(1)
+ font.family: "Helvetica"
+ font.pixelSize: fpsDisplayControl.width / 2
+ font.weight: Font.Light
+ color: "white"
+ width: parent.width
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ }
+
+ Text {
+ id: fpsLabelText
+ text: "FPS"
+ font.family: "Helvetica"
+ font.pixelSize: fpsDisplayControl.width / 5
+ font.weight: Font.Light
+ color: "white"
+ width: parent.width
+ anchors.top: fpsText.bottom
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ }
+}
diff --git a/kria-cluster-3d-demo/qml/Navigation.qml b/kria-cluster-3d-demo/qml/Navigation.qml
index c448bb5e04dcd34223b2f506212f0c1f7ea24e9e..08b44212f894804a8e7363237b114df43c917ed1 100644
--- a/kria-cluster-3d-demo/qml/Navigation.qml
+++ b/kria-cluster-3d-demo/qml/Navigation.qml
@@ -51,15 +51,12 @@
import QtQuick 2.0
Item {
- width: 2560
- height: 960
-
Image {
id: fakeMap
source: "qrc:/icons/Map.png"
- y: -580
- width: 2560
- height: 1540
+ y: -parent.width / 0.227 //-580
+ width: parent.width //2560
+ height: parent.width * 0.6 //1540
}
PropertyAnimation {
diff --git a/kria-cluster-3d-demo/qml/main.qml b/kria-cluster-3d-demo/qml/main.qml
index 4adbde888031c594debd872ef2c9e0ea4bce423e..2912122fb6b607850687f797b0e3530b735d3f9a 100644
--- a/kria-cluster-3d-demo/qml/main.qml
+++ b/kria-cluster-3d-demo/qml/main.qml
@@ -48,14 +48,20 @@
**
****************************************************************************/
-import QtQuick 2.9
-import QtStudio3D 2.0
+import QtQuick 2.12
+import QtQuick.Window 2.12
+import QtStudio3D 2.3
+//import QtStudio3D 1.1
import QtQuick.Controls 2.1
-Item {
+Window {
id: mainview
-
- focus: true
+ width: 1920
+ height: 1080
+ visible: true
+ color: "#000000"
+ title: "Qt 3D Studio Kria 3D Cluster Demo"
+ visibility: Window.FullScreen
property bool startupAnimation: true
property bool allowSelection: true
@@ -80,16 +86,36 @@ Item {
property string chimesInfo: "Off"
property string chimesWarning: "On"
+ // fps
+ property real avgFrames: 0.0
+ property int avgCount: 0
+ property int frames: 0
+ property int framesUpdated: 0
+ readonly property int framesBetweenUpdates: 5 // Use a 5 frame average for the FPS counter
+ readonly property int secondsBetweenUpdates: 60 // Use a 1 minute average for the average FPS counter
+
+ // RT1
+// onFrameSwapped: {
+// frames++;
+// avgFrames++;
+// }
+
Studio3D {
id: studio3D
width: parent.width
height: parent.height
anchors.verticalCenter: parent.verticalCenter
- ViewerSettings {
- scaleMode: ViewerSettings.ScaleModeFit
+ // RT2
+ onFrameUpdate: {
+ frames++;
+ avgFrames++;
}
+// ViewerSettings {
+// scaleMode: ViewerSettings.ScaleModeFit
+// }
+
Presentation {
id: cluster
source: "qrc:/presentation/mainPresentation.uia"
@@ -154,8 +180,8 @@ Item {
visible: active
source: ""
asynchronous: true
- width: 2560
- height: 960
+ width: mainview.width //2560
+ height: mainview.width * 0.375 //960
}
}
]
@@ -171,7 +197,7 @@ Item {
OverlayContainer {
id: indicatorPane
scale: mainview.width / 2560
- anchors.centerIn: mainview
+ anchors.centerIn: studio3D
visible: false
}
@@ -357,4 +383,50 @@ Item {
mouse.accepted = false;
}
}
+
+ //
+ // FpsDisplay
+ //
+ FpsDisplay {
+ id: fpsDisplay
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.margins: 10
+ width: 40
+ height: 40
+ textcolor: "red"
+ fpslabel: "FPS"
+ }
+ FpsDisplay {
+ id: avgFpsDisplay
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: 10
+ width: 40
+ height: 40
+ textcolor: "green"
+ fpslabel: "1 min AVG"
+ }
+ Timer {
+ interval: 1000
+ repeat: true
+ running: !fpsDisplay.hidden
+ onTriggered: {
+ if (++framesUpdated == framesBetweenUpdates) {
+ fpsDisplay.fps = frames / framesBetweenUpdates;
+ frames = 0;
+ framesUpdated = 0;
+ }
+ if (++avgCount == secondsBetweenUpdates) {
+ avgFpsDisplay.fps = avgFrames / secondsBetweenUpdates;
+ avgFrames = 0.0;
+ avgCount = 0;
+ }
+ }
+ onRunningChanged: {
+ avgFrames = 0;
+ frames = 0;
+ framesUpdated = 0;
+ }
+ }
}