[arch-commits] Commit in qt6-quick3d/trunk (PKGBUILD qt6-quick3d-assimp-5.1.patch)

Antonio Rojas arojas at gemini.archlinux.org
Sat Nov 20 18:38:05 UTC 2021


    Date: Saturday, November 20, 2021 @ 18:38:05
  Author: arojas
Revision: 428696

Use system assimp

Added:
  qt6-quick3d/trunk/qt6-quick3d-assimp-5.1.patch
Modified:
  qt6-quick3d/trunk/PKGBUILD

------------------------------+
 PKGBUILD                     |   19 +++--
 qt6-quick3d-assimp-5.1.patch |  137 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 149 insertions(+), 7 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-11-20 18:25:40 UTC (rev 428695)
+++ PKGBUILD	2021-11-20 18:38:05 UTC (rev 428696)
@@ -5,20 +5,25 @@
 pkgname=qt6-quick3d
 _qtver=6.2.1
 pkgver=${_qtver/-/}
-pkgrel=1
+pkgrel=2
 arch=(x86_64)
 url='https://www.qt.io'
 license=(GPL3)
 pkgdesc='Qt module and API for defining 3D content in Qt Quick'
-depends=(qt6-declarative)
-makedepends=(cmake ninja qt6-shadertools)
-# TODO: use system assimp again when a new version is released
-optdepends=('qt6-shadertools: for shadergen')
+depends=(qt6-quicktimeline)
+makedepends=(cmake ninja qt6-shadertools assimp)
+optdepends=('qt6-shadertools: for shadergen' 'assimp: assimp import plugin')
 groups=(qt6)
 _pkgfn="${pkgname/6-/}-everywhere-src-$_qtver"
-source=(https://download.qt.io/official_releases/qt/${pkgver%.*}/$_qtver/submodules/$_pkgfn.tar.xz)
-sha256sums=('4022ce0e40a5d1c93a9593037a151cf7abe64c91a8b9882d9549f6a3c002a1b2')
+source=(https://download.qt.io/official_releases/qt/${pkgver%.*}/$_qtver/submodules/$_pkgfn.tar.xz
+        qt6-quick3d-assimp-5.1.patch)
+sha256sums=('4022ce0e40a5d1c93a9593037a151cf7abe64c91a8b9882d9549f6a3c002a1b2'
+            '49eb8feec3fdd1972266cf97fd8d40f0eb7e544c1957569c4b9f182348b17492')
 
+prepare() {
+  patch -d $_pkgfn -p1 < qt6-quick3d-assimp-5.1.patch # Fix build with assimp 5.1
+}
+
 build() {
   cmake -B build -S $_pkgfn -G Ninja
   cmake --build build

Added: qt6-quick3d-assimp-5.1.patch
===================================================================
--- qt6-quick3d-assimp-5.1.patch	                        (rev 0)
+++ qt6-quick3d-assimp-5.1.patch	2021-11-20 18:38:05 UTC (rev 428696)
@@ -0,0 +1,137 @@
+diff --git a/src/plugins/assetimporters/assimp/assimpimporter.cpp b/src/plugins/assetimporters/assimp/assimpimporter.cpp
+index cb8f92a3..4ce57d64 100644
+--- a/src/plugins/assetimporters/assimp/assimpimporter.cpp
++++ b/src/plugins/assetimporters/assimp/assimpimporter.cpp
+@@ -1268,7 +1268,7 @@ void AssimpImporter::generateMaterial(aiMaterial *material, QTextStream &output,
+         // GLTF Mode
+         {
+             aiColor4D baseColorFactor;
+-            result = material->Get(AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_FACTOR, baseColorFactor);
++            result = material->Get(AI_MATKEY_BASE_COLOR, baseColorFactor);
+             if (result == aiReturn_SUCCESS)
+                 QSSGQmlUtilities::writeQmlPropertyHelper(output,
+                                                          tabLevel + 1,
+@@ -1276,7 +1276,7 @@ void AssimpImporter::generateMaterial(aiMaterial *material, QTextStream &output,
+                                                          QStringLiteral("baseColor"),
+                                                          aiColorToQColor(baseColorFactor));
+ 
+-            QString baseColorImage = generateImage(material, AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_TEXTURE, tabLevel + 1);
++            QString baseColorImage = generateImage(material, aiTextureType_BASE_COLOR, 0, tabLevel + 1);
+             if (!baseColorImage.isNull()) {
+                 output << QSSGQmlUtilities::insertTabs(tabLevel + 1) << QStringLiteral("baseColorMap: ") << baseColorImage << QStringLiteral("\n");
+                 output << QSSGQmlUtilities::insertTabs(tabLevel + 1) << QStringLiteral("opacityChannel: Material.A\n");
+@@ -1294,7 +1294,7 @@ void AssimpImporter::generateMaterial(aiMaterial *material, QTextStream &output,
+             }
+ 
+             ai_real metallicFactor;
+-            result = material->Get(AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLIC_FACTOR, metallicFactor);
++            result = material->Get(AI_MATKEY_METALLIC_FACTOR, metallicFactor);
+             if (result == aiReturn_SUCCESS) {
+                 QSSGQmlUtilities::writeQmlPropertyHelper(output,
+                                                          tabLevel + 1,
+@@ -1304,7 +1304,7 @@ void AssimpImporter::generateMaterial(aiMaterial *material, QTextStream &output,
+             }
+ 
+             ai_real roughnessFactor;
+-            result = material->Get(AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_ROUGHNESS_FACTOR, roughnessFactor);
++            result = material->Get(AI_MATKEY_ROUGHNESS_FACTOR, roughnessFactor);
+             if (result == aiReturn_SUCCESS) {
+                 QSSGQmlUtilities::writeQmlPropertyHelper(output,
+                                                          tabLevel + 1,
+@@ -1410,16 +1410,14 @@ void AssimpImporter::generateMaterial(aiMaterial *material, QTextStream &output,
+         }
+ 
+         {
+-            bool isUnlit;
+-            result = material->Get(AI_MATKEY_GLTF_UNLIT, isUnlit);
+-            if (result == aiReturn_SUCCESS && isUnlit)
++            aiShadingMode shadingMode;
++            material->Get(AI_MATKEY_SHADING_MODEL, shadingMode);
++            if (shadingMode == aiShadingMode_Unlit)
+                 output << QSSGQmlUtilities::insertTabs(tabLevel + 1) << QStringLiteral("lighting: PrincipledMaterial.NoLighting\n");
+         }
+ 
+         // SpecularGlossiness Properties
+-        bool hasSpecularGlossiness;
+-        result = material->Get(AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS, hasSpecularGlossiness);
+-        if (result == aiReturn_SUCCESS && hasSpecularGlossiness) {
++        {
+ 
+             // diffuseFactor (color) // not used (yet), but ends up being diffuseColor
+ //            {
+@@ -1448,7 +1446,7 @@ void AssimpImporter::generateMaterial(aiMaterial *material, QTextStream &output,
+             // glossinessFactor (float)
+             {
+                 ai_real glossiness;
+-                result = material->Get(AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS_GLOSSINESS_FACTOR, glossiness);
++                result = material->Get(AI_MATKEY_GLOSSINESS_FACTOR, glossiness);
+                 if (result == aiReturn_SUCCESS)
+                     QSSGQmlUtilities::writeQmlPropertyHelper(output,
+                                                              tabLevel + 1,
+@@ -1560,7 +1558,7 @@ QString AssimpImporter::generateImage(aiMaterial *material, aiTextureType textur
+ 
+     if (m_gltfMode) {
+         uint gltfUvIndex = 0;
+-        result = material->Get(AI_MATKEY_GLTF_TEXTURE_TEXCOORD(textureType, index), gltfUvIndex);
++        result = material->Get(AI_MATKEY_UVWSRC(textureType, index), gltfUvIndex);
+         if (result == aiReturn_SUCCESS)
+             uvIndex = gltfUvIndex;
+     }
+diff --git a/src/plugins/assetimporters/assimp/assimpimporter_rt.cpp b/src/plugins/assetimporters/assimp/assimpimporter_rt.cpp
+index c3c77d7e..90aee0c5 100644
+--- a/src/plugins/assetimporters/assimp/assimpimporter_rt.cpp
++++ b/src/plugins/assetimporters/assimp/assimpimporter_rt.cpp
+@@ -344,7 +344,7 @@ static void setMaterialProperties(QSSGSceneDesc::Material &target, const aiMater
+                     texInfo.transform = &transform;
+ 
+                 if (sceneInfo.ver == SceneInfo::GltfVersion::v2) {
+-                    material.Get(AI_MATKEY_GLTF_TEXTURE_TEXCOORD(textureType, index), texInfo.uvIndex);
++                    material.Get(AI_MATKEY_UVWSRC(textureType, index), texInfo.uvIndex);
+                     material.Get(AI_MATKEY_GLTF_MAPPINGFILTER_MIN(textureType, index), texInfo.minFilter);
+                     material.Get(AI_MATKEY_GLTF_MAPPINGFILTER_MAG(textureType, index), texInfo.magFilter);
+                 }
+@@ -414,12 +414,12 @@ static void setMaterialProperties(QSSGSceneDesc::Material &target, const aiMater
+         aiReturn result;
+         {
+             aiColor4D baseColorFactor;
+-            result = source.Get(AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_FACTOR, baseColorFactor);
++            result = source.Get(AI_MATKEY_BASE_COLOR, baseColorFactor);
+             if (result == aiReturn_SUCCESS)
+                 QSSGSceneDesc::setProperty(target, "baseColor", &QQuick3DPrincipledMaterial::setBaseColor, aiColorToQColor(baseColorFactor));
+         }
+ 
+-        if (auto baseColorTexture = createTextureNode(source, AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_TEXTURE)) {
++        if (auto baseColorTexture = createTextureNode(source, aiTextureType_BASE_COLOR, 0)) {
+             QSSGSceneDesc::setProperty(target, "baseColorMap", &QQuick3DPrincipledMaterial::setBaseColorMap, baseColorTexture);
+             QSSGSceneDesc::setProperty(target, "opacityChannel", &QQuick3DPrincipledMaterial::setOpacityChannel, QQuick3DPrincipledMaterial::TextureChannelMapping::A);
+         }
+@@ -433,14 +433,14 @@ static void setMaterialProperties(QSSGSceneDesc::Material &target, const aiMater
+ 
+         {
+             ai_real metallicFactor;
+-            result = source.Get(AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLIC_FACTOR, metallicFactor);
++            result = source.Get(AI_MATKEY_METALLIC_FACTOR, metallicFactor);
+             if (result == aiReturn_SUCCESS)
+                 QSSGSceneDesc::setProperty(target, "metalness", &QQuick3DPrincipledMaterial::setMetalness, float(metallicFactor));
+         }
+ 
+         {
+             ai_real roughnessFactor;
+-            result = source.Get(AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_ROUGHNESS_FACTOR, roughnessFactor);
++            result = source.Get(AI_MATKEY_ROUGHNESS_FACTOR, roughnessFactor);
+             if (result == aiReturn_SUCCESS)
+                 QSSGSceneDesc::setProperty(target, "roughness", &QQuick3DPrincipledMaterial::setRoughness, float(roughnessFactor));
+         }
+@@ -509,9 +509,9 @@ static void setMaterialProperties(QSSGSceneDesc::Material &target, const aiMater
+         }
+ 
+         {
+-            bool isUnlit = false;
+-            result = source.Get(AI_MATKEY_GLTF_UNLIT, isUnlit);
+-            if (result == aiReturn_SUCCESS && isUnlit)
++            aiShadingMode shadingMode;
++            source.Get(AI_MATKEY_SHADING_MODEL, shadingMode);
++            if (shadingMode == aiShadingMode_Unlit)
+                 QSSGSceneDesc::setProperty(target, "lighting", &QQuick3DPrincipledMaterial::setLighting, QQuick3DPrincipledMaterial::Lighting::NoLighting);
+         }
+     } else { // Ver1



More information about the arch-commits mailing list