mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-07-30 22:46:44 -05:00
SamplerParam
This commit is contained in:
parent
cec296af9c
commit
b63c165f5d
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
11
Assets/VRMShaders/Runtime/SamplerParam.cs
Normal file
11
Assets/VRMShaders/Runtime/SamplerParam.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using UnityEngine;
|
||||
|
||||
|
||||
namespace VRMShaders
|
||||
{
|
||||
public struct SamplerParam
|
||||
{
|
||||
public (SamplerWrapType, TextureWrapMode)[] WrapModes;
|
||||
public FilterMode FilterMode;
|
||||
}
|
||||
}
|
||||
11
Assets/VRMShaders/Runtime/SamplerParam.cs.meta
Normal file
11
Assets/VRMShaders/Runtime/SamplerParam.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 85fc44cc7e2cb4048866c1e3dfdcf6e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue
Block a user