From b63c165f5d063a427213f08dc829f2dbbbd79477 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 24 Mar 2021 16:26:41 +0900 Subject: [PATCH] SamplerParam --- .../Runtime/UniGLTF/IO/TextureIO/TextureFactory.cs | 8 ++++---- Assets/VRMShaders/Runtime/GetTextureParam.cs | 10 ++-------- Assets/VRMShaders/Runtime/SamplerParam.cs | 11 +++++++++++ Assets/VRMShaders/Runtime/SamplerParam.cs.meta | 11 +++++++++++ 4 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 Assets/VRMShaders/Runtime/SamplerParam.cs create mode 100644 Assets/VRMShaders/Runtime/SamplerParam.cs.meta diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/TextureFactory.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/TextureFactory.cs index 7a7738576..10356c019 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/TextureFactory.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/TextureFactory.cs @@ -296,7 +296,7 @@ namespace UniGLTF GetTextureParam.NameExt name = default; GetTextureBytesAsync getMetallicRoughnessAsync = default; - GetTextureParam.TextureSamplerParam sampler = default; + SamplerParam sampler = default; if (metallicRoughnessTextureIndex.HasValue) { name = CreateNameExt(parser.GLTF, metallicRoughnessTextureIndex.Value, TextureImportTypes.StandardMap); @@ -349,13 +349,13 @@ namespace UniGLTF return new GetTextureParam.NameExt(gltfTexture.name, convertedName, gltfImage.GetExt(), gltfImage.uri); } - public static GetTextureParam.TextureSamplerParam CreateSampler(glTF gltf, int index) + public static SamplerParam CreateSampler(glTF gltf, int index) { var gltfTexture = gltf.textures[index]; if (gltfTexture.sampler < 0 || gltfTexture.sampler >= gltf.samplers.Count) { // default - return new GetTextureParam.TextureSamplerParam + return new SamplerParam { FilterMode = FilterMode.Bilinear, WrapModes = new (SamplerWrapType, TextureWrapMode)[] { }, @@ -363,7 +363,7 @@ namespace UniGLTF } var gltfSampler = gltf.samplers[gltfTexture.sampler]; - return new GetTextureParam.TextureSamplerParam + return new SamplerParam { WrapModes = GetUnityWrapMode(gltfSampler).ToArray(), FilterMode = ImportFilterMode(gltfSampler.minFilter), diff --git a/Assets/VRMShaders/Runtime/GetTextureParam.cs b/Assets/VRMShaders/Runtime/GetTextureParam.cs index 9f1a4314b..357019a5f 100644 --- a/Assets/VRMShaders/Runtime/GetTextureParam.cs +++ b/Assets/VRMShaders/Runtime/GetTextureParam.cs @@ -73,13 +73,7 @@ namespace VRMShaders public string ConvertedFileName => Name.ConvertedFileName; public string Uri => Name.Uri; - public struct TextureSamplerParam - { - public (SamplerWrapType, TextureWrapMode)[] WrapModes; - public FilterMode FilterMode; - } - - public TextureSamplerParam Sampler; + public SamplerParam Sampler; public readonly TextureImportTypes TextureType; public readonly float MetallicFactor; @@ -97,7 +91,7 @@ namespace VRMShaders /// public bool ExtractConverted => TextureType == TextureImportTypes.StandardMap; - public GetTextureParam(NameExt name, TextureSamplerParam sampler, TextureImportTypes textureType, float metallicFactor, float roughnessFactor, + public GetTextureParam(NameExt name, SamplerParam sampler, TextureImportTypes textureType, float metallicFactor, float roughnessFactor, GetTextureBytesAsync i0, GetTextureBytesAsync i1, GetTextureBytesAsync i2, diff --git a/Assets/VRMShaders/Runtime/SamplerParam.cs b/Assets/VRMShaders/Runtime/SamplerParam.cs new file mode 100644 index 000000000..74a867e7f --- /dev/null +++ b/Assets/VRMShaders/Runtime/SamplerParam.cs @@ -0,0 +1,11 @@ +using UnityEngine; + + +namespace VRMShaders +{ + public struct SamplerParam + { + public (SamplerWrapType, TextureWrapMode)[] WrapModes; + public FilterMode FilterMode; + } +} diff --git a/Assets/VRMShaders/Runtime/SamplerParam.cs.meta b/Assets/VRMShaders/Runtime/SamplerParam.cs.meta new file mode 100644 index 000000000..eb8df0404 --- /dev/null +++ b/Assets/VRMShaders/Runtime/SamplerParam.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 85fc44cc7e2cb4048866c1e3dfdcf6e0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: