From 2d2e2ff4038db052d0186645f5afe4ec9daf2505 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Wed, 24 Apr 2019 04:17:16 +0200 Subject: use boolean for tex0 and tex1 availability tests --- vke/src/glTFLoader.cs | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'vke/src/glTFLoader.cs') diff --git a/vke/src/glTFLoader.cs b/vke/src/glTFLoader.cs index b51cd3c..ce6b8d8 100644 --- a/vke/src/glTFLoader.cs +++ b/vke/src/glTFLoader.cs @@ -486,37 +486,48 @@ namespace CVKL { if (mat.EmissiveTexture != null) { pbr.emissiveTexture = (uint)mat.EmissiveTexture.Index; - pbr.texCoordSets.emissive = (byte)mat.EmissiveTexture.TexCoord; - pbr.availableAttachments |= AttachmentType.Emissive; + if (mat.EmissiveTexture.TexCoord == 1) + pbr.availableAttachments1 |= AttachmentType.Emissive; + else + pbr.availableAttachments |= AttachmentType.Emissive; } if (mat.NormalTexture != null) { pbr.normalTexture = (uint)mat.NormalTexture.Index; - pbr.texCoordSets.normal = (byte)mat.NormalTexture.TexCoord; - pbr.availableAttachments |= AttachmentType.Normal; + if (mat.NormalTexture.TexCoord == 1) + pbr.availableAttachments1 |= AttachmentType.Normal; + else + pbr.availableAttachments |= AttachmentType.Normal; } if (mat.OcclusionTexture != null) { pbr.occlusionTexture = (uint)mat.OcclusionTexture.Index; - pbr.texCoordSets.occlusion = (byte)mat.OcclusionTexture.TexCoord; - pbr.availableAttachments |= AttachmentType.AmbientOcclusion; + if (mat.OcclusionTexture.TexCoord == 1) + pbr.availableAttachments1 |= AttachmentType.AmbientOcclusion; + else + pbr.availableAttachments |= AttachmentType.AmbientOcclusion; } if (mat.PbrMetallicRoughness != null) { if (mat.PbrMetallicRoughness.BaseColorTexture != null) { - pbr.texCoordSets.baseColor = (byte)mat.PbrMetallicRoughness.BaseColorTexture.TexCoord; pbr.baseColorTexture = (uint)mat.PbrMetallicRoughness.BaseColorTexture.Index; - pbr.availableAttachments |= VK.AttachmentType.Color; + if (mat.PbrMetallicRoughness.BaseColorTexture.TexCoord == 1) + pbr.availableAttachments1 |= AttachmentType.Color; + else + pbr.availableAttachments |= AttachmentType.Color; } FromFloatArray (ref pbr.baseColorFactor, mat.PbrMetallicRoughness.BaseColorFactor); if (mat.PbrMetallicRoughness.MetallicRoughnessTexture != null) { - pbr.texCoordSets.metallicRoughness = (byte)mat.PbrMetallicRoughness.MetallicRoughnessTexture.TexCoord; pbr.metallicRoughnessTexture = (uint)mat.PbrMetallicRoughness.MetallicRoughnessTexture.Index; - pbr.availableAttachments |= VK.AttachmentType.MetalRoughness; - + if (mat.PbrMetallicRoughness.MetallicRoughnessTexture.TexCoord == 1) + pbr.availableAttachments1 |= AttachmentType.PhysicalProps; + else + pbr.availableAttachments |= AttachmentType.PhysicalProps; } pbr.metallicFactor = mat.PbrMetallicRoughness.MetallicFactor; pbr.roughnessFactor = mat.PbrMetallicRoughness.RoughnessFactor; + + pbr.workflow = Material.Workflow.PhysicalyBaseRendering; } materials.Add (pbr); /* -- cgit v1.3.1-4-g156e