コミット漏れと mipmapCount

This commit is contained in:
ousttrue
2021-05-24 15:51:31 +09:00
parent 78a3b02189
commit 207b4e1a6a
4 changed files with 45 additions and 1 deletions

View File

@@ -26,7 +26,7 @@ namespace UniGLTF
public static glFilter ExportMinFilter(Texture2D texture)
{
if (texture.mipmapCount > 0)
if (texture.mipmapCount > 1)
{
switch (texture.filterMode)
{

View File

@@ -38,6 +38,14 @@ namespace VRMShaders
textureImporter.SaveAndReimport();
}
public static void ConfigureSampler(TextureImportParam param, TextureImporter textureImporter)
{
textureImporter.mipmapEnabled = param.Sampler.EnableMipMap;
textureImporter.filterMode = param.Sampler.FilterMode;
textureImporter.wrapModeU = param.Sampler.WrapModesU;
textureImporter.wrapModeV = param.Sampler.WrapModesV;
}
class ImporterGetter : IDisposable
{
public TextureImporter Importer;
@@ -110,6 +118,8 @@ namespace VRMShaders
default:
throw new NotImplementedException();
}
ConfigureSampler(textureInfo, importer);
}
public static void Configure(TextureImportParam textureInfo, IDictionary<string, Texture2D> ExternalMap)

View File

@@ -0,0 +1,23 @@
using UnityEngine;
namespace VRMShaders
{
public 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;
}
}
}
}

View File

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