mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-05 12:46:32 -05:00
35 lines
824 B
C#
35 lines
824 B
C#
using UnityEngine;
|
|
|
|
namespace VRMShaders
|
|
{
|
|
internal static class TextureExtensions
|
|
{
|
|
public static bool HasMipMap(this Texture texture)
|
|
{
|
|
if (texture is Texture2D t2)
|
|
{
|
|
return t2.mipmapCount > 1;
|
|
}
|
|
else if (texture is RenderTexture rt)
|
|
{
|
|
return rt.useMipMap;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|