mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-14 14:29:52 -05:00
36 lines
864 B
C#
36 lines
864 B
C#
using UnityEngine;
|
|
|
|
|
|
namespace VRMShaders
|
|
{
|
|
public struct SamplerParam
|
|
{
|
|
public TextureWrapMode WrapModesU;
|
|
|
|
public TextureWrapMode WrapModesV;
|
|
|
|
public FilterMode FilterMode;
|
|
|
|
public static SamplerParam Default => new SamplerParam
|
|
{
|
|
FilterMode = FilterMode.Bilinear,
|
|
WrapModesU = TextureWrapMode.Repeat,
|
|
WrapModesV = TextureWrapMode.Repeat,
|
|
};
|
|
}
|
|
|
|
public static class SamplerParamExtensions
|
|
{
|
|
public static void SetSampler(this Texture2D texture, in SamplerParam param)
|
|
{
|
|
if (texture == null)
|
|
{
|
|
return;
|
|
}
|
|
texture.wrapModeU = param.WrapModesU;
|
|
texture.wrapModeV = param.WrapModesV;
|
|
texture.filterMode = param.FilterMode;
|
|
}
|
|
}
|
|
}
|