Fix interface errors.
Complete C wrapper. Complete C# wrapper.
This commit is contained in:
parent
d781b66194
commit
196a77fdde
@ -297,7 +297,7 @@ void InputOptions::setColorTransform(ColorTransform t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set linear transform for the given channel.
|
// Set linear transform for the given channel.
|
||||||
void InputOptions::setLinearTransfrom(int channel, float w0, float w1, float w2, float w3)
|
void InputOptions::setLinearTransform(int channel, float w0, float w1, float w2, float w3)
|
||||||
{
|
{
|
||||||
nvCheck(channel >= 0 && channel < 4);
|
nvCheck(channel >= 0 && channel < 4);
|
||||||
|
|
||||||
|
489
src/nvtt/nvtt.cs
489
src/nvtt/nvtt.cs
@ -1,16 +1,16 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Security;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
namespace Nvidia.TextureTools
|
|
||||||
{
|
namespace Nvidia.TextureTools
|
||||||
|
{
|
||||||
#region Enums
|
#region Enums
|
||||||
|
|
||||||
#region enum Format
|
#region public enum Format
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compression format.
|
/// Compression format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
enum Format
|
public enum Format
|
||||||
{
|
{
|
||||||
// No compression.
|
// No compression.
|
||||||
RGB,
|
RGB,
|
||||||
@ -22,7 +22,7 @@ namespace Nvidia.TextureTools
|
|||||||
DXT3,
|
DXT3,
|
||||||
DXT5,
|
DXT5,
|
||||||
DXT5n,
|
DXT5n,
|
||||||
|
|
||||||
// DX10 formats.
|
// DX10 formats.
|
||||||
BC1 = DXT1,
|
BC1 = DXT1,
|
||||||
BC1a = DXT1a,
|
BC1a = DXT1a,
|
||||||
@ -34,11 +34,11 @@ namespace Nvidia.TextureTools
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region enum Quality
|
#region public enum Quality
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Quality modes.
|
/// Quality modes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
enum Quality
|
public enum Quality
|
||||||
{
|
{
|
||||||
Fastest,
|
Fastest,
|
||||||
Normal,
|
Normal,
|
||||||
@ -47,54 +47,184 @@ namespace Nvidia.TextureTools
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region enum TextureType
|
#region public enum WrapMode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Texture types.
|
/// Wrap modes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
enum TextureType
|
public enum WrapMode
|
||||||
|
{
|
||||||
|
Clamp,
|
||||||
|
Repeat,
|
||||||
|
Mirror,
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region public enum TextureType
|
||||||
|
/// <summary>
|
||||||
|
/// Texture types.
|
||||||
|
/// </summary>
|
||||||
|
public enum TextureType
|
||||||
{
|
{
|
||||||
Texture2D,
|
Texture2D,
|
||||||
TextureCube,
|
TextureCube,
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region public enum InputFormat
|
||||||
|
/// <summary>
|
||||||
|
/// Input formats.
|
||||||
|
/// </summary>
|
||||||
|
public enum InputFormat
|
||||||
|
{
|
||||||
|
BGRA_8UB
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region public enum MipmapFilter
|
||||||
|
/// <summary>
|
||||||
|
/// Mipmap downsampling filters.
|
||||||
|
/// </summary>
|
||||||
|
public enum MipmapFilter
|
||||||
|
{
|
||||||
|
Box,
|
||||||
|
Triangle,
|
||||||
|
Kaiser
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region public class InputOptions
|
#region public enum ColorTransform
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Input options.
|
/// Color transformation.
|
||||||
|
/// </summary>
|
||||||
|
public enum ColorTransform
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Linear
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region public enum RoundMode
|
||||||
|
/// <summary>
|
||||||
|
/// Extents rounding mode.
|
||||||
|
/// </summary>
|
||||||
|
public enum RoundMode
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
ToNextPowerOfTwo,
|
||||||
|
ToNearestPowerOfTwo,
|
||||||
|
ToPreviousPowerOfTwo
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region public enum AlphaMode
|
||||||
|
/// <summary>
|
||||||
|
/// Alpha mode.
|
||||||
|
/// </summary>
|
||||||
|
public enum AlphaMode
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Transparency,
|
||||||
|
Premultiplied
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region public enum Error
|
||||||
|
/// <summary>
|
||||||
|
/// Error codes.
|
||||||
|
/// </summary>
|
||||||
|
public enum Error
|
||||||
|
{
|
||||||
|
InvalidInput,
|
||||||
|
UserInterruption,
|
||||||
|
UnsupportedFeature,
|
||||||
|
CudaError,
|
||||||
|
Unknown,
|
||||||
|
FileOpen,
|
||||||
|
FileWrite,
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region public class InputOptions
|
||||||
|
/// <summary>
|
||||||
|
/// Input options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class InputOptions
|
public class InputOptions
|
||||||
{
|
{
|
||||||
#region Bindings
|
#region Bindings
|
||||||
[DllImport("nvtt")]
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
private extern static IntPtr nvttCreateInputOptions();
|
private extern static IntPtr nvttCreateInputOptions();
|
||||||
|
|
||||||
[DllImport("nvtt")]
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
private extern static void nvttDestroyInputOptions(IntPtr inputOptions);
|
private extern static void nvttDestroyInputOptions(IntPtr inputOptions);
|
||||||
|
|
||||||
[DllImport("nvtt")]
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
private extern static void nvttSetInputOptionsTextureLayout(IntPtr inputOptions, TextureType type, int w, int h, int d);
|
private extern static void nvttSetInputOptionsTextureLayout(IntPtr inputOptions, TextureType type, int w, int h, int d);
|
||||||
|
|
||||||
[DllImport("nvtt")]
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
private extern static void nvttResetInputOptionsTextureLayout(IntPtr inputOptions);
|
private extern static void nvttResetInputOptionsTextureLayout(IntPtr inputOptions);
|
||||||
|
|
||||||
[DllImport("nvtt")]
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
private extern static bool nvttSetInputOptionsMipmapData(IntPtr inputOptions, IntPtr data, int w, int h, int d, int face, int mipmap);
|
private extern static bool nvttSetInputOptionsMipmapData(IntPtr inputOptions, IntPtr data, int w, int h, int d, int face, int mipmap);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsFormat(IntPtr inputOptions, InputFormat format);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsAlphaMode(IntPtr inputOptions, AlphaMode alphaMode);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsGamma(IntPtr inputOptions, float inputGamma, float outputGamma);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsWrapMode(IntPtr inputOptions, WrapMode mode);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsMipmapping(IntPtr inputOptions, bool generateMipmaps, MipmapFilter filter, int maxLevel);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsKaiserParameters(IntPtr inputOptions, float width, float alpha, float stretch);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsNormalMap(IntPtr inputOptions, bool b);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsConvertToNormalMap(IntPtr inputOptions, bool convert);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsHeightEvaluation(IntPtr inputOptions, float redScale, float greenScale, float blueScale, float alphaScale);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsNormalFilter(IntPtr inputOptions, float small, float medium, float big, float large);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsNormalizeMipmaps(IntPtr inputOptions, bool b);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsColorTransform(IntPtr inputOptions, ColorTransform t);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsLinearTransfrom(IntPtr inputOptions, int channel, float w0, float w1, float w2, float w3);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsMaxExtents(IntPtr inputOptions, int d);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetInputOptionsRoundMode(IntPtr inputOptions, RoundMode mode);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
internal IntPtr options;
|
internal IntPtr options;
|
||||||
|
|
||||||
public InputOptions()
|
public InputOptions()
|
||||||
{
|
{
|
||||||
options = nvttCreateInputOptions();
|
options = nvttCreateInputOptions();
|
||||||
}
|
}
|
||||||
public ~InputOptions()
|
~InputOptions()
|
||||||
{
|
{
|
||||||
nvttDestroyInputOptions(options);
|
nvttDestroyInputOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTextureLayout(TextureType type, int w, int h, int d)
|
public void SetTextureLayout(TextureType type, int w, int h, int d)
|
||||||
{
|
{
|
||||||
nvttSetInputOptionsTextureLayout(options, type, w, h, d);
|
nvttSetInputOptionsTextureLayout(options, type, w, h, d);
|
||||||
@ -103,121 +233,276 @@ namespace Nvidia.TextureTools
|
|||||||
{
|
{
|
||||||
nvttResetInputOptionsTextureLayout(options);
|
nvttResetInputOptionsTextureLayout(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMipmapData(IntPtr data, int width, int height, int depth, int face, int mipmap)
|
public void SetMipmapData(IntPtr data, int width, int height, int depth, int face, int mipmap)
|
||||||
{
|
{
|
||||||
nvttSetInputOptionsMipmapData(options, data, width, height, depth, face, mipmap);
|
nvttSetInputOptionsMipmapData(options, data, width, height, depth, face, mipmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetFormat(InputFormat format)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsFormat(options, format);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetAlphaMode(AlphaMode alphaMode)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsAlphaMode(options, alphaMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetGamma(float inputGamma, float outputGamma)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsGamma(options, inputGamma, outputGamma);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetWrapMode(WrapMode wrapMode)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsWrapMode(options, wrapMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMipmapping(bool generateMipmaps)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsMipmapping(options, generateMipmaps, MipmapFilter.Box, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMipmapping(bool generateMipmaps, MipmapFilter filter)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsMipmapping(options, generateMipmaps, filter, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMipmapping(bool generateMipmaps, MipmapFilter filter, int maxLevel)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsMipmapping(options, generateMipmaps, filter, maxLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetKaiserParameters(float width, float alpha, float stretch)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsKaiserParameters(options, width, alpha, stretch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetNormalMap(bool b)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsNormalMap(options, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetConvertToNormalMap(bool convert)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsConvertToNormalMap(options, convert);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetHeightEvaluation(float redScale, float greenScale, float blueScale, float alphaScale)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsHeightEvaluation(options, redScale, greenScale, blueScale, alphaScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetNormalFilter(float small, float medium, float big, float large)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsNormalFilter(options, small, medium, big, large);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetNormalizeMipmaps(bool b)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsNormalizeMipmaps(options, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetColorTransform(ColorTransform t)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsColorTransform(options, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetLinearTransfrom(int channel, float w0, float w1, float w2, float w3)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsLinearTransfrom(options, channel, w0, w1, w2, w3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMaxExtents(int dim)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsMaxExtents(options, dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRoundMode(RoundMode mode)
|
||||||
|
{
|
||||||
|
nvttSetInputOptionsRoundMode(options, mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public class CompressionOptions
|
#region public class CompressionOptions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compression options.
|
/// Compression options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CompressionOptions
|
public class CompressionOptions
|
||||||
{
|
{
|
||||||
#region Bindings
|
#region Bindings
|
||||||
[DllImport("nvtt")]
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
private extern static IntPtr nvttCreateCompressionOptions();
|
private extern static IntPtr nvttCreateCompressionOptions();
|
||||||
|
|
||||||
[DllImport("nvtt")]
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
private extern static void nvttDestroyCompressionOptions(IntPtr compressionOptions);
|
private extern static void nvttDestroyCompressionOptions(IntPtr compressionOptions);
|
||||||
|
|
||||||
[DllImport("nvtt")]
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
private extern static void nvttSetCompressionOptionsFormat(IntPtr compressionOptions, Format format);
|
private extern static void nvttSetCompressionOptionsFormat(IntPtr compressionOptions, Format format);
|
||||||
|
|
||||||
[DllImport("nvtt")]
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
private extern static void nvttSetCompressionOptionsQuality(IntPtr compressionOptions, Quality quality);
|
private extern static void nvttSetCompressionOptionsQuality(IntPtr compressionOptions, Quality quality);
|
||||||
|
|
||||||
[DllImport("nvtt")]
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
private extern static void nvttSetCompressionOptionsPixelFormat(IntPtr compressionOptions, uint bitcount, uint rmask, uint gmask, uint bmask, uint amask);
|
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);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetCompressionOptionsQuantization(IntPtr compressionOptions, bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
internal IntPtr options;
|
internal IntPtr options;
|
||||||
|
|
||||||
public CompressionOptions()
|
public CompressionOptions()
|
||||||
{
|
{
|
||||||
options = nvttCreateCompressionOptions();
|
options = nvttCreateCompressionOptions();
|
||||||
}
|
}
|
||||||
public ~CompressionOptions()
|
~CompressionOptions()
|
||||||
{
|
{
|
||||||
nvttDestroyCompressionOptions(options);
|
nvttDestroyCompressionOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFormat(Format format)
|
public void SetFormat(Format format)
|
||||||
{
|
{
|
||||||
nvttSetCompressionOptionsFormat(options, format);
|
nvttSetCompressionOptionsFormat(options, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetQuality(Quality quality)
|
public void SetQuality(Quality quality)
|
||||||
{
|
{
|
||||||
nvttSetCompressionOptionsQuality(options, quality);
|
nvttSetCompressionOptionsQuality(options, quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetColorWeights(float red, float green, float blue)
|
||||||
|
{
|
||||||
|
nvttSetCompressionOptionsColorWeights(options, red, green, blue, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetColorWeights(float red, float green, float blue, float alpha)
|
||||||
|
{
|
||||||
|
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)
|
public void SetPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
|
||||||
{
|
{
|
||||||
nvttSetCompressionOptionsPixelFormat(options, bitcount, rmask, gmask, bmask, amask);
|
nvttSetCompressionOptionsPixelFormat(options, bitcount, rmask, gmask, bmask, amask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha)
|
||||||
|
{
|
||||||
|
nvttSetCompressionOptionsQuantization(options, colorDithering, alphaDithering, binaryAlpha, 127);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold)
|
||||||
|
{
|
||||||
|
nvttSetCompressionOptionsQuantization(options, colorDithering, alphaDithering, binaryAlpha, alphaThreshold);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public class OutputOptions
|
#region public class OutputOptions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Output options.
|
/// Output options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class OutputOptions
|
public class OutputOptions
|
||||||
{
|
{
|
||||||
#region Bindings
|
#region Delegates
|
||||||
[DllImport("nvtt")]
|
public delegate void ErrorHandler(Error error);
|
||||||
private extern static IntPtr nvttCreateOutputOptions();
|
private delegate void WriteDataDelegate(IntPtr data, int size);
|
||||||
|
private delegate void ImageDelegate(int size, int width, int height, int depth, int face, int miplevel);
|
||||||
[DllImport("nvtt")]
|
|
||||||
private extern static void nvttDestroyOutputOptions(IntPtr outputOptions);
|
|
||||||
|
|
||||||
[DllImport("nvtt", CharSet = CharSet.Ansi)]
|
|
||||||
private extern static void nvttSetOutputOptionsFileName(IntPtr outputOptions, string fileName);
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
internal IntPtr options;
|
#region Bindings
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static IntPtr nvttCreateOutputOptions();
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttDestroyOutputOptions(IntPtr outputOptions);
|
||||||
|
|
||||||
|
[DllImport("nvtt", CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetOutputOptionsFileName(IntPtr outputOptions, string fileName);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetOutputOptionsErrorHandler(IntPtr outputOptions, ErrorHandler errorHandler);
|
||||||
|
|
||||||
|
private void ErrorCallback(Error error)
|
||||||
|
{
|
||||||
|
if (Error != null) Error(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetOutputOptionsOutputHeader(IntPtr outputOptions, bool b);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private extern static void nvttSetOutputOptionsOutputHandler(IntPtr outputOptions, WriteDataDelegate writeData, ImageDelegate image);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
internal IntPtr options;
|
||||||
|
|
||||||
public OutputOptions()
|
public OutputOptions()
|
||||||
{
|
{
|
||||||
options = nvttCreateOutputOptions();
|
options = nvttCreateOutputOptions();
|
||||||
|
nvttSetOutputOptionsErrorHandler(options, new ErrorHandler(ErrorCallback));
|
||||||
}
|
}
|
||||||
public ~OutputOptions()
|
~OutputOptions()
|
||||||
{
|
{
|
||||||
nvttDestroyOutputOptions(options);
|
nvttDestroyOutputOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFileName(string fileName)
|
public void SetFileName(string fileName)
|
||||||
{
|
{
|
||||||
nvttSetOutputOptionsFileName(options, fileName);
|
nvttSetOutputOptionsFileName(options, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event ErrorHandler Error;
|
||||||
|
|
||||||
|
// @@ Add OutputHandler interface.
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public static class Compressor
|
#region public static class Compressor
|
||||||
public static class Compressor
|
public static class Compressor
|
||||||
{
|
{
|
||||||
#region Bindings
|
#region Bindings
|
||||||
[DllImport("nvtt")]
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
private extern static bool nvttCompress(IntPtr inputOptions, IntPtr compressionOptions, IntPtr outputOptions);
|
private extern static bool nvttCompress(IntPtr inputOptions, IntPtr compressionOptions, IntPtr outputOptions);
|
||||||
|
|
||||||
[DllImport("nvtt")]
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
private extern static void nvttEstimateSize(IntPtr inputOptions, IntPtr compressionOptions);
|
private extern static int nvttEstimateSize(IntPtr inputOptions, IntPtr compressionOptions);
|
||||||
|
|
||||||
|
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
|
||||||
|
private static extern IntPtr nvttErrorString(Error error);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public bool Compress(InputOptions inputOptions, CompressionOptions compressionOptions, OutputOptions outputOptions)
|
public static bool Compress(InputOptions inputOptions, CompressionOptions compressionOptions, OutputOptions outputOptions)
|
||||||
{
|
{
|
||||||
nvttCompress(inputOptions.options, compressionOptions.options, outputOptions.options);
|
return nvttCompress(inputOptions.options, compressionOptions.options, outputOptions.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool EstimateSize(InputOptions inputOptions, CompressionOptions compressionOptions)
|
public static int EstimateSize(InputOptions inputOptions, CompressionOptions compressionOptions)
|
||||||
{
|
{
|
||||||
nvttEstimateSize(inputOptions.options, compressionOptions.options);
|
return nvttEstimateSize(inputOptions.options, compressionOptions.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ErrorString(Error error)
|
||||||
|
{
|
||||||
|
return Marshal.PtrToStringAnsi(nvttErrorString(error));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
} // Nvidia.TextureTools namespace
|
} // Nvidia.TextureTools namespace
|
||||||
|
@ -87,9 +87,8 @@ namespace nvtt
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Compression options. This class describes the desired compression format and other compression settings.
|
/// Compression options. This class describes the desired compression format and other compression settings.
|
||||||
class CompressionOptions
|
struct CompressionOptions
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
NVTT_API CompressionOptions();
|
NVTT_API CompressionOptions();
|
||||||
NVTT_API ~CompressionOptions();
|
NVTT_API ~CompressionOptions();
|
||||||
|
|
||||||
@ -107,7 +106,7 @@ namespace nvtt
|
|||||||
// Set color mask to describe the RGB/RGBA format.
|
// Set color mask to describe the RGB/RGBA format.
|
||||||
NVTT_API void setPixelFormat(unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask);
|
NVTT_API void setPixelFormat(unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask);
|
||||||
|
|
||||||
NVTT_API void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold/*= 127*/);
|
NVTT_API void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold = 127);
|
||||||
|
|
||||||
//private:
|
//private:
|
||||||
struct Private;
|
struct Private;
|
||||||
@ -216,7 +215,7 @@ namespace nvtt
|
|||||||
|
|
||||||
// Set color transforms. @@ Not implemented!
|
// Set color transforms. @@ Not implemented!
|
||||||
NVTT_API void setColorTransform(ColorTransform t);
|
NVTT_API void setColorTransform(ColorTransform t);
|
||||||
NVTT_API void setLinearTransfrom(int channel, float w0, float w1, float w2, float w3);
|
NVTT_API void setLinearTransform(int channel, float w0, float w1, float w2, float w3);
|
||||||
|
|
||||||
// Set resizing options. @@ Not fully tested!
|
// Set resizing options. @@ Not fully tested!
|
||||||
NVTT_API void setMaxExtents(int d);
|
NVTT_API void setMaxExtents(int d);
|
||||||
|
@ -29,6 +29,82 @@ NvttBoolean nvttSetInputOptionsMipmapData(NvttInputOptions * inputOptions, const
|
|||||||
return (NvttBoolean)inputOptions->setMipmapData(data, w, h, d, face, mipmap);
|
return (NvttBoolean)inputOptions->setMipmapData(data, w, h, d, face, mipmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsFormat(NvttInputOptions * inputOptions, NvttInputFormat format)
|
||||||
|
{
|
||||||
|
inputOptions->setFormat((nvtt::InputFormat)format);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsAlphaMode(NvttInputOptions * inputOptions, NvttAlphaMode alphaMode)
|
||||||
|
{
|
||||||
|
inputOptions->setAlphaMode((nvtt::AlphaMode)alphaMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsGamma(NvttInputOptions * inputOptions, float inputGamma, float outputGamma)
|
||||||
|
{
|
||||||
|
inputOptions->setGamma(inputGamma, outputGamma);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void nvttSetInputOptionsWrapMode(NvttInputOptions * inputOptions, NvttWrapMode mode)
|
||||||
|
{
|
||||||
|
inputOptions->setWrapMode((nvtt::WrapMode)mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsMipmapping(NvttInputOptions * inputOptions, NvttBoolean generateMipmaps, NvttMipmapFilter filter, int maxLevel)
|
||||||
|
{
|
||||||
|
inputOptions->setMipmapping(generateMipmaps != NVTT_False, (nvtt::MipmapFilter)filter, maxLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsKaiserParameters(NvttInputOptions * inputOptions, float width, float alpha, float stretch)
|
||||||
|
{
|
||||||
|
inputOptions->setKaiserParameters(width, alpha, stretch);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsNormalMap(NvttInputOptions * inputOptions, NvttBoolean b)
|
||||||
|
{
|
||||||
|
inputOptions->setNormalMap(b != NVTT_False);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsConvertToNormalMap(NvttInputOptions * inputOptions, NvttBoolean convert)
|
||||||
|
{
|
||||||
|
inputOptions->setConvertToNormalMap(convert != NVTT_False);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsHeightEvaluation(NvttInputOptions * inputOptions, float redScale, float greenScale, float blueScale, float alphaScale)
|
||||||
|
{
|
||||||
|
inputOptions->setHeightEvaluation(redScale, greenScale, blueScale, alphaScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsNormalFilter(NvttInputOptions * inputOptions, float small, float medium, float big, float large)
|
||||||
|
{
|
||||||
|
inputOptions->setNormalFilter(small, medium, big, large);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsNormalizeMipmaps(NvttInputOptions * inputOptions, NvttBoolean b)
|
||||||
|
{
|
||||||
|
inputOptions->setNormalizeMipmaps(b != NVTT_False);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsColorTransform(NvttInputOptions * inputOptions, NvttColorTransform t)
|
||||||
|
{
|
||||||
|
inputOptions->setColorTransform((nvtt::ColorTransform)t);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsLinearTransfrom(NvttInputOptions * inputOptions, int channel, float w0, float w1, float w2, float w3)
|
||||||
|
{
|
||||||
|
inputOptions->setLinearTransform(channel, w0, w1, w2, w3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsMaxExtents(NvttInputOptions * inputOptions, int dim)
|
||||||
|
{
|
||||||
|
inputOptions->setMaxExtents(dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttSetInputOptionsRoundMode(NvttInputOptions * inputOptions, NvttRoundMode mode)
|
||||||
|
{
|
||||||
|
inputOptions->setRoundMode((nvtt::RoundMode)mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Compression Options
|
// Compression Options
|
||||||
NvttCompressionOptions * nvttCreateCompressionOptions()
|
NvttCompressionOptions * nvttCreateCompressionOptions()
|
||||||
@ -51,11 +127,26 @@ void nvttSetCompressionOptionsQuality(NvttCompressionOptions * compressionOption
|
|||||||
compressionOptions->setQuality((nvtt::Quality)quality);
|
compressionOptions->setQuality((nvtt::Quality)quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nvttSetCompressionOptionsColorWeights(NvttCompressionOptions * compressionOptions, float red, float green, float blue, float alpha)
|
||||||
|
{
|
||||||
|
compressionOptions->setColorWeights(red, green, blue, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nvttEnableCompressionOptionsCudaCompression(NvttCompressionOptions * compressionOptions, NvttBoolean enable)
|
||||||
|
{
|
||||||
|
compressionOptions->enableCudaCompression(enable != NVTT_False);
|
||||||
|
}
|
||||||
|
|
||||||
void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask)
|
void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask)
|
||||||
{
|
{
|
||||||
compressionOptions->setPixelFormat(bitcount, rmask, gmask, bmask, amask);
|
compressionOptions->setPixelFormat(bitcount, rmask, gmask, bmask, amask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nvttSetCompressionOptionsQuantization(NvttCompressionOptions * compressionOptions, NvttBoolean colorDithering, NvttBoolean alphaDithering, NvttBoolean binaryAlpha, int alphaThreshold)
|
||||||
|
{
|
||||||
|
compressionOptions->setQuantization(colorDithering != NVTT_False, alphaDithering != NVTT_False, binaryAlpha != NVTT_False, alphaThreshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Output Options
|
// Output Options
|
||||||
NvttOutputOptions * nvttCreateOutputOptions()
|
NvttOutputOptions * nvttCreateOutputOptions()
|
||||||
@ -73,16 +164,34 @@ void nvttSetOutputOptionsFileName(NvttOutputOptions * outputOptions, const char
|
|||||||
outputOptions->setFileName(fileName);
|
outputOptions->setFileName(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nvttSetOutputOptionsOutputHeader(NvttOutputOptions * outputOptions, NvttBoolean b)
|
||||||
|
{
|
||||||
|
outputOptions->setOutputHeader(b != NVTT_False);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
void nvttSetOutputOptionsErrorHandler(NvttOutputOptions * outputOptions, nvttErrorHandler errorHandler)
|
||||||
|
{
|
||||||
|
outputOptions->setErrorHandler(errorHandler);
|
||||||
|
}
|
||||||
|
|
||||||
// Main entrypoint of the compression library.
|
void nvttSetOutputOptionsOutputHandler(NvttOutputOptions * outputOptions, nvttOutputHandler outputHandler, nvttImageHandler imageHandler)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// Main entrypoints.
|
||||||
NvttBoolean nvttCompress(const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions, const NvttOutputOptions * outputOptions)
|
NvttBoolean nvttCompress(const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions, const NvttOutputOptions * outputOptions)
|
||||||
{
|
{
|
||||||
return (NvttBoolean)nvtt::compress(*inputOptions, *outputOptions, *compressionOptions);
|
return (NvttBoolean)nvtt::compress(*inputOptions, *outputOptions, *compressionOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Estimate the size of compressing the input with the given options.
|
|
||||||
int nvttEstimateSize(const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions)
|
int nvttEstimateSize(const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions)
|
||||||
{
|
{
|
||||||
return nvtt::estimateSize(*inputOptions, *compressionOptions);
|
return nvtt::estimateSize(*inputOptions, *compressionOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char * nvttErrorString(NvttError e)
|
||||||
|
{
|
||||||
|
return nvtt::errorString((nvtt::Error)e);
|
||||||
|
}
|
||||||
|
@ -24,20 +24,27 @@
|
|||||||
#ifndef NVTT_WRAPPER_H
|
#ifndef NVTT_WRAPPER_H
|
||||||
#define NVTT_WRAPPER_H
|
#define NVTT_WRAPPER_H
|
||||||
|
|
||||||
#include <nvcore/nvcore.h>
|
|
||||||
|
|
||||||
// Function linkage
|
// Function linkage
|
||||||
#if NVTT_SHARED
|
#if NVTT_SHARED
|
||||||
#ifdef NVTT_EXPORTS
|
|
||||||
#define NVTT_API DLL_EXPORT
|
#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined __MINGW32__
|
||||||
#define NVTT_CLASS DLL_EXPORT_CLASS
|
# ifdef NVTT_EXPORTS
|
||||||
#else
|
# define NVTT_API __declspec(dllexport)
|
||||||
#define NVTT_API DLL_IMPORT
|
# else
|
||||||
#define NVTT_CLASS DLL_IMPORT
|
# define NVTT_API __declspec(dllimport)
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
#define NVTT_API
|
#if defined __GNUC__ >= 4
|
||||||
#define NVTT_CLASS
|
# ifdef NVTT_EXPORTS
|
||||||
|
# define NVTT_API __attribute__((visibility("default")))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // NVTT_SHARED
|
||||||
|
|
||||||
|
#if !defined NVTT_API
|
||||||
|
# define NVTT_API
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -83,6 +90,14 @@ typedef enum
|
|||||||
NVTT_Quality_Highest,
|
NVTT_Quality_Highest,
|
||||||
} NvttQuality;
|
} NvttQuality;
|
||||||
|
|
||||||
|
/// Wrap modes.
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
NVTT_WrapMode_Clamp,
|
||||||
|
NVTT_WrapMode_Repeat,
|
||||||
|
NVTT_WrapMode_Mirror,
|
||||||
|
} NvttWrapMode;
|
||||||
|
|
||||||
/// Texture types.
|
/// Texture types.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@ -90,10 +105,59 @@ typedef enum
|
|||||||
NVTT_TextureType_Cube,
|
NVTT_TextureType_Cube,
|
||||||
} NvttTextureType;
|
} NvttTextureType;
|
||||||
|
|
||||||
|
/// Input formats.
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
NVTT_InputFormat_BGRA_8UB,
|
||||||
|
} NvttInputFormat;
|
||||||
|
|
||||||
|
/// Mipmap downsampling filters.
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
NVTT_MipmapFilter_Box,
|
||||||
|
NVTT_MipmapFilter_Triangle,
|
||||||
|
NVTT_MipmapFilter_Kaiser,
|
||||||
|
} NvttMipmapFilter;
|
||||||
|
|
||||||
|
/// Color transformation.
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
NVTT_ColorTransform_None,
|
||||||
|
NVTT_ColorTransform_Linear,
|
||||||
|
} NvttColorTransform;
|
||||||
|
|
||||||
|
/// Extents rounding mode.
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
NVTT_RoundMode_None,
|
||||||
|
NVTT_RoundMode_ToNextPowerOfTwo,
|
||||||
|
NVTT_RoundMode_ToNearestPowerOfTwo,
|
||||||
|
NVTT_RoundMode_ToPreviousPowerOfTwo,
|
||||||
|
} NvttRoundMode;
|
||||||
|
|
||||||
|
/// Alpha mode.
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
NVTT_AlphaMode_None,
|
||||||
|
NVTT_AlphaMode_Transparency,
|
||||||
|
NVTT_AlphaMode_Premultiplied,
|
||||||
|
} NvttAlphaMode;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
NVTT_Error_InvalidInput,
|
||||||
|
NVTT_Error_UserInterruption,
|
||||||
|
NVTT_Error_UnsupportedFeature,
|
||||||
|
NVTT_Error_CudaError,
|
||||||
|
NVTT_Error_Unknown,
|
||||||
|
NVTT_Error_FileOpen,
|
||||||
|
NVTT_Error_FileWrite,
|
||||||
|
} NvttError;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
NVTT_True,
|
|
||||||
NVTT_False,
|
NVTT_False,
|
||||||
|
NVTT_True,
|
||||||
} NvttBoolean;
|
} NvttBoolean;
|
||||||
|
|
||||||
|
|
||||||
@ -101,6 +165,11 @@ typedef enum
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
//typedef void (* nvttErrorHandler)(NvttError e);
|
||||||
|
//typedef void (* nvttOutputHandler)(const void * data, int size);
|
||||||
|
//typedef void (* nvttImageHandler)(int size, int width, int height, int depth, int face, int miplevel);
|
||||||
|
|
||||||
// Input Options
|
// Input Options
|
||||||
NVTT_API NvttInputOptions * nvttCreateInputOptions();
|
NVTT_API NvttInputOptions * nvttCreateInputOptions();
|
||||||
NVTT_API void nvttDestroyInputOptions(NvttInputOptions * inputOptions);
|
NVTT_API void nvttDestroyInputOptions(NvttInputOptions * inputOptions);
|
||||||
@ -108,6 +177,21 @@ NVTT_API void nvttDestroyInputOptions(NvttInputOptions * inputOptions);
|
|||||||
NVTT_API void nvttSetInputOptionsTextureLayout(NvttInputOptions * inputOptions, NvttTextureType type, int w, int h, int d);
|
NVTT_API void nvttSetInputOptionsTextureLayout(NvttInputOptions * inputOptions, NvttTextureType type, int w, int h, int d);
|
||||||
NVTT_API void nvttResetInputOptionsTextureLayout(NvttInputOptions * inputOptions);
|
NVTT_API void nvttResetInputOptionsTextureLayout(NvttInputOptions * inputOptions);
|
||||||
NVTT_API NvttBoolean nvttSetInputOptionsMipmapData(NvttInputOptions * inputOptions, const void * data, int w, int h, int d, int face, int mipmap);
|
NVTT_API NvttBoolean nvttSetInputOptionsMipmapData(NvttInputOptions * inputOptions, const void * data, int w, int h, int d, int face, int mipmap);
|
||||||
|
NVTT_API void nvttSetInputOptionsFormat(NvttInputOptions * inputOptions, NvttInputFormat format);
|
||||||
|
NVTT_API void nvttSetInputOptionsAlphaMode(NvttInputOptions * inputOptions, NvttAlphaMode alphaMode);
|
||||||
|
NVTT_API void nvttSetInputOptionsGamma(NvttInputOptions * inputOptions, float inputGamma, float outputGamma);
|
||||||
|
NVTT_API void nvttSetInputOptionsWrapMode(NvttInputOptions * inputOptions, NvttWrapMode mode);
|
||||||
|
NVTT_API void nvttSetInputOptionsMipmapping(NvttInputOptions * inputOptions, NvttBoolean generateMipmaps, NvttMipmapFilter filter, int maxLevel);
|
||||||
|
NVTT_API void nvttSetInputOptionsKaiserParameters(NvttInputOptions * inputOptions, float width, float alpha, float stretch);
|
||||||
|
NVTT_API void nvttSetInputOptionsNormalMap(NvttInputOptions * inputOptions, NvttBoolean b);
|
||||||
|
NVTT_API void nvttSetInputOptionsConvertToNormalMap(NvttInputOptions * inputOptions, NvttBoolean convert);
|
||||||
|
NVTT_API void nvttSetInputOptionsHeightEvaluation(NvttInputOptions * inputOptions, float redScale, float greenScale, float blueScale, float alphaScale);
|
||||||
|
NVTT_API void nvttSetInputOptionsNormalFilter(NvttInputOptions * inputOptions, float small, float medium, float big, float large);
|
||||||
|
NVTT_API void nvttSetInputOptionsNormalizeMipmaps(NvttInputOptions * inputOptions, NvttBoolean b);
|
||||||
|
NVTT_API void nvttSetInputOptionsColorTransform(NvttInputOptions * inputOptions, NvttColorTransform t);
|
||||||
|
NVTT_API void nvttSetInputOptionsLinearTransform(NvttInputOptions * inputOptions, int channel, float w0, float w1, float w2, float w3);
|
||||||
|
NVTT_API void nvttSetInputOptionsMaxExtents(NvttInputOptions * inputOptions, int dim);
|
||||||
|
NVTT_API void nvttSetInputOptionsRoundMode(NvttInputOptions * inputOptions, NvttRoundMode mode);
|
||||||
|
|
||||||
|
|
||||||
// Compression Options
|
// Compression Options
|
||||||
@ -116,14 +200,20 @@ NVTT_API void nvttDestroyCompressionOptions(NvttCompressionOptions * compression
|
|||||||
|
|
||||||
NVTT_API void nvttSetCompressionOptionsFormat(NvttCompressionOptions * compressionOptions, NvttFormat format);
|
NVTT_API void nvttSetCompressionOptionsFormat(NvttCompressionOptions * compressionOptions, NvttFormat format);
|
||||||
NVTT_API void nvttSetCompressionOptionsQuality(NvttCompressionOptions * compressionOptions, NvttQuality quality);
|
NVTT_API void nvttSetCompressionOptionsQuality(NvttCompressionOptions * compressionOptions, NvttQuality quality);
|
||||||
|
NVTT_API void nvttSetCompressionOptionsColorWeights(NvttCompressionOptions * compressionOptions, float red, float green, float blue, float alpha);
|
||||||
|
NVTT_API void nvttEnableCompressionOptionsCudaCompression(NvttCompressionOptions * compressionOptions, NvttBoolean enable);
|
||||||
NVTT_API void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask);
|
NVTT_API void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask);
|
||||||
|
NVTT_API void nvttSetCompressionOptionsQuantization(NvttCompressionOptions * compressionOptions, NvttBoolean colorDithering, NvttBoolean alphaDithering, NvttBoolean binaryAlpha, int alphaThreshold);
|
||||||
|
|
||||||
|
|
||||||
// Output Options
|
// Output Options
|
||||||
NVTT_API NvttOutputOptions * nvttCreateOutputOptions();
|
NVTT_API NvttOutputOptions * nvttCreateOutputOptions();
|
||||||
NVTT_API void nvttDestroyOutputOptions(NvttOutputOptions * outputOptions);
|
NVTT_API void nvttDestroyOutputOptions(NvttOutputOptions * outputOptions);
|
||||||
|
|
||||||
NVTT_API void nvttSetOutputOptionsFileName(NvttOutputOptions * outputOptions, const char * fileName);
|
NVTT_API void nvttSetOutputOptionsFileName(NvttOutputOptions * outputOptions, const char * fileName);
|
||||||
|
NVTT_API void nvttSetOutputOptionsOutputHeader(NvttOutputOptions * outputOptions, NvttBoolean b);
|
||||||
|
//NVTT_API void nvttSetOutputOptionsErrorHandler(NvttOutputOptions * outputOptions, nvttErrorHandler errorHandler);
|
||||||
|
//NVTT_API void nvttSetOutputOptionsOutputHandler(NvttOutputOptions * outputOptions, nvttOutputHandler outputHandler, nvttImageHandler imageHandler);
|
||||||
|
|
||||||
|
|
||||||
// Main entrypoint of the compression library.
|
// Main entrypoint of the compression library.
|
||||||
@ -132,6 +222,8 @@ NVTT_API NvttBoolean nvttCompress(NvttInputOptions * inputOptions, NvttCompressi
|
|||||||
// Estimate the size of compressing the input with the given options.
|
// Estimate the size of compressing the input with the given options.
|
||||||
NVTT_API int nvttEstimateSize(NvttInputOptions * inputOptions, NvttCompressionOptions * compressionOptions);
|
NVTT_API int nvttEstimateSize(NvttInputOptions * inputOptions, NvttCompressionOptions * compressionOptions);
|
||||||
|
|
||||||
|
// Return string for the given error.
|
||||||
|
NVTT_API const char * nvttErrorString(NvttError e);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
Loading…
Reference in New Issue
Block a user