From ce29cdf5e8ff7a57a60f287b5725707814353231 Mon Sep 17 00:00:00 2001
From: Tomi Korpipaa <tomi.korpipaa@qt.io>
Date: Thu, 11 Apr 2019 11:19:18 +0300
Subject: [PATCH] Modify LowEndCluster to OpenGL runtime

---
 LowEndCluster/Presentation/Presentation.uia   |  4 +-
 .../Presentation.uip}                         |  8 ++--
 LowEndCluster/main.qml                        | 37 +++++++++----------
 LowEndCluster/qml.qrc                         |  3 +-
 4 files changed, 26 insertions(+), 26 deletions(-)
 rename LowEndCluster/Presentation/{Presentation_1_1.uip => presentations/Presentation.uip} (96%)

diff --git a/LowEndCluster/Presentation/Presentation.uia b/LowEndCluster/Presentation/Presentation.uia
index 798dab7..f1926fe 100644
--- a/LowEndCluster/Presentation/Presentation.uia
+++ b/LowEndCluster/Presentation/Presentation.uia
@@ -1,8 +1,8 @@
 <?xml version='1.0' encoding='utf-8'?>
 <application xmlns="http://qt.io/qt3dstudio/uia">
     <assets initial="Presentation">
-        <!--        <presentation id="Presentation" src="presentations/Presentation.uip"/>-->
-        <presentation id="Presentation" src="Presentation_1_1.uip"/>
+        <presentation id="Presentation" src="presentations/Presentation.uip"/>
+        <dataInput metadata="" name="carSlide" type="String"/>
         <dataInput metadata="" name="roadSpeed" type="Float"/>
     </assets>
     <statemachine ref="#logic">
diff --git a/LowEndCluster/Presentation/Presentation_1_1.uip b/LowEndCluster/Presentation/presentations/Presentation.uip
similarity index 96%
rename from LowEndCluster/Presentation/Presentation_1_1.uip
rename to LowEndCluster/Presentation/presentations/Presentation.uip
index 2e71e32..514a571 100644
--- a/LowEndCluster/Presentation/Presentation_1_1.uip
+++ b/LowEndCluster/Presentation/presentations/Presentation.uip
@@ -5,7 +5,7 @@
 			<CustomColors count="16" >#4f456e #56416e #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff</CustomColors>
 		</ProjectSettings>
 		<Graph >
-			<Scene id="Scene" >
+			<Scene id="Scene" controlledproperty="" >
 				<Layer id="Layer" variants="" >
 					<Camera id="Camera" />
 					<Component id="Car" >
@@ -40,7 +40,7 @@
 		<Logic >
 			<State name="Master Slide" component="#Scene" >
 				<Add ref="#Layer" background="SolidColor" backgroundcolor="0 0 0" disabledepthprepass="True" disabledepthtest="False" />
-				<Add ref="#Camera" position="0 546.454 -720.64" rotation="44.5 0 0" >
+				<Add ref="#Camera" clipfar="3500" position="0 546.454 -720.64" rotation="44.5 0 0" >
 					<AnimationTrack property="position.x" type="EaseInOut" >0.008 0 0 0 2.003 0 0 0 22 0 0 0 24 0 0 0 44 0 0 0</AnimationTrack>
 					<AnimationTrack property="position.y" type="EaseInOut" >0.008 258.454 0 0 2.003 811.454 0 0 22 811.454 0 0 24 258.454 0 0 44 258.454 0 0</AnimationTrack>
 					<AnimationTrack property="position.z" type="EaseInOut" >0.008 -720.64 0 0 2.003 -616.64 0 0 22 -616.64 0 0 24 -720.64 0 0 44 -720.64 0 0</AnimationTrack>
@@ -50,9 +50,9 @@
 				</Add>
 				<Add ref="#__Container" name="__Container" />
 				<Add ref="#materials/lowpolyCoupe" name="materials/lowpolyCoupe" importfile="../models/lowPolyCar/lowPolyCar.import" shaderlighting="None" />
-				<Add ref="#materials/lowpolyCoupe_diffusemap" importfile="../models/lowPolyCar/lowPolyCar.import" sourcepath="models/lowPolyCar/maps/Low_lowpolyCoupe_Diffuse.jpg" subpresentation="" />
+				<Add ref="#materials/lowpolyCoupe_diffusemap" importfile="../models/lowPolyCar/lowPolyCar.import" sourcepath="../models/lowPolyCar/maps/Low_lowpolyCoupe_Diffuse.jpg" subpresentation="" />
 				<Add ref="#materials/lowpolyCoupeRed" name="materials/lowpolyCoupeRed" blendmode="Normal" bumpamount="0.5" diffuse="1 1 1" diffuselightwrap="0" diffusemap="#materials/lowpolyCoupeRed_diffusemap" displaceamount="20" emissivecolor="1 1 1" emissivepower="0" fresnelPower="0" importfile="../models/lowPolyCar/lowPolyCar.import" importid="lowpolyCoupe" ior="1.5" opacity="100" shaderlighting="None" sourcepath="" specularamount="0" specularmodel="Default" specularroughness="0" speculartint="1 1 1" translucentfalloff="1" type="Material" vertexcolors="False" />
