From 6bd3591134b4b39d0fa0e3854336bbf2b0467b08 Mon Sep 17 00:00:00 2001
From: Tomi Korpipaa <tomi.korpipaa@qt.io>
Date: Tue, 13 Feb 2018 11:17:20 +0200
Subject: [PATCH] Fix Pixel C jams or Kria Cluster

Note: Disable shadows for Pixel C in mainPresentation.uip, they seem
to cause instability.
---
 .../android/AndroidManifest.xml               |  2 +-
 .../presentation/contentPresentation.uip      | 27 ++++++++++---------
 .../presentation/mainPresentation.uip         |  4 +--
 kria-cluster-3d-demo/qml/main.qml             | 16 ++++++++++-
 4 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/kria-cluster-3d-demo/android/AndroidManifest.xml b/kria-cluster-3d-demo/android/AndroidManifest.xml
index 4c803df..8d56123 100644
--- a/kria-cluster-3d-demo/android/AndroidManifest.xml
+++ b/kria-cluster-3d-demo/android/AndroidManifest.xml
@@ -63,7 +63,7 @@
 
     </application>
 
-    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/>
+    <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="26"/>
     <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
 
     <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
diff --git a/kria-cluster-3d-demo/presentation/contentPresentation.uip b/kria-cluster-3d-demo/presentation/contentPresentation.uip
index 92736e5..8737dfa 100644
--- a/kria-cluster-3d-demo/presentation/contentPresentation.uip
+++ b/kria-cluster-3d-demo/presentation/contentPresentation.uip
@@ -22,10 +22,12 @@
 							</Material>
 							<Material id="Glass" name="Glass" blendmode="Normal" diffuse="0.424168 0.530641 0.64" emissivepower="0" importid="Glass" opacity="100" specularamount="0" specularroughness="9.60784" >
 								<Image id="Glass_specularreflection" />
-								<Image id="Glass_iblprobe" />
 							</Material>
 							<Material id="CarBottom" name="CarBottom" blendmode="Normal" diffuse="0.64 0.64 0.64" emissivepower="0" importid="CarBottom" opacity="100" specularamount="0" specularroughness="9.60784" />
-							<Material id="Interior" name="Interior" blendmode="Normal" diffuse="0.64 0.64 0.64" emissivepower="0" importid="Interior" opacity="100" specularamount="0" specularroughness="9.60784" />
+							<Material id="Interior" name="Interior" blendmode="Normal" diffuse="0.64 0.64 0.64" emissivepower="0" importid="Interior" opacity="100" specularamount="0" specularroughness="9.60784" >
+								<Image id="Interior_diffusemap" />
+								<Image id="Interior_normalmap" />
+							</Material>
 							<Model id="body" name="body" importid="body" orientation="Right Handed" position="0 0 -0" rotation="1.51661e-21 -0 0" rotationorder="XYZr" scale="1 1 1" sourcepath=".\Car\meshes\body.mesh#2" >
 								<Material id="lambert2" name="lambert2" blendmode="Normal" diffuse="1 1 1" emissivepower="0" importid="lambert2" opacity="100" specularamount="0" >
 									<Image id="lambert2_normalmap" />
@@ -72,15 +74,16 @@
 				<Add ref="#Seats" diffuse="1 1 1" diffusemap="#Seats_diffusemap" importfile=".\Car\Car.import" normalmap="#Seats_normalmap" />
 				<Add ref="#Seats_diffusemap" sourcepath=".\Car\maps\Seats_diffuse.jpg" />
 				<Add ref="#Seats_normalmap" sourcepath=".\Car\maps\Seats_normal.jpg" />
-				<Add ref="#Glass" fresnelPower="10" iblprobe="#Glass_iblprobe" importfile=".\Car\Car.import" opacity="59.2593" specularamount="5" specularreflection="#Glass_specularreflection" specularroughness="0.58375" speculartint="0.388235 0.388235 0.388235" />
+				<Add ref="#Glass" fresnelPower="10" importfile=".\Car\Car.import" opacity="59.2593" specularamount="5" specularreflection="#Glass_specularreflection" specularroughness="0.58375" speculartint="0.388235 0.388235 0.388235" />
 				<Add ref="#Glass_specularreflection" mappingmode="Environmental Mapping" sourcepath="./Gaugesvol1/maps/OpenfootageNET_lowerAustria01-1024.hdr" />
