diff options
Diffstat (limited to 'vke')
| -rw-r--r-- | vke/src/Model.cs | 18 | ||||
| -rw-r--r-- | vke/src/PbrModel.cs | 4 | ||||
| -rw-r--r-- | vke/src/VertexAttribute.cs | 2 | ||||
| -rw-r--r-- | vke/src/glTFLoader.cs | 33 |
4 files changed, 30 insertions, 27 deletions
diff --git a/vke/src/Model.cs b/vke/src/Model.cs index 0958998..c27819e 100644 --- a/vke/src/Model.cs +++ b/vke/src/Model.cs @@ -186,22 +186,14 @@ namespace CVKL { // public UInt32 emissiveTexture; //} - public struct TexCoordSets { - public byte baseColor; - public byte metallicRoughness; - public byte specularGlossiness; - public byte normal; - public byte occlusion; - public byte emissive; - } - /// <summary> /// Material class with textures indices and a descriptorSet for those textures /// </summary> public class Material { + public enum Workflow { PhysicalyBaseRendering = 1, SpecularGlossinnes }; public string Name; - + public Workflow workflow; public UInt32 baseColorTexture; public UInt32 metallicRoughnessTexture; public UInt32 normalTexture; @@ -210,7 +202,8 @@ namespace CVKL { public Vector4 baseColorFactor; public Vector4 emissiveFactor; - public VK.AttachmentType availableAttachments; + public AttachmentType availableAttachments; + public AttachmentType availableAttachments1; public AlphaMode alphaMode; public float alphaCutoff; public float metallicFactor; @@ -219,8 +212,6 @@ namespace CVKL { public bool metallicRoughness = true; public bool specularGlossiness = false; - public TexCoordSets texCoordSets; - //struct Extension { // vkglTF::Texture* specularGlossinessTexture; // vkglTF::Texture* diffuseTexture; @@ -232,6 +223,7 @@ namespace CVKL { public Material (UInt32 _baseColorTexture = 0, UInt32 _metallicRoughnessTexture = 0, UInt32 _normalTexture = 0, UInt32 _occlusionTexture = 0) { + workflow = Workflow.PhysicalyBaseRendering; baseColorTexture = _baseColorTexture; metallicRoughnessTexture = _metallicRoughnessTexture; normalTexture = _normalTexture; diff --git a/vke/src/PbrModel.cs b/vke/src/PbrModel.cs index 96437a2..26f720e 100644 --- a/vke/src/PbrModel.cs +++ b/vke/src/PbrModel.cs @@ -160,8 +160,8 @@ namespace CVKL { if (materials[i].availableAttachments.HasFlag (AttachmentType.AmbientOcclusion)) uboUpdate.AddWriteInfo (descriptorSets[i], dslb, textures[(int)mats[i].occlusionTexture].Descriptor); break; - case AttachmentType.MetalRoughness: - if (materials[i].availableAttachments.HasFlag (AttachmentType.MetalRoughness)) + case AttachmentType.PhysicalProps: + if (materials[i].availableAttachments.HasFlag (AttachmentType.PhysicalProps)) uboUpdate.AddWriteInfo (descriptorSets[i], dslb, textures[(int)mats[i].metallicRoughnessTexture].Descriptor); break; case AttachmentType.Metal: diff --git a/vke/src/VertexAttribute.cs b/vke/src/VertexAttribute.cs index 97a25bc..b69806e 100644 --- a/vke/src/VertexAttribute.cs +++ b/vke/src/VertexAttribute.cs @@ -42,7 +42,7 @@ namespace VK { AmbientOcclusion = 0x4, Metal = 0x8, Roughness = 0x10, - MetalRoughness = 0x20, + PhysicalProps = 0x20, Emissive = 0x40, }; 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); /* |