-				<Add ref="#materials/lowpolyCoupeRed_diffusemap" importfile="../models/lowPolyCar/lowPolyCar.import" importid="" sourcepath="models/lowPolyCar/maps/Low_lowpolyCoupe_Diffuse_red.jpg" subpresentation="" />
+				<Add ref="#materials/lowpolyCoupeRed_diffusemap" importfile="../models/lowPolyCar/lowPolyCar.import" importid="" sourcepath="../models/lowPolyCar/maps/Low_lowpolyCoupe_Diffuse_red.jpg" subpresentation="" />
 				<State id="Scene-Slide1" name="Slide1" playmode="Looping" >
 					<Set ref="#Layer" endtime="44000" />
 					<Set ref="#Camera" endtime="44000" />
diff --git a/LowEndCluster/main.qml b/LowEndCluster/main.qml
index d13056a..a3f13c0 100644
--- a/LowEndCluster/main.qml
+++ b/LowEndCluster/main.qml
@@ -1,7 +1,6 @@
 import QtQuick 2.12
 import QtQuick.Window 2.12
-//import QtStudio3D 2.3
-import QtStudio3D 1.1
+import QtStudio3D.OpenGL 2.4
 
 Window {
     id: main
@@ -10,7 +9,7 @@ Window {
     height: 480
     title: qsTr("Low End Cluster")
     color: "black"
-    visibility: Window.FullScreen
+    //visibility: Window.FullScreen // Use this only if display size is 1280 x 480
 
     property real speedrotation: sim.speedRotation
     property real rpmrotation: sim.rpmRotation
@@ -44,12 +43,10 @@ Window {
     readonly property int secondsBetweenUpdates: 60 // Use a 1 minute average for the average FPS counter
 
     onRpmrotationChanged: {
-
         if (rpmrotation < previousrpmrotation) {
             rpmForward = false;
             rpmTrailOpacity = 2 * (previousrpmrotation - rpmrotation);
-        }
-        else {
+        } else {
             rpmForward = true;
             rpmTrailOpacity = -2 * (previousrpmrotation - rpmrotation);
         }
@@ -59,8 +56,7 @@ Window {
         if (speedrotation < previousspeedrotation) {
             speedForward = false;
             speedTrailOpacity = 2 * (previousspeedrotation - speedrotation);
-        }
-        else {
+        } else {
             speedForward = true;
             speedTrailOpacity = -2 * (previousspeedrotation - speedrotation);
         }
@@ -71,16 +67,18 @@ Window {
         avgFrames++;
     }
     onGaugeoffsetChanged: {
-        if (gaugeoffset == 0  || gaugeoffset == -600)
-            carComponent.goToSlide(carComponent.elementPath, true, true)
+        if (gaugeoffset == 0)
+            carPosition.value = "Top";
+        else if (gaugeoffset == -600)
+            carPosition.value = "Bottom";
+
     }
     FontLoader {
         id: customfont
         source: "qrc:/TitilliumWeb-Italic.ttf"
-        //onStatusChanged: console.log("LOADER"+status)
     }
 
-    //3D Presentation
+    // 3D Presentation
     Studio3D {
         id: adasview
         anchors.top: topbar.bottom
@@ -89,7 +87,7 @@ Window {
         height: 290
 
         ViewerSettings {
-            scaleMode: ViewerSettings.ScaleModeCenter
+            scaleMode: ViewerSettings.ScaleModeFit
         }
 
         Presentation {
@@ -98,12 +96,13 @@ Window {
                 id: carComponent
                 elementPath: "Scene.Layer.Car"
             }
-            // No support for this in RT1.1
-//            DataInput{
-//                id: carPosition
-//                name: "carSlide"
-//                value: "Top"
-//            }
+
+            DataInput {
+                id: carPosition
+                name: "carSlide"
+                value: "Top"
+            }
+
             DataInput {
                 id: roadPosition
                 name: "roadSpeed"
diff --git a/LowEndCluster/qml.qrc b/LowEndCluster/qml.qrc
index b5cc4d0..8f27e62 100644
--- a/LowEndCluster/qml.qrc
+++ b/LowEndCluster/qml.qrc
@@ -27,9 +27,10 @@
         <file>parkbrake.jpg</file>
         <file>seatbelt.jpg</file>
         <file>Presentation/models/lowPolyCar/maps/Low_lowpolyCoupe_Diffuse_red.jpg</file>
-        <file>Presentation/Presentation_1_1.uip</file>
         <file>FpsDisplay.qml</file>
         <file>needleTrail.png</file>
         <file>SimulationData.qml</file>
+        <file>Presentation/materials/lowpolyCoupeRed.materialdef</file>
+        <file>Presentation/presentations/Presentation.uip</file>
     </qresource>
 </RCC>
-- 
GitLab