From 993d0354c52c4498c9579315c6145e889544b92b Mon Sep 17 00:00:00 2001
From: Paul Olav Tvete <paul.tvete@qt.io>
Date: Wed, 20 Jan 2021 17:20:28 +0100
Subject: [PATCH] Fix transformations when instancing

---
 BenchmarkDemoQt6/BenchmarkUI/assets/Model100k.qml | 5 +++++
 BenchmarkDemoQt6/BenchmarkUI/assets/Model10k.qml  | 5 +++++
 BenchmarkDemoQt6/BenchmarkUI/assets/Model1k.qml   | 3 +++
 BenchmarkDemoQt6/BenchmarkUI/assets/Model500k.qml | 5 +++++
 BenchmarkDemoQt6/BenchmarkUI/assets/Model50k.qml  | 5 +++++
 5 files changed, 23 insertions(+)

diff --git a/BenchmarkDemoQt6/BenchmarkUI/assets/Model100k.qml b/BenchmarkDemoQt6/BenchmarkUI/assets/Model100k.qml
index a9eb119..cb84101 100644
--- a/BenchmarkDemoQt6/BenchmarkUI/assets/Model100k.qml
+++ b/BenchmarkDemoQt6/BenchmarkUI/assets/Model100k.qml
@@ -226,6 +226,7 @@ Model {
         scale: Qt.vector3d(0.2, 0.2, 0.2)
         source: "meshes/city100.mesh"
         instancing: rootNode.instancing
+        instanceRoot: rootNode
         materials: [
             house_material,
             propeller_material,
@@ -254,6 +255,7 @@ Model {
             eulerRotation.y: rootNode_1.propellerRotation
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
@@ -268,6 +270,7 @@ Model {
             eulerRotation.y: -rootNode_1.propellerRotation
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
@@ -282,6 +285,7 @@ Model {
             eulerRotation.y: rootNode_1.propellerRotation
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
@@ -296,6 +300,7 @@ Model {
             eulerRotation.y: -rootNode_1.propellerRotation
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
diff --git a/BenchmarkDemoQt6/BenchmarkUI/assets/Model10k.qml b/BenchmarkDemoQt6/BenchmarkUI/assets/Model10k.qml
index 4acee30..35e4ffa 100644
--- a/BenchmarkDemoQt6/BenchmarkUI/assets/Model10k.qml
+++ b/BenchmarkDemoQt6/BenchmarkUI/assets/Model10k.qml
@@ -53,6 +53,7 @@ Node {
         scale: Qt.vector3d(0.5, 0.5, 0.5)
         eulerRotation.x: 90
         instancing: rootNode.instancing
+        instanceRoot: rootNode
         materials: [
             smallMachine_material
         ]
@@ -73,6 +74,7 @@ Node {
             eulerRotation.x: 90
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
@@ -88,6 +90,7 @@ Node {
             eulerRotation.x: 90
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
@@ -103,6 +106,7 @@ Node {
             eulerRotation.x: 90
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
@@ -118,6 +122,7 @@ Node {
             eulerRotation.x: 90
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
diff --git a/BenchmarkDemoQt6/BenchmarkUI/assets/Model1k.qml b/BenchmarkDemoQt6/BenchmarkUI/assets/Model1k.qml
index 1dd81a2..b96fe14 100644
--- a/BenchmarkDemoQt6/BenchmarkUI/assets/Model1k.qml
+++ b/BenchmarkDemoQt6/BenchmarkUI/assets/Model1k.qml
@@ -32,6 +32,7 @@ Node {
         eulerRotation.z: rootNode.gearRotation + 25
         source: "meshes/gear.mesh"
         instancing: rootNode.instancing
+        instanceRoot: rootNode
         materials: [
             parts_material
         ]
@@ -45,6 +46,7 @@ Node {
         eulerRotation.y: rootNode.gearRotation
         source: "meshes/gear.mesh"
         instancing: rootNode.instancing
+        instanceRoot: rootNode
         materials: [
             parts_material
         ]
@@ -56,6 +58,7 @@ Node {
         eulerRotation.y: -rootNode.gearRotation
         source: "meshes/gear.mesh"
         instancing: rootNode.instancing
+        instanceRoot: rootNode
         materials: [
             parts_material
         ]
diff --git a/BenchmarkDemoQt6/BenchmarkUI/assets/Model500k.qml b/BenchmarkDemoQt6/BenchmarkUI/assets/Model500k.qml
index ea64595..d5d10da 100644
--- a/BenchmarkDemoQt6/BenchmarkUI/assets/Model500k.qml
+++ b/BenchmarkDemoQt6/BenchmarkUI/assets/Model500k.qml
@@ -226,6 +226,7 @@ Node {
         scale: Qt.vector3d(0.2, 0.2, 0.2)
         source: "meshes/city500.mesh"
         instancing: rootNode.instancing
+        instanceRoot: rootNode
         materials: [
             house_material,
             propeller_material,
@@ -254,6 +255,7 @@ Node {
             eulerRotation.y: rootNode_1.propellerRotation
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
@@ -268,6 +270,7 @@ Node {
             eulerRotation.y: -rootNode_1.propellerRotation
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
@@ -282,6 +285,7 @@ Node {
             eulerRotation.y: rootNode_1.propellerRotation
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
@@ -296,6 +300,7 @@ Node {
             eulerRotation.y: -rootNode_1.propellerRotation
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
diff --git a/BenchmarkDemoQt6/BenchmarkUI/assets/Model50k.qml b/BenchmarkDemoQt6/BenchmarkUI/assets/Model50k.qml
index a190602..f36f7ef 100644
--- a/BenchmarkDemoQt6/BenchmarkUI/assets/Model50k.qml
+++ b/BenchmarkDemoQt6/BenchmarkUI/assets/Model50k.qml
@@ -226,6 +226,7 @@ Node {
         scale: Qt.vector3d(0.2, 0.2, 0.2)
         source: "meshes/city50.mesh"
         instancing: rootNode.instancing
+        instanceRoot: rootNode
         materials: [
             house_material,
             power_material,
@@ -253,6 +254,7 @@ Node {
             eulerRotation.x: 90
             eulerRotation.y: rootNode_1.propellerRotation
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             source: "meshes/propeller.mesh"
             materials: [
                 propeller_material
@@ -268,6 +270,7 @@ Node {
             eulerRotation.y: -rootNode_1.propellerRotation
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
@@ -282,6 +285,7 @@ Node {
             eulerRotation.y: rootNode_1.propellerRotation
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
@@ -296,6 +300,7 @@ Node {
             eulerRotation.y: -rootNode_1.propellerRotation
             source: "meshes/propeller.mesh"
             instancing: rootNode.instancing
+            instanceRoot: rootNode
             materials: [
                 propeller_material
             ]
-- 
GitLab