-				<Add ref="#Glass_iblprobe" mappingmode="IBL Override" sourcepath="./maps/OpenfootageNet_LADEFENSE-512.hdr" />
 				<Add ref="#CarBottom" diffuse="0.101961 0.101961 0.101961" importfile=".\Car\Car.import" shaderlighting="None" />
-				<Add ref="#Interior" diffuse="0.0901961 0.0901961 0.0901961" importfile=".\Car\Car.import" />
+				<Add ref="#Interior" diffuse="0.0901961 0.0901961 0.0901961" diffusemap="#Interior_diffusemap" importfile=".\Car\Car.import" normalmap="#Interior_normalmap" />
+				<Add ref="#Interior_diffusemap" sourcepath="Car/maps/Seats_diffuse.jpg" />
+				<Add ref="#Interior_normalmap" sourcepath="Car/maps/Seats_normal.jpg" />
 				<Add ref="#body" importfile=".\Car\Car.import" />
 				<Add ref="#lambert2" bumpamount="1" diffuse="0.870588 0 0" fresnelPower="5" importfile=".\Car\Car.import" normalmap="#lambert2_normalmap" opacity="100" specularamount="2" specularmodel="Default" specularreflection="#lambert2_specularreflection" specularroughness="0.001" speculartint="0.298039 0.298039 0.298039" />
 				<Add ref="#lambert2_normalmap" sourcepath=".\Car\maps\outUV_normals.png" />
-				<Add ref="#lambert2_specularreflection" mappingmode="Environmental Mapping" sourcepath="./maps/OpenfootageNet_LADEFENSE-1024.hdr" />
+				<Add ref="#lambert2_specularreflection" mappingmode="Environmental Mapping" sourcepath="./maps/OpenfootageNET_lowerAustria01-1024.hdr" />
 				<Add ref="#Wheel_Back_Left" importfile=".\Car\Car.import" scale="90 38.141 38.141" >
 					<AnimationTrack property="rotation.x" type="EaseInOut" >0 720 0 0 8 0 0 0</AnimationTrack>
 					<AnimationTrack property="rotation.y" type="EaseInOut" >0 0 0 0 8 -0 0 0</AnimationTrack>
@@ -97,15 +100,15 @@
 				<Add ref="#Wheel_specularmap" sourcepath=".\Car\maps\Wheel_specular.jpg" />
 				<Add ref="#Wheel_normalmap" sourcepath="./Car/maps/Wheel_normal.jpg" />
 				<Add ref="#Wheel_Front_Left" importfile=".\Car\Car.import" >
-					<AnimationTrack property="rotation.x" type="EaseInOut" >0 820 100 100 4 0 100 100 8 820 100 100</AnimationTrack>
-					<AnimationTrack property="rotation.y" type="EaseInOut" >0 0 100 100 4 0 100 100 8 0 100 100</AnimationTrack>
-					<AnimationTrack property="rotation.z" type="EaseInOut" >0 190 100 100 4 190 100 100 8 190 100 100</AnimationTrack>
+					<AnimationTrack property="rotation.x" type="EaseInOut" >0 720 0 0 8 0 0 0</AnimationTrack>
+					<AnimationTrack property="rotation.y" type="EaseInOut" >0 0 0 0 8 0 0 0</AnimationTrack>
+					<AnimationTrack property="rotation.z" type="EaseInOut" >0 180 0 0 8 180 0 0</AnimationTrack>
 				</Add>
 				<Add ref="#Wheel_002" name="Wheel" referencedmaterial="#Wheel" />
 				<Add ref="#Wheel_Front_Right" importfile=".\Car\Car.import" >
