mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-14 14:29:52 -05:00
81 lines
2.8 KiB
C#
81 lines
2.8 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using NUnit.Framework;
|
|
using UniGLTF;
|
|
|
|
|
|
namespace VRM
|
|
{
|
|
|
|
public class VRMTextureEnumerateTests
|
|
{
|
|
/// <summary>
|
|
/// Test uniqueness
|
|
/// </summary>
|
|
[Test]
|
|
public void TextureEnumerationTest()
|
|
{
|
|
{
|
|
var parser = new GltfParser
|
|
{
|
|
GLTF = new glTF
|
|
{
|
|
images = new List<glTFImage>
|
|
{
|
|
new glTFImage{
|
|
mimeType = "image/png",
|
|
}
|
|
},
|
|
textures = new List<glTFTexture>
|
|
{
|
|
new glTFTexture{
|
|
name = "texture0",
|
|
source = 0,
|
|
}
|
|
},
|
|
materials = new List<glTFMaterial>
|
|
{
|
|
new glTFMaterial{
|
|
pbrMetallicRoughness = new glTFPbrMetallicRoughness{
|
|
baseColorTexture = new glTFMaterialBaseColorTextureInfo{
|
|
index = 0,
|
|
}
|
|
}
|
|
},
|
|
new glTFMaterial{
|
|
pbrMetallicRoughness = new glTFPbrMetallicRoughness{
|
|
baseColorTexture = new glTFMaterialBaseColorTextureInfo{
|
|
index = 0,
|
|
}
|
|
}
|
|
},
|
|
}
|
|
}
|
|
};
|
|
var vrm = new glTF_VRM_extensions
|
|
{
|
|
materialProperties = new List<glTF_VRM_Material>
|
|
{
|
|
new glTF_VRM_Material
|
|
{
|
|
textureProperties = new Dictionary<string, int>
|
|
{
|
|
{"_MainTex", 0},
|
|
}
|
|
},
|
|
new glTF_VRM_Material
|
|
{
|
|
textureProperties = new Dictionary<string, int>
|
|
{
|
|
{"_MainTex", 0},
|
|
}
|
|
},
|
|
}
|
|
};
|
|
var items = new VrmTextureDescriptorGenerator(parser, vrm).Get().GetEnumerable().ToArray();
|
|
Assert.AreEqual(1, items.Length);
|
|
}
|
|
}
|
|
}
|
|
}
|