@@ -309,6 +309,9 @@ public ShaderInfo GetShaderInfo()
309
309
case "bg.shpk" :
310
310
info . Shader = MtrlShader . Furniture ;
311
311
break ;
312
+ case "bgcolorchange.shpk" :
313
+ info . Shader = MtrlShader . DyeableFurniture ;
314
+ break ;
312
315
default :
313
316
info . Shader = MtrlShader . Other ;
314
317
break ;
@@ -356,6 +359,9 @@ public void SetShaderInfo(ShaderInfo info)
356
359
case MtrlShader . Furniture :
357
360
Shader = "bg.shpk" ;
358
361
break ;
362
+ case MtrlShader . DyeableFurniture :
363
+ Shader = "bgcolorchange.shpk" ;
364
+ break ;
359
365
default :
360
366
// No change to the Shader for 'Other' type entries.
361
367
break ;
@@ -419,6 +425,11 @@ public MapInfo GetMapInfo(XivTexType MapType)
419
425
mapIndex = ( int ) paramSet . TextureIndex ;
420
426
info . Format = GetFormat ( paramSet . FileFormat ) ;
421
427
}
428
+ else if ( paramSet . TextureType == Mtrl . FurnitureTextureDescriptorValues [ MapType ] )
429
+ {
430
+ mapIndex = ( int ) paramSet . TextureIndex ;
431
+ info . Format = GetFormat ( paramSet . FileFormat ) ;
432
+ }
422
433
}
423
434
424
435
if ( mapIndex < 0 )
@@ -472,7 +483,12 @@ public MapInfo GetMapInfo(string path)
472
483
if ( Mtrl . TextureDescriptorValues . ContainsValue ( descriptor . TextureType ) )
473
484
{
474
485
info . Usage = Mtrl . TextureDescriptorValues . First ( x => x . Value == descriptor . TextureType ) . Key ;
475
- } else
486
+ }
487
+ else if ( Mtrl . FurnitureTextureDescriptorValues . ContainsValue ( descriptor . TextureType ) )
488
+ {
489
+ info . Usage = Mtrl . FurnitureTextureDescriptorValues . First ( x => x . Value == descriptor . TextureType ) . Key ;
490
+ }
491
+ else
476
492
{
477
493
info . Usage = XivTexType . Other ;
478
494
}
@@ -607,6 +623,15 @@ public void SetMapInfo(XivTexType MapType, MapInfo info)
607
623
/// </summary>
608
624
private void RegenerateTextureUsageList ( )
609
625
{
626
+ var shaderInfo = GetShaderInfo ( ) ;
627
+
628
+ // Furniture shaders do not use the texture usage list at all.
629
+ if ( shaderInfo . Shader == MtrlShader . Furniture || shaderInfo . Shader == MtrlShader . DyeableFurniture )
630
+ {
631
+ TextureUsageList . Clear ( ) ;
632
+ return ;
633
+ }
634
+
610
635
// Everything (should) have a normal, so this is redundant.
611
636
// bool hasNormal = GetMapInfo(XivTexType.Normal) != null;
612
637
bool hasSpec = GetMapInfo ( XivTexType . Specular ) != null ;
@@ -694,6 +719,7 @@ private void SetTextureUsage(XivTexType usage, uint? unknownValue = null)
694
719
public List < MapInfo > GetAllMapInfos ( bool tokenize = true )
695
720
{
696
721
var ret = new List < MapInfo > ( ) ;
722
+ var shaderInfo = GetShaderInfo ( ) ;
697
723
for ( var i = 0 ; i < TexturePathList . Count ; i ++ )
698
724
{
699
725
var info = new MapInfo ( ) ;
@@ -714,7 +740,16 @@ public List<MapInfo> GetAllMapInfos(bool tokenize = true)
714
740
return ( x . Value == p . TextureType ) ;
715
741
} ) . Key ;
716
742
info . Usage = usage ;
717
- } else
743
+ } else if ( Mtrl . FurnitureTextureDescriptorValues . ContainsValue ( p . TextureType ) )
744
+ {
745
+ // Known parameter for the furniture shaders.
746
+ var usage = Mtrl . FurnitureTextureDescriptorValues . First ( x =>
747
+ {
748
+ return ( x . Value == p . TextureType ) ;
749
+ } ) . Key ;
750
+ info . Usage = usage ;
751
+
752
+ } else
718
753
{
719
754
info . Usage = XivTexType . Other ;
720
755
}
@@ -748,12 +783,13 @@ public List<TexTypePath> GetTextureTypePathList()
748
783
TexTypePath ttp ;
749
784
foreach ( var map in maps )
750
785
{
751
-
752
-
753
786
if ( shaderInfo . Shader == MtrlShader . Skin && map . Usage == XivTexType . Multi )
754
787
{
755
788
ttp = new TexTypePath ( ) { DataFile = GetDataFile ( ) , Path = map . path , Type = XivTexType . Skin } ;
756
789
790
+ } else if ( shaderInfo . Shader == MtrlShader . Furniture && map . path . Contains ( "dummy" ) ) {
791
+ // Dummy textures are skipped.
792
+ continue ;
757
793
}
758
794
else
759
795
{
@@ -1049,13 +1085,14 @@ public enum MtrlTextureDescriptorFormat
1049
1085
// Enum representation of the shader names used in mtrl files.
1050
1086
public enum MtrlShader
1051
1087
{
1052
- Standard , // character.shpk
1053
- Glass , // characterglass.shpk
1054
- Skin , // skin.shpk
1055
- Hair , // hair.shpk
1056
- Iris , // iris.shpk
1057
- Furniture , // bg.shpk
1058
- Other // Unknown Shader
1088
+ Standard , // character.shpk
1089
+ Glass , // characterglass.shpk
1090
+ Skin , // skin.shpk
1091
+ Hair , // hair.shpk
1092
+ Iris , // iris.shpk
1093
+ Furniture , // bg.shpk
1094
+ DyeableFurniture , //bgcolorchange.shpk
1095
+ Other // Unknown Shader
1059
1096
}
1060
1097
1061
1098
/// <summary>
0 commit comments