mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 15:02:54 +08:00
Add Support for D3DFMT_X8R8G8B8 (#214)
This would "fix" the exported xml from having "22" in the embedded texture's format block. In before this 22 prevents the xml file from importing into blender via Sollumz, caused the common error "KeyError:22" when some people editing weird-making mods.
This commit is contained in:
parent
023cc1eb47
commit
595bb9a375
@ -659,6 +659,7 @@ namespace CodeWalker.GameFiles
|
||||
public enum TextureFormat : uint
|
||||
{
|
||||
D3DFMT_A8R8G8B8 = 21,
|
||||
D3DFMT_X8R8G8B8 = 22,
|
||||
D3DFMT_A1R5G5B5 = 25,
|
||||
D3DFMT_A8 = 28,
|
||||
D3DFMT_A8B8G8R8 = 32,
|
||||
|
@ -185,6 +185,10 @@ namespace CodeWalker.Utils
|
||||
px = imgdata;
|
||||
swaprb = false;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM: // TextureFormat.D3DFMT_X8R8G8B8
|
||||
px = imgdata;
|
||||
swaprb = false;
|
||||
break;
|
||||
default:
|
||||
break; //shouldn't get here...
|
||||
}
|
||||
@ -491,6 +495,7 @@ namespace CodeWalker.Utils
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM: format = TextureFormat.D3DFMT_A8B8G8R8; break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8_UNORM: format = TextureFormat.D3DFMT_L8; break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM: format = TextureFormat.D3DFMT_A8R8G8B8; break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM: format = TextureFormat.D3DFMT_X8R8G8B8; break;
|
||||
}
|
||||
return format;
|
||||
}
|
||||
@ -514,6 +519,7 @@ namespace CodeWalker.Utils
|
||||
case TextureFormat.D3DFMT_A8B8G8R8: format = DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM; break;
|
||||
case TextureFormat.D3DFMT_L8: format = DXGI_FORMAT.DXGI_FORMAT_R8_UNORM; break;
|
||||
case TextureFormat.D3DFMT_A8R8G8B8: format = DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM; break;
|
||||
case TextureFormat.D3DFMT_X8R8G8B8: format = DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM; break;
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ namespace CodeWalker.GameFiles
|
||||
case TextureFormat.D3DFMT_A8B8G8R8: format = Format.R8G8B8A8_UNorm; break;
|
||||
case TextureFormat.D3DFMT_L8: format = Format.R8_UNorm; break;
|
||||
case TextureFormat.D3DFMT_A8R8G8B8: format = Format.B8G8R8A8_UNorm; break;
|
||||
case TextureFormat.D3DFMT_X8R8G8B8: format = Format.B8G8R8X8_UNorm; break;
|
||||
}
|
||||
return format;
|
||||
}
|
||||
@ -52,6 +53,7 @@ namespace CodeWalker.GameFiles
|
||||
case TextureFormat.D3DFMT_A8B8G8R8: return 32;// R8G8B8A8_UNorm
|
||||
case TextureFormat.D3DFMT_L8: return 8;// R8_UNorm
|
||||
case TextureFormat.D3DFMT_A8R8G8B8: return 32;// B8G8R8A8_UNorm
|
||||
case TextureFormat.D3DFMT_X8R8G8B8: return 32;// B8G8R8X8_UNorm
|
||||
|
||||
default: return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user