diff --git a/Penumbra/Import/Models/Export/MaterialExporter.cs b/Penumbra/Import/Models/Export/MaterialExporter.cs index 5df9e1c1..62892473 100644 --- a/Penumbra/Import/Models/Export/MaterialExporter.cs +++ b/Penumbra/Import/Models/Export/MaterialExporter.cs @@ -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 normal, LegacyColorTable table) : IRowOperation { public Image 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) diff --git a/Penumbra/Import/Textures/TextureDrawer.cs b/Penumbra/Import/Textures/TextureDrawer.cs index bd95d1ab..c83604e4 100644 --- a/Penumbra/Import/Textures/TextureDrawer.cs +++ b/Penumbra/Import/Textures/TextureDrawer.cs @@ -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); diff --git a/Penumbra/Services/MigrationManager.cs b/Penumbra/Services/MigrationManager.cs index 84318da6..7726f6fd 100644 --- a/Penumbra/Services/MigrationManager.cs +++ b/Penumbra/Services/MigrationManager.cs @@ -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(); diff --git a/Penumbra/UI/AdvancedWindow/ResourceTreeViewer.cs b/Penumbra/UI/AdvancedWindow/ResourceTreeViewer.cs index c47414b9..e2776b2f 100644 --- a/Penumbra/UI/AdvancedWindow/ResourceTreeViewer.cs +++ b/Penumbra/UI/AdvancedWindow/ResourceTreeViewer.cs @@ -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;