|
|
|
@ -348,9 +348,6 @@ namespace Nvidia.TextureTools
|
|
|
|
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
|
|
|
|
private extern static void nvttSetCompressionOptionsColorWeights(IntPtr compressionOptions, float red, float green, float blue, float alpha);
|
|
|
|
|
|
|
|
|
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
|
|
|
|
private extern static void nvttEnableCompressionOptionsCudaCompression(IntPtr compressionOptions, bool enable);
|
|
|
|
|
|
|
|
|
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
|
|
|
|
private extern static void nvttSetCompressionOptionsPixelFormat(IntPtr compressionOptions, uint bitcount, uint rmask, uint gmask, uint bmask, uint amask);
|
|
|
|
|
|
|
|
|
@ -389,11 +386,6 @@ namespace Nvidia.TextureTools
|
|
|
|
|
nvttSetCompressionOptionsColorWeights(options, red, green, blue, alpha);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void EnableCudaCompression(bool enable)
|
|
|
|
|
{
|
|
|
|
|
nvttEnableCompressionOptionsCudaCompression(options, enable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
|
|
|
|
|
{
|
|
|
|
|
nvttSetCompressionOptionsPixelFormat(options, bitcount, rmask, gmask, bmask, amask);
|
|
|
|
@ -468,33 +460,56 @@ namespace Nvidia.TextureTools
|
|
|
|
|
|
|
|
|
|
public event ErrorHandler Error;
|
|
|
|
|
|
|
|
|
|
public void SetOutputHeader(bool b)
|
|
|
|
|
{
|
|
|
|
|
nvttSetOutputOptionsOutputHeader(options, b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @@ Add OutputHandler interface.
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region public static class Compressor
|
|
|
|
|
public static class Compressor
|
|
|
|
|
public class Compressor
|
|
|
|
|
{
|
|
|
|
|
#region Bindings
|
|
|
|
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
|
|
|
|
private extern static bool nvttCompress(IntPtr inputOptions, IntPtr compressionOptions, IntPtr outputOptions);
|
|
|
|
|
private extern static IntPtr nvttCreateCompressor();
|
|
|
|
|
|
|
|
|
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
|
|
|
|
private extern static void nvttDestroyCompressor(IntPtr compressor);
|
|
|
|
|
|
|
|
|
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
|
|
|
|
private extern static int nvttEstimateSize(IntPtr inputOptions, IntPtr compressionOptions);
|
|
|
|
|
private extern static bool nvttCompress(IntPtr compressor, IntPtr inputOptions, IntPtr compressionOptions, IntPtr outputOptions);
|
|
|
|
|
|
|
|
|
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
|
|
|
|
private extern static int nvttEstimateSize(IntPtr compressor, IntPtr inputOptions, IntPtr compressionOptions);
|
|
|
|
|
|
|
|
|
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
|
|
|
|
private static extern IntPtr nvttErrorString(Error error);
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public static bool Compress(InputOptions inputOptions, CompressionOptions compressionOptions, OutputOptions outputOptions)
|
|
|
|
|
internal IntPtr compressor;
|
|
|
|
|
|
|
|
|
|
public Compressor()
|
|
|
|
|
{
|
|
|
|
|
compressor = nvttCreateCompressor();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~Compressor()
|
|
|
|
|
{
|
|
|
|
|
nvttDestroyCompressor(compressor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Compress(InputOptions input, CompressionOptions compression, OutputOptions output)
|
|
|
|
|
{
|
|
|
|
|
return nvttCompress(inputOptions.options, compressionOptions.options, outputOptions.options);
|
|
|
|
|
return nvttCompress(compressor, input.options, compression.options, output.options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int EstimateSize(InputOptions inputOptions, CompressionOptions compressionOptions)
|
|
|
|
|
public int EstimateSize(InputOptions input, CompressionOptions compression)
|
|
|
|
|
{
|
|
|
|
|
return nvttEstimateSize(inputOptions.options, compressionOptions.options);
|
|
|
|
|
return nvttEstimateSize(compressor, input.options, compression.options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string ErrorString(Error error)
|
|
|
|
|