Skip to content

Commit

Permalink
Adding code pulled from Paint.Net to allow for fine-tune control of t…
Browse files Browse the repository at this point in the history
…he DDS texture data.
  • Loading branch information
stricq committed Jul 25, 2016
1 parent babaf02 commit 608a2d3
Show file tree
Hide file tree
Showing 22 changed files with 1,029 additions and 5 deletions.
20 changes: 20 additions & 0 deletions UpkManager.Dds/Constants/CubeMapFlags.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;


namespace UpkManager.Dds.Constants {

[Flags]
internal enum CubeMapFlags {

PositiveX = 0x00000600, // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX
NegativeX = 0x00000a00, // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEX
PositiveY = 0x00001200, // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEY
NegativeY = 0x00002200, // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEY
PositiveZ = 0x00004200, // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEZ
NegativeZ = 0x00008200, // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEZ

AllFaces = PositiveX | NegativeX | PositiveY | NegativeY | PositiveZ | NegativeZ

}

}
23 changes: 23 additions & 0 deletions UpkManager.Dds/Constants/FileFormat.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@


namespace UpkManager.Dds.Constants {

public enum FileFormat {

Unknown,

DXT1,
DXT3,
DXT5,
A8R8G8B8,
X8R8G8B8,
A8B8G8R8,
X8B8G8R8,
A1R5G5B5,
A4R4G4B4,
R8G8B8,
R5G6B5

}

}
15 changes: 15 additions & 0 deletions UpkManager.Dds/Constants/FourCCFormat.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@


namespace UpkManager.Dds.Constants {

internal static class FourCCFormat {

public const uint Dxt1 = 0x31545844;

public const uint Dxt3 = 0x33545844;

public const uint Dxt5 = 0x35545844;

}

}
17 changes: 17 additions & 0 deletions UpkManager.Dds/Constants/HeaderFlags.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;


namespace UpkManager.Dds.Constants {

[Flags]
internal enum HeaderFlags {

Texture = 0x00001007, // DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT
MipMap = 0x00020000, // DDSD_MIPMAPCOUNT
Volume = 0x00800000, // DDSD_DEPTH
Pitch = 0x00000008, // DDSD_PITCH
LinearSize = 0x00080000 // DDSD_LINEARSIZE

}

}
15 changes: 15 additions & 0 deletions UpkManager.Dds/Constants/PixelFormatFlags.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;


namespace UpkManager.Dds.Constants {

[Flags]
internal enum PixelFormatFlags {

FourCC = 0x00000004,
RGB = 0x00000040,
RGBA = 0x00000041

}

}
25 changes: 25 additions & 0 deletions UpkManager.Dds/Constants/SquishFlags.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;


namespace UpkManager.Dds.Constants {

[Flags]
internal enum SquishFlags {

Dxt1 = (1 << 0), // Use DXT1 compression.
Dxt3 = (1 << 1), // Use DXT3 compression.
Dxt5 = (1 << 2), // Use DXT5 compression.

ColourClusterFit = (1 << 3), // Use a slow but high quality colour compressor (the default).
ColourRangeFit = (1 << 4), // Use a fast but low quality colour compressor.

ColourMetricPerceptual = (1 << 5), // Use a perceptual metric for colour error (the default).
ColourMetricUniform = (1 << 6), // Use a uniform metric for colour error.

WeightColourByAlpha = (1 << 7), // Weight the colour by alpha during cluster fit (disabled by default).

ColourIterativeClusterFit = (1 << 8), // Use a very slow but very high quality colour compressor.

}

}
15 changes: 15 additions & 0 deletions UpkManager.Dds/Constants/SurfaceFlags.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;


namespace UpkManager.Dds.Constants {

[Flags]
public enum SurfaceFlags {

Texture = 0x00001000, // DDSCAPS_TEXTURE
MipMap = 0x00400008, // DDSCAPS_COMPLEX | DDSCAPS_MIPMAP
CubeMap = 0x00000008 // DDSCAPS_COMPLEX

}

}
13 changes: 13 additions & 0 deletions UpkManager.Dds/Constants/VolumeFlags.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;


namespace UpkManager.Dds.Constants {

[Flags]
public enum VolumeFlags {

Volume = 0x00200000 // DDSCAPS2_VOLUME

}

}
Loading

0 comments on commit 608a2d3

Please sign in to comment.