SamplerParam

This commit is contained in:
ousttrue 2021-03-24 16:26:41 +09:00
parent cec296af9c
commit b63c165f5d
4 changed files with 28 additions and 12 deletions

View File

@ -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),

View File

@ -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
/// </summary>
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,

View File

@ -0,0 +1,11 @@
using UnityEngine;
namespace VRMShaders
{
public struct SamplerParam
{
public (SamplerWrapType, TextureWrapMode)[] WrapModes;
public FilterMode FilterMode;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 85fc44cc7e2cb4048866c1e3dfdcf6e0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: