Skip to content

Commit

Permalink
Nope, relying on prefabs sharedMaterial won't do
Browse files Browse the repository at this point in the history
  • Loading branch information
gotmachine committed May 25, 2024
1 parent 40bb7fc commit d9f1f7d
Show file tree
Hide file tree
Showing 3 changed files with 367 additions and 88 deletions.
30 changes: 30 additions & 0 deletions KSPCommunityFixes/Library/StaticHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,36 @@

namespace KSPCommunityFixes
{
// see https://learn.microsoft.com/en-us/windows/win32/direct3ddds/dx-graphics-dds-pguide
internal enum DDSFourCC : uint
{
DXT1 = 0x31545844, // "DXT1"
DXT2 = 0x32545844, // "DXT2"
DXT3 = 0x33545844, // "DXT3"
DXT4 = 0x34545844, // "DXT4"
DXT5 = 0x35545844, // "DXT5"
BC4U_ATI = 0x31495441, // "ATI1" (actually BC4U)
BC4U = 0x55344342, // "BC4U"
BC4S = 0x53344342, // "BC4S"
BC5U_ATI = 0x32495441, // "ATI2" (actually BC5U)
BC5U = 0x55354342, // "BC5U"
BC5S = 0x53354342, // "BC5S"
RGBG = 0x47424752, // "RGBG"
GRGB = 0x42475247, // "GRGB"
UYVY = 0x59565955, // "UYVY"
YUY2 = 0x32595559, // "YUY2"
DX10 = 0x30315844, // "DX10", actual DXGI format specified in DX10 header
R16G16B16A16_UNORM = 36,
R16G16B16A16_SNORM = 110,
R16_FLOAT = 111,
R16G16_FLOAT = 112,
R16G16B16A16_FLOAT = 113,
R32_FLOAT = 114,
R32G32_FLOAT = 115,
R32G32B32A32_FLOAT = 116,
CxV8U8 = 117,
}

static class StaticHelpers
{
public static string HumanReadableBytes(long bytes)
Expand Down
30 changes: 0 additions & 30 deletions KSPCommunityFixes/Performance/FastLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,36 +1136,6 @@ public void CheckTextureCache()
this.cachedTextureInfo = cachedTextureInfo;
}

// see https://learn.microsoft.com/en-us/windows/win32/direct3ddds/dx-graphics-dds-pguide
private enum DDSFourCC : uint
{
DXT1 = 0x31545844, // "DXT1"
DXT2 = 0x32545844, // "DXT2"
DXT3 = 0x33545844, // "DXT3"
DXT4 = 0x34545844, // "DXT4"
DXT5 = 0x35545844, // "DXT5"
BC4U_ATI = 0x31495441, // "ATI1" (actually BC4U)
BC4U = 0x55344342, // "BC4U"
BC4S = 0x53344342, // "BC4S"
BC5U_ATI = 0x32495441, // "ATI2" (actually BC5U)
BC5U = 0x55354342, // "BC5U"
BC5S = 0x53354342, // "BC5S"
RGBG = 0x47424752, // "RGBG"
GRGB = 0x42475247, // "GRGB"
UYVY = 0x59565955, // "UYVY"
YUY2 = 0x32595559, // "YUY2"
DX10 = 0x30315844, // "DX10", actual DXGI format specified in DX10 header
R16G16B16A16_UNORM = 36,
R16G16B16A16_SNORM = 110,
R16_FLOAT = 111,
R16G16_FLOAT = 112,
R16G16B16A16_FLOAT = 113,
R32_FLOAT = 114,
R32G32_FLOAT = 115,
R32G32B32A32_FLOAT = 116,
CxV8U8 = 117,
}

private TextureInfo LoadDDS()
{
memoryStream = new MemoryStream(buffer, 0, dataLength);
Expand Down
Loading

0 comments on commit d9f1f7d

Please sign in to comment.