mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 04:58:24 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
1 changed files with 784842 additions and 0 deletions
30
Brutal.Texture/Stb/StbDataTypeExtensions.cs
Normal file
30
Brutal.Texture/Stb/StbDataTypeExtensions.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using Brutal.TextureApi;
|
||||
|
||||
namespace Brutal.TextureApi.Stb;
|
||||
|
||||
public static class StbDataTypeExtensions
|
||||
{
|
||||
public static StbApi.Stb.DataType ToStbDataType(this TextureFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case TextureFormat.R8_UNorm:
|
||||
case TextureFormat.R8G8_UNorm:
|
||||
case TextureFormat.R8G8B8_UNorm:
|
||||
case TextureFormat.R8G8B8A8_UNorm:
|
||||
return StbApi.Stb.DataType._8Bit;
|
||||
case TextureFormat.R16_UNorm:
|
||||
case TextureFormat.R16G16_UNorm:
|
||||
case TextureFormat.R16G16B16_UNorm:
|
||||
case TextureFormat.R16G16B16A16_UNorm:
|
||||
return StbApi.Stb.DataType._16Bit;
|
||||
case TextureFormat.R32_SFloat:
|
||||
case TextureFormat.R32G32_SFloat:
|
||||
case TextureFormat.R32G32B32_SFloat:
|
||||
case TextureFormat.R32G32B32A32_SFloat:
|
||||
return StbApi.Stb.DataType.Float;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(format), format, "TextureFormat not supported by Stb");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue