Merge branch 'master' of https://github.com/vrm-c/UniVRM into maintainExtensionSupportFlags

This commit is contained in:
Masataka SUMI
2024-07-11 00:07:48 +09:00

View File

@@ -32,6 +32,7 @@ namespace VRM
ExportRenderingSettings(srcProps, dst);
ExportBaseColor(src, srcProps, textureExporter, dst);
ExportEmission(src, srcProps, textureExporter, dst);
ExportNormal(src, srcProps, textureExporter, dst);
return true;
}
@@ -116,6 +117,23 @@ namespace VRM
}
}
private static void ExportNormal(Material srcMaterial, MToonDefinition src, ITextureExporter textureExporter, glTFMaterial dst)
{
if (src.Lighting.Normal.NormalTexture != null)
{
var index = textureExporter.RegisterExportingAsNormal(src.Lighting.Normal.NormalTexture);
if (index != -1)
{
dst.normalTexture = new glTFMaterialNormalTextureInfo()
{
index = index,
scale = src.Lighting.Normal.NormalScaleValue,
};
ExportMainTextureTransform(srcMaterial, dst.normalTexture);
}
}
}
private static void ExportMainTextureTransform(Material src, glTFTextureInfo targetTextureInfo)
{
GltfMaterialExportUtils.ExportTextureTransform(src, targetTextureInfo, MToon.Utils.PropMainTex);