mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-10-01 07:11:02 -05:00
Merge pull request #218 from dwango/fix/propage_texture_properties
問題無いです
This commit is contained in:
34
Assets/VRM/UniGLTF/Editor/Tests/TextureTests.cs
Normal file
34
Assets/VRM/UniGLTF/Editor/Tests/TextureTests.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
public class TextureTests
|
||||
{
|
||||
[Test]
|
||||
public void TextureExportTest()
|
||||
{
|
||||
// Dummy texture
|
||||
var tex0 = new Texture2D(128, 128)
|
||||
{
|
||||
wrapMode = TextureWrapMode.Clamp,
|
||||
filterMode = FilterMode.Trilinear,
|
||||
};
|
||||
var textureManager = new TextureExportManager(new Texture[] {tex0});
|
||||
|
||||
var material = new Material(Shader.Find("Standard"));
|
||||
material.mainTexture = tex0;
|
||||
|
||||
var materialExporter = new MaterialExporter();
|
||||
materialExporter.ExportMaterial(material, textureManager);
|
||||
|
||||
var convTex0 = textureManager.GetExportTexture(0);
|
||||
var sampler = TextureSamplerUtil.Export(convTex0);
|
||||
|
||||
Assert.AreEqual(glWrap.CLAMP_TO_EDGE, sampler.wrapS);
|
||||
Assert.AreEqual(glWrap.CLAMP_TO_EDGE, sampler.wrapT);
|
||||
Assert.AreEqual(glFilter.LINEAR_MIPMAP_LINEAR, sampler.minFilter);
|
||||
Assert.AreEqual(glFilter.LINEAR_MIPMAP_LINEAR, sampler.magFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/VRM/UniGLTF/Editor/Tests/TextureTests.cs.meta
Normal file
12
Assets/VRM/UniGLTF/Editor/Tests/TextureTests.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 195a45a1caf480e41a7af798f30520f0
|
||||
timeCreated: 1552296844
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -283,6 +283,15 @@ namespace UniGLTF
|
||||
dst = new Texture2D(src.width, src.height, TextureFormat.ARGB32, false, colorSpace == RenderTextureReadWrite.Linear);
|
||||
dst.ReadPixels(new Rect(0, 0, src.width, src.height), 0, 0);
|
||||
dst.name = src.name;
|
||||
dst.anisoLevel = src.anisoLevel;
|
||||
dst.filterMode = src.filterMode;
|
||||
dst.mipMapBias = src.mipMapBias;
|
||||
dst.wrapMode = src.wrapMode;
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
dst.wrapModeU = src.wrapModeU;
|
||||
dst.wrapModeV = src.wrapModeV;
|
||||
dst.wrapModeW = src.wrapModeW;
|
||||
#endif
|
||||
dst.Apply();
|
||||
|
||||
RenderTexture.active = null;
|
||||
|
||||
@@ -225,6 +225,7 @@ namespace UniGLTF
|
||||
case TextureWrapMode.Clamp:
|
||||
return glWrap.CLAMP_TO_EDGE;
|
||||
|
||||
case (TextureWrapMode)(-1):
|
||||
case TextureWrapMode.Repeat:
|
||||
return glWrap.REPEAT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user