-					<AnimationTrack property="rotation.x" type="EaseInOut" >0 0 100 100 8 720 100 100</AnimationTrack>
-					<AnimationTrack property="rotation.y" type="EaseInOut" >0 0 100 100 8 0 100 100</AnimationTrack>
-					<AnimationTrack property="rotation.z" type="EaseInOut" >0 0 100 100 8 30 100 100</AnimationTrack>
+					<AnimationTrack property="rotation.x" type="EaseInOut" >0 0 0 0 8 720 0 0</AnimationTrack>
+					<AnimationTrack property="rotation.y" type="EaseInOut" >0 0 0 0 8 0 0 0</AnimationTrack>
+					<AnimationTrack property="rotation.z" type="EaseInOut" >0 0 0 0 8 0 0 0</AnimationTrack>
 				</Add>
 				<Add ref="#Wheel_003" name="Wheel" referencedmaterial="#Wheel" />
 				<State id="Scene-carRotate" name="carRotate" playmode="Looping" >
diff --git a/kria-cluster-3d-demo/presentation/mainPresentation.uip b/kria-cluster-3d-demo/presentation/mainPresentation.uip
index bee2956..a47c203 100644
--- a/kria-cluster-3d-demo/presentation/mainPresentation.uip
+++ b/kria-cluster-3d-demo/presentation/mainPresentation.uip
@@ -81,8 +81,8 @@
 							</Model>
 						</Group>
 					</Group>
-					<Image id="Layer_lightprobe" />
 					<Light id="Light_002" />
+					<Image id="Layer_lightprobe" />
 				</Layer>
 				<Layer id="Map" >
 					<Camera id="Camera_002" />
@@ -231,8 +231,8 @@
 					<AnimationTrack property="positionv" type="EaseInOut" >0 0 0 0</AnimationTrack>
 					<AnimationTrack property="rotationuv" type="EaseInOut" >0 0 0 0</AnimationTrack>
 				</Add>
-				<Add ref="#Layer_lightprobe" mappingmode="Light Probe" sourcepath=".\Gaugesvol1\maps\OpenfootageNET_lowerAustria01-1024.hdr" />
 				<Add ref="#Light_002" name="Light" brightness="250" castshadow="True" endtime="1000" expfade="0" lightambient="0.427451 0.427451 0.427451" lightdiffuse="0.901961 0.901961 0.901961" lightspecular="0.113725 0.109804 0.14902" lighttype="Point" linearfade="9.25926" position="0 48 -110" scale="4 1 1" shdwbias="0.032" shdwfactor="79.8333" shdwfilter="4.66667" shdwmapfar="1500" shdwmapres="10" />
+				<Add ref="#Layer_lightprobe" mappingmode="Light Probe" sourcepath="Gaugesvol1/maps/OpenfootageNET_lowerAustria01-1024.hdr" />
 				<Add ref="#Map" name="Content_Layer" height="70" left="15" top="17" width="72" />
 				<Add ref="#Camera_002" orthographic="True" />
 				<Add ref="#Car" name="Car" />
diff --git a/kria-cluster-3d-demo/qml/main.qml b/kria-cluster-3d-demo/qml/main.qml
index dc1841d..97be65a 100644
--- a/kria-cluster-3d-demo/qml/main.qml
+++ b/kria-cluster-3d-demo/qml/main.qml
@@ -87,7 +87,7 @@ Item {
         anchors.verticalCenter: parent.verticalCenter
 
         ViewerSettings {
-            scaleMode: ViewerSettings.ScaleModeFill
+            scaleMode: ViewerSettings.ScaleModeFit
         }
 
         Presentation {
@@ -157,6 +157,13 @@ Item {
                 ]
             }
         }
+
+        // Hack. We need to draw something in QML in each frame to minimize the jamming of
+        // Studio3D content.
+        property int frame: 0
+        onFrameUpdate: {
+            speedTest.text = frame++;
+        }
     }
 
     OverlayContainer {
@@ -225,6 +232,13 @@ Item {
         }
     }
 
+    // Hack. We need to draw something in QML in each frame to minimize the jamming of
+    // Studio3D content.
+    Label {
+        id: speedTest
+        color: "black"
+    }
+
     function menuSelect(next) {
         if (!allowSelection)
             return;
-- 
GitLab