Minor upgrades to follow dependencies

This commit is contained in:
Exter-N 2024-08-03 17:31:12 +02:00
parent 60986c78f8
commit 59b3859f11
4 changed files with 10 additions and 15 deletions

View file

@ -49,7 +49,7 @@ public class MaterialExporter
private static MaterialBuilder BuildCharacter(Material material, string name)
{
// Build the textures from the color table.
var table = new LegacyColorTable(material.Mtrl.Table);
var table = new LegacyColorTable(material.Mtrl.Table!);
var normal = material.Textures[TextureUsage.SamplerNormal];
@ -103,6 +103,7 @@ public class MaterialExporter
// TODO: It feels a little silly to request the entire normal here when extracting the normal only needs some of the components.
// As a future refactor, it would be neat to accept a single-channel field here, and then do composition of other stuff later.
// TODO(Dawntrail): Use the dedicated index (_id) map, that is not embedded in the normal map's alpha channel anymore.
private readonly struct ProcessCharacterNormalOperation(Image<Rgba32> normal, LegacyColorTable table) : IRowOperation
{
public Image<Rgba32> Normal { get; } = normal.Clone();
@ -139,17 +140,17 @@ public class MaterialExporter
var nextRow = table[tableRow.Next];
// Base colour (table, .b)
var lerpedDiffuse = Vector3.Lerp(prevRow.Diffuse, nextRow.Diffuse, tableRow.Weight);
var lerpedDiffuse = Vector3.Lerp((Vector3)prevRow.DiffuseColor, (Vector3)nextRow.DiffuseColor, tableRow.Weight);
baseColorSpan[x].FromVector4(new Vector4(lerpedDiffuse, 1));
baseColorSpan[x].A = normalPixel.B;
// Specular (table)
var lerpedSpecularColor = Vector3.Lerp(prevRow.Specular, nextRow.Specular, tableRow.Weight);
var lerpedSpecularFactor = float.Lerp(prevRow.SpecularStrength, nextRow.SpecularStrength, tableRow.Weight);
var lerpedSpecularColor = Vector3.Lerp((Vector3)prevRow.SpecularColor, (Vector3)nextRow.SpecularColor, tableRow.Weight);
var lerpedSpecularFactor = float.Lerp((float)prevRow.SpecularMask, (float)nextRow.SpecularMask, tableRow.Weight);
specularSpan[x].FromVector4(new Vector4(lerpedSpecularColor, lerpedSpecularFactor));
// Emissive (table)
var lerpedEmissive = Vector3.Lerp(prevRow.Emissive, nextRow.Emissive, tableRow.Weight);
var lerpedEmissive = Vector3.Lerp((Vector3)prevRow.EmissiveColor, (Vector3)nextRow.EmissiveColor, tableRow.Weight);
emissiveSpan[x].FromVector4(new Vector4(lerpedEmissive, 1));
// Normal (.rg)

View file

@ -18,9 +18,7 @@ public static class TextureDrawer
{
if (texture.TextureWrap != null)
{
size = size.X < texture.TextureWrap.Width
? size with { Y = texture.TextureWrap.Height * size.X / texture.TextureWrap.Width }
: new Vector2(texture.TextureWrap.Width, texture.TextureWrap.Height);
size = texture.TextureWrap.Size.Contain(size);
ImGui.Image(texture.TextureWrap.ImGuiHandle, size);
DrawData(texture);

View file

@ -279,7 +279,7 @@ public class MigrationManager(Configuration config) : IService
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
using var f = File.Open(path, FileMode.Create, FileAccess.Write);
if (file.IsDawnTrail)
if (file.IsDawntrail)
{
file.MigrateToDawntrail();
Penumbra.Log.Debug($"Migrated material {reader.Entry.Key} to Dawntrail during import.");
@ -329,7 +329,7 @@ public class MigrationManager(Configuration config) : IService
try
{
var mtrl = new MtrlFile(data);
if (mtrl.IsDawnTrail)
if (mtrl.IsDawntrail)
return data;
mtrl.MigrateToDawntrail();

View file

@ -6,7 +6,6 @@ using OtterGui;
using Penumbra.Interop.ResourceTree;
using Penumbra.UI.Classes;
using Penumbra.String;
using Penumbra.UI.Tabs;
namespace Penumbra.UI.AdvancedWindow;
@ -245,10 +244,7 @@ public class ResourceTreeViewer
if (visibility == NodeVisibility.Hidden)
continue;
var textColor = ImGui.GetColorU32(ImGuiCol.Text);
var textColorInternal = (textColor & 0x00FFFFFFu) | ((textColor & 0xFE000000u) >> 1); // Half opacity
using var mutedColor = ImRaii.PushColor(ImGuiCol.Text, textColorInternal, resourceNode.Internal);
using var mutedColor = ImRaii.PushColor(ImGuiCol.Text, ImGuiUtil.HalfTransparentText(), resourceNode.Internal);
var filterIcon = resourceNode.Icon != 0 ? resourceNode.Icon : parentFilterIcon;