diff --git a/CHANGELOG.md b/CHANGELOG.md
index d3789c4..53d622b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+#1.1.7
+- Updated gltfast to 6.16.1
+
#1.1.5
- Updated gltfast to 5.0.0
diff --git a/Runtime/GLTFastWrappers/DecentralandMaterialGenerator.cs b/Runtime/GLTFastWrappers/DecentralandMaterialGenerator.cs
index 98813ad..b392760 100644
--- a/Runtime/GLTFastWrappers/DecentralandMaterialGenerator.cs
+++ b/Runtime/GLTFastWrappers/DecentralandMaterialGenerator.cs
@@ -35,15 +35,15 @@ public DecentralandMaterialGenerator(string shaderName, bool preserveMaxAlpha =
///
///
///
- public override Material GenerateMaterial(int materialIndex, GLTFastMaterial gltfMaterial, IGltfReadable gltf, bool pointsSupport = false)
+ public override Material GenerateMaterial(MaterialBase gltfMaterial, IGltfReadable gltf, bool pointsSupport = false)
{
material = new Material(_shader);
- SetMaterialName(materialIndex, gltfMaterial);
+ SetMaterialName(gltfMaterial);
- if (gltfMaterial.extensions?.KHR_materials_pbrSpecularGlossiness != null)
+ if (gltfMaterial.Extensions?.KHR_materials_pbrSpecularGlossiness != null)
{
- var specGloss = gltfMaterial.extensions.KHR_materials_pbrSpecularGlossiness;
+ var specGloss = gltfMaterial.Extensions.KHR_materials_pbrSpecularGlossiness;
SetColor(specGloss.DiffuseColor.gamma);
SetSpecularColor(specGloss.SpecularColor);
@@ -56,21 +56,21 @@ public override Material GenerateMaterial(int materialIndex, GLTFastMaterial glt
// (according to extension specification)
else
{
- PbrMetallicRoughness roughness = gltfMaterial.pbrMetallicRoughness;
+ PbrMetallicRoughnessBase roughness = gltfMaterial.PbrMetallicRoughness;
if (roughness != null)
{
SetColor(roughness.BaseColor.gamma);
- SetBaseMapTexture(roughness.baseColorTexture, gltf);
+ SetBaseMapTexture(roughness.BaseColorTexture, gltf);
SetMetallic(roughness.metallicFactor);
- SetMetallicRoughnessTexture(gltf, roughness.metallicRoughnessTexture, roughness.roughnessFactor);
+ SetMetallicRoughnessTexture(gltf, roughness.MetallicRoughnessTexture, roughness.roughnessFactor);
}
}
- SetBumpMapTexture(gltfMaterial.normalTexture, gltf);
- SetOcclusionTexture(gltfMaterial.occlusionTexture, gltf);
+ SetBumpMapTexture(gltfMaterial.NormalTexture, gltf);
+ SetOcclusionTexture(gltfMaterial.OcclusionTexture, gltf);
SetEmissiveColor(gltfMaterial.Emissive);
- SetEmissiveTexture(gltfMaterial.emissiveTexture, gltf);
+ SetEmissiveTexture(gltfMaterial.EmissiveTexture, gltf);
SetAlphaMode(gltfMaterial.GetAlphaMode(), gltfMaterial.alphaCutoff);
SetDoubleSided(gltfMaterial.doubleSided);
@@ -79,7 +79,7 @@ public override Material GenerateMaterial(int materialIndex, GLTFastMaterial glt
}
// This step is important if we want to keep the functionality of skin and hair colouring
- private void SetMaterialName(int materialIndex, GLTFastMaterial gltfMaterial)
+ private void SetMaterialName(MaterialBase gltfMaterial)
{
material.name = "material";
@@ -93,8 +93,6 @@ private void SetMaterialName(int materialIndex, GLTFastMaterial gltfMaterial)
if (originalName.Contains("hair"))
material.name += "_hair";
}
-
- material.name += $"_{materialIndex}";
}
private void SetEmissiveColor(Color gltfMaterialEmissive)
@@ -107,7 +105,7 @@ private void SetEmissiveColor(Color gltfMaterialEmissive)
}
}
- private void SetEmissiveTexture(TextureInfo emissiveTexture, IGltfReadable gltf)
+ private void SetEmissiveTexture(TextureInfoBase emissiveTexture, IGltfReadable gltf)
{
if (TrySetTexture(
emissiveTexture,
@@ -124,7 +122,7 @@ private void SetEmissiveTexture(TextureInfo emissiveTexture, IGltfReadable gltf)
}
}
- private void SetOcclusionTexture(OcclusionTextureInfo occlusionTexture, IGltfReadable gltf)
+ private void SetOcclusionTexture(OcclusionTextureInfoBase occlusionTexture, IGltfReadable gltf)
{
if (TrySetTexture(
occlusionTexture,
@@ -141,7 +139,7 @@ private void SetOcclusionTexture(OcclusionTextureInfo occlusionTexture, IGltfRea
}
}
- private void SetBumpMapTexture(NormalTextureInfo textureInfo, IGltfReadable gltf)
+ private void SetBumpMapTexture(NormalTextureInfoBase textureInfo, IGltfReadable gltf)
{
if (TrySetTexture(
textureInfo,
@@ -159,7 +157,7 @@ private void SetBumpMapTexture(NormalTextureInfo textureInfo, IGltfReadable gltf
}
}
- private void SetMetallicRoughnessTexture(IGltfReadable gltf, TextureInfo textureInfo, float roughnessFactor)
+ private void SetMetallicRoughnessTexture(IGltfReadable gltf, TextureInfoBase textureInfo, float roughnessFactor)
{
if (TrySetTexture(
textureInfo,
@@ -204,7 +202,7 @@ private void SetSpecularMapTexture(TextureInfo textureInfo, IGltfReadable gltf)
}
}
- private void SetBaseMapTexture(TextureInfo textureInfo, IGltfReadable gltf)
+ private void SetBaseMapTexture(TextureInfoBase textureInfo, IGltfReadable gltf)
{
TrySetTexture(
textureInfo,
diff --git a/Runtime/GLTFastWrappers/DefaultMaterialGenerator.cs b/Runtime/GLTFastWrappers/DefaultMaterialGenerator.cs
index 80e95d2..2648cb3 100644
--- a/Runtime/GLTFastWrappers/DefaultMaterialGenerator.cs
+++ b/Runtime/GLTFastWrappers/DefaultMaterialGenerator.cs
@@ -1,7 +1,9 @@
using GLTFast;
using GLTFast.Materials;
+using GLTFast.Schema;
using System;
using UnityEngine;
+using Material = UnityEngine.Material;
namespace DCL.GLTFast.Wrappers
{
@@ -13,28 +15,26 @@ internal class DefaultMaterialGenerator : ShaderGraphMaterialGenerator
{
private const float CUSTOM_EMISSIVE_FACTOR = 5f;
- public override Material GenerateMaterial(int materialIndex, global::GLTFast.Schema.Material gltfMaterial, IGltfReadable gltf, bool pointsSupport = false)
+ public override Material GenerateMaterial(MaterialBase gltfMaterial, IGltfReadable gltf, bool pointsSupport = false)
{
- Material generatedMaterial = base.GenerateMaterial(materialIndex, gltfMaterial, gltf);
+ Material generatedMaterial = base.GenerateMaterial(gltfMaterial, gltf, pointsSupport);
- SetMaterialName(generatedMaterial, materialIndex, gltfMaterial);
+ SetMaterialName(generatedMaterial, gltfMaterial);
- if (gltfMaterial.Emissive != Color.black) { generatedMaterial.SetColor(EmissiveFactorProperty, gltfMaterial.Emissive * CUSTOM_EMISSIVE_FACTOR); }
+ if (gltfMaterial.Emissive != Color.black) { generatedMaterial.SetColor(MaterialProperty.EmissiveFactor, gltfMaterial.Emissive * CUSTOM_EMISSIVE_FACTOR); }
return generatedMaterial;
// This step is important if we want to keep the functionality of skin and hair colouring
- void SetMaterialName(Material material, int materialIndex, global::GLTFast.Schema.Material gltfMaterial)
+ void SetMaterialName(Material material, MaterialBase materialBase)
{
material.name = "material";
- if (gltfMaterial.name.Contains("skin", StringComparison.InvariantCultureIgnoreCase))
+ if (materialBase.name.Contains("skin", StringComparison.InvariantCultureIgnoreCase))
material.name += "_skin";
- if (gltfMaterial.name.Contains("hair", StringComparison.InvariantCultureIgnoreCase))
+ if (materialBase.name.Contains("hair", StringComparison.InvariantCultureIgnoreCase))
material.name += "_hair";
-
- material.name += $"_{materialIndex}";
}
}
}
diff --git a/package.json b/package.json
index 2e35c51..6459232 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "com.decentraland.unity-shared-dependencies",
- "version": "1.1.6",
+ "version": "1.1.7",
"displayName": "Decentraland.SharedDependencies",
"description": "This package contains shared dependencies between unity-renderer, aang-renderer and asset-bundle-converter repositories, this includes gltf importer wrappers, shaders and wearable utils",
"unity": "2021.3",