@@ -116,17 +116,17 @@ public static CustomModelColors GetCustomColors()
116
116
/// <param name="mtrl"></param>
117
117
/// <param name="colors"></param>
118
118
/// <returns></returns>
119
- public static async Task < ModelTextureData > GetModelMaps ( DirectoryInfo gameDirectory , XivMtrl mtrl , CustomModelColors colors = null )
119
+ public static async Task < ModelTextureData > GetModelMaps ( DirectoryInfo gameDirectory , XivMtrl mtrl , CustomModelColors colors = null , int highlightedRow = - 1 )
120
120
{
121
121
var tex = new Tex ( gameDirectory ) ;
122
- return await GetModelMaps ( tex , mtrl ) ;
122
+ return await GetModelMaps ( tex , mtrl , colors , highlightedRow ) ;
123
123
}
124
124
125
125
/// <summary>
126
126
/// Gets the texture maps for the model
127
127
/// </summary>
128
128
/// <returns>The texture maps in byte arrays inside a ModelTextureData class</returns>
129
- public static async Task < ModelTextureData > GetModelMaps ( Tex tex , XivMtrl mtrl , CustomModelColors colors = null )
129
+ public static async Task < ModelTextureData > GetModelMaps ( Tex tex , XivMtrl mtrl , CustomModelColors colors = null , int highlightedRow = - 1 )
130
130
{
131
131
132
132
// Use static values as needed.
@@ -233,7 +233,7 @@ await Task.Run(() =>
233
233
{
234
234
var cs = texMapData . ColorSet . Data ;
235
235
Color finalDiffuseColor , finalSpecularColor ;
236
- ComputeColorsetBlending ( mtrl , colorsetValue , cs , diffuseColor , specularColor , out finalDiffuseColor , out finalSpecularColor , out emissiveColor ) ;
236
+ ComputeColorsetBlending ( mtrl , colorsetValue , cs , diffuseColor , specularColor , out finalDiffuseColor , out finalSpecularColor , out emissiveColor , highlightedRow ) ;
237
237
diffuseColor = finalDiffuseColor ;
238
238
specularColor = finalSpecularColor ;
239
239
}
@@ -644,7 +644,7 @@ private static void ComputeShaderColors(CustomModelColors colors, ShaderInfo in
644
644
}
645
645
}
646
646
647
- private static void ComputeColorsetBlending ( XivMtrl mtrl , byte colorsetByte , byte [ ] colorSetData , Color baseDiffuse , Color baseSpecular , out Color newDiffuse , out Color newSpecular , out Color emissiveColor )
647
+ private static void ComputeColorsetBlending ( XivMtrl mtrl , byte colorsetByte , byte [ ] colorSetData , Color baseDiffuse , Color baseSpecular , out Color newDiffuse , out Color newSpecular , out Color emissiveColor , int highlightRow = - 1 )
648
648
{
649
649
int rowNumber = colorsetByte / 17 ;
650
650
int nextRow = rowNumber >= 15 ? 15 : rowNumber + 1 ;
@@ -659,14 +659,52 @@ private static void ComputeColorsetBlending(XivMtrl mtrl, byte colorsetByte, byt
659
659
var row1Offset = Clamp ( rowNumber * 16 ) ;
660
660
var row2Offset = Clamp ( nextRow * 16 ) ;
661
661
662
- diffuse1 = new Color ( colorSetData [ row1Offset + 0 ] , colorSetData [ row1Offset + 1 ] , colorSetData [ row1Offset + 2 ] , ( byte ) 255 ) ;
663
- diffuse2 = new Color ( colorSetData [ row2Offset + 0 ] , colorSetData [ row2Offset + 1 ] , colorSetData [ row2Offset + 2 ] , ( byte ) 255 ) ;
662
+ if ( highlightRow >= 0 )
663
+ {
664
+ if ( rowNumber == highlightRow )
665
+ {
666
+ diffuse1 = new Color ( ( byte ) 255 , ( byte ) 255 , ( byte ) 255 , ( byte ) 255 ) ;
667
+ diffuse2 = new Color ( ( byte ) 0 , ( byte ) 0 , ( byte ) 0 , ( byte ) 255 ) ;
668
+
669
+ spec1 = new Color ( ( byte ) 255 , ( byte ) 255 , ( byte ) 255 , ( byte ) 255 ) ;
670
+ spec2 = new Color ( ( byte ) 0 , ( byte ) 0 , ( byte ) 0 , ( byte ) 255 ) ;
664
671
665
- spec1 = new Color ( colorSetData [ row1Offset + 4 ] , colorSetData [ row1Offset + 5 ] , colorSetData [ row1Offset + 6 ] , ( byte ) 255 ) ;
666
- spec2 = new Color ( colorSetData [ row2Offset + 4 ] , colorSetData [ row2Offset + 5 ] , colorSetData [ row2Offset + 6 ] , ( byte ) 255 ) ;
672
+ emiss1 = new Color ( ( byte ) 255 , ( byte ) 255 , ( byte ) 255 , ( byte ) 255 ) ;
673
+ emiss2 = new Color ( ( byte ) 0 , ( byte ) 0 , ( byte ) 0 , ( byte ) 255 ) ;
674
+ }
675
+ else if ( nextRow == highlightRow )
676
+ {
677
+ diffuse1 = new Color ( ( byte ) 0 , ( byte ) 0 , ( byte ) 0 , ( byte ) 255 ) ;
678
+ diffuse2 = new Color ( ( byte ) 255 , ( byte ) 255 , ( byte ) 255 , ( byte ) 255 ) ;
679
+
680
+ spec1 = new Color ( ( byte ) 0 , ( byte ) 0 , ( byte ) 0 , ( byte ) 255 ) ;
681
+ spec2 = new Color ( ( byte ) 255 , ( byte ) 255 , ( byte ) 255 , ( byte ) 255 ) ;
682
+
683
+ emiss1 = new Color ( ( byte ) 0 , ( byte ) 0 , ( byte ) 0 , ( byte ) 255 ) ;
684
+ emiss2 = new Color ( ( byte ) 255 , ( byte ) 255 , ( byte ) 255 , ( byte ) 255 ) ;
685
+ } else
686
+ {
687
+ diffuse1 = new Color ( ( byte ) 0 , ( byte ) 0 , ( byte ) 0 , ( byte ) 255 ) ;
688
+ diffuse2 = new Color ( ( byte ) 0 , ( byte ) 0 , ( byte ) 0 , ( byte ) 255 ) ;
667
689
668
- emiss1 = new Color ( colorSetData [ row1Offset + 8 ] , colorSetData [ row1Offset + 9 ] , colorSetData [ row1Offset + 10 ] , ( byte ) 255 ) ;
669
- emiss2 = new Color ( colorSetData [ row2Offset + 8 ] , colorSetData [ row2Offset + 9 ] , colorSetData [ row2Offset + 10 ] , ( byte ) 255 ) ;
690
+ spec1 = new Color ( ( byte ) 0 , ( byte ) 0 , ( byte ) 0 , ( byte ) 255 ) ;
691
+ spec2 = new Color ( ( byte ) 0 , ( byte ) 0 , ( byte ) 0 , ( byte ) 255 ) ;
692
+
693
+ emiss1 = new Color ( ( byte ) 0 , ( byte ) 0 , ( byte ) 0 , ( byte ) 255 ) ;
694
+ emiss2 = new Color ( ( byte ) 0 , ( byte ) 0 , ( byte ) 0 , ( byte ) 255 ) ;
695
+ }
696
+ }
697
+ else
698
+ {
699
+ diffuse1 = new Color ( colorSetData [ row1Offset + 0 ] , colorSetData [ row1Offset + 1 ] , colorSetData [ row1Offset + 2 ] , ( byte ) 255 ) ;
700
+ diffuse2 = new Color ( colorSetData [ row2Offset + 0 ] , colorSetData [ row2Offset + 1 ] , colorSetData [ row2Offset + 2 ] , ( byte ) 255 ) ;
701
+
702
+ spec1 = new Color ( colorSetData [ row1Offset + 4 ] , colorSetData [ row1Offset + 5 ] , colorSetData [ row1Offset + 6 ] , ( byte ) 255 ) ;
703
+ spec2 = new Color ( colorSetData [ row2Offset + 4 ] , colorSetData [ row2Offset + 5 ] , colorSetData [ row2Offset + 6 ] , ( byte ) 255 ) ;
704
+
705
+ emiss1 = new Color ( colorSetData [ row1Offset + 8 ] , colorSetData [ row1Offset + 9 ] , colorSetData [ row1Offset + 10 ] , ( byte ) 255 ) ;
706
+ emiss2 = new Color ( colorSetData [ row2Offset + 8 ] , colorSetData [ row2Offset + 9 ] , colorSetData [ row2Offset + 10 ] , ( byte ) 255 ) ;
707
+ }
670
708
671
709
672
710
// These are now our base values to multiply the base values by.
0 commit comments