mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-21 07:17:53 +01:00
Improve fallback handling
This commit is contained in:
parent
a6788c6dd3
commit
5e6ca8b22c
1 changed files with 19 additions and 10 deletions
|
|
@ -158,6 +158,14 @@ public class MaterialExporter
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ref struct TableRow
|
||||||
|
{
|
||||||
|
public int Stepped;
|
||||||
|
public int Previous;
|
||||||
|
public int Next;
|
||||||
|
public float Weight;
|
||||||
|
}
|
||||||
|
|
||||||
private readonly struct MultiplyOperation
|
private readonly struct MultiplyOperation
|
||||||
{
|
{
|
||||||
public static void Execute<TPixel1, TPixel2>(Image<TPixel1> target, Image<TPixel2> multiplier)
|
public static void Execute<TPixel1, TPixel2>(Image<TPixel1> target, Image<TPixel2> multiplier)
|
||||||
|
|
@ -320,20 +328,21 @@ public class MaterialExporter
|
||||||
.WithAlpha(isFace? AlphaMode.MASK : AlphaMode.OPAQUE, 0.5f);
|
.WithAlpha(isFace? AlphaMode.MASK : AlphaMode.OPAQUE, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ref struct TableRow
|
|
||||||
{
|
|
||||||
public int Stepped;
|
|
||||||
public int Previous;
|
|
||||||
public int Next;
|
|
||||||
public float Weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static MaterialBuilder BuildFallback(Material material, string name)
|
private static MaterialBuilder BuildFallback(Material material, string name)
|
||||||
{
|
{
|
||||||
Penumbra.Log.Warning($"Unhandled shader package: {material.Mtrl.ShaderPackage.Name}");
|
Penumbra.Log.Warning($"Unhandled shader package: {material.Mtrl.ShaderPackage.Name}");
|
||||||
return BuildSharedBase(material, name)
|
|
||||||
|
var materialBuilder = BuildSharedBase(material, name)
|
||||||
.WithMetallicRoughnessShader()
|
.WithMetallicRoughnessShader()
|
||||||
.WithChannelParam(KnownChannel.BaseColor, KnownProperty.RGBA, Vector4.One);
|
.WithBaseColor(Vector4.One);
|
||||||
|
|
||||||
|
if (material.Textures.TryGetValue(TextureUsage.SamplerDiffuse, out var diffuse))
|
||||||
|
materialBuilder.WithBaseColor(BuildImage(diffuse, name, "basecolor"));
|
||||||
|
|
||||||
|
if (material.Textures.TryGetValue(TextureUsage.SamplerNormal, out var normal))
|
||||||
|
materialBuilder.WithNormal(BuildImage(normal, name, "normal"));
|
||||||
|
|
||||||
|
return materialBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MaterialBuilder BuildSharedBase(Material material, string name)
|
private static MaterialBuilder BuildSharedBase(Material material, string name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue