@ -32,13 +32,26 @@ namespace Nvidia.TextureTools
BC4 ,
BC5 ,
DXT1n , // Not supported on CPU yet .
CTX1 , // Not supported on CPU yet .
DXT1n , // Not supported .
CTX1 , // Not supported .
BC6 ,
BC7 , // Not supported yet.
BC7 ,
}
# endregion
DXT1_Luma ,
#region public enum PixelType
/// <summary>
/// Pixel types. These basically indicate how the output should be interpreted, but do not have any influence over the input. They are only relevant in RGBA mode.
/// </summary>
enum PixelType
{
UnsignedNorm = 0 ,
SignedNorm = 1 , // Not supported yet.
UnsignedInt = 2 , // Not supported yet.
SignedInt = 3 , // Not supported yet.
Float = 4 ,
UnsignedFloat = 5 ,
}
# endregion
@ -55,6 +68,18 @@ namespace Nvidia.TextureTools
}
# endregion
#region public enum Decoder
/// <summary>
/// DXT decoder.
/// </summary>
enum Decoder
{
Decoder_D3D10 ,
Decoder_D3D9 ,
Decoder_NV5x ,
} ;
# endregion
#region public enum WrapMode
/// <summary>
/// Wrap modes.
@ -75,6 +100,7 @@ namespace Nvidia.TextureTools
{
Texture2D ,
TextureCube ,
Texture3D ,
}
# endregion
@ -84,7 +110,9 @@ namespace Nvidia.TextureTools
/// </summary>
public enum InputFormat
{
BGRA_8UB
BGRA_8UB , // Normalized [0, 1] 8 bit fixed point.
RGBA_16F , // 16 bit floating point.
RGBA_32F , // 32 bit floating point.
}
# endregion
@ -100,14 +128,16 @@ namespace Nvidia.TextureTools
}
# endregion
#region public enum ColorTransform
#region public enum ResizeFilter
/// <summary>
/// Color transformation .
/// Texture resize filters .
/// </summary>
public enum ColorTransform
public enum ResizeFilter
{
None ,
Linear
Box ,
Triangle ,
Kaiser ,
Mitchell
}
# endregion
@ -136,6 +166,31 @@ namespace Nvidia.TextureTools
}
# endregion
#region public enum CubeLayout
/// <summary>Cube layout formats.</summary>
/// (New in NVTT 2.1)
public enum CubeLayout
{
VerticalCross ,
HorizontalCross ,
Column ,
Row ,
LatitudeLongitude
} ;
# endregion
#region public enum EdgeFixup
/// <summary>Cube map edge fixup methods.</summary>
/// (New in NVTT 2.1)
public enum EdgeFixup
{
None ,
Stretch ,
Warp ,
Average ,
} ;
# endregion
#region public enum Error
/// <summary>
/// Error codes.
@ -212,12 +267,6 @@ namespace Nvidia.TextureTools
[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 ) ;
@ -315,16 +364,6 @@ namespace Nvidia.TextureTools
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 ) ;
@ -555,4 +594,158 @@ namespace Nvidia.TextureTools
}
# endregion
#region public static class Surface
public class Surface
{
#region Bindings
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static IntPtr nvttCreateSurface ( ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static IntPtr nvttCreateSurface ( IntPtr surface ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static void nvttDestroySurface ( IntPtr surface ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static void nvttSurfaceSetWrapMode ( IntPtr surface , WrapMode wrapMode ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static WrapMode nvttSurfaceGetWrapMode ( IntPtr surface ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static void nvttSurfaceSetAlphaMode ( IntPtr surface , AlphaMode alphaMode ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static AlphaMode nvttSurfaceGetAlphaMode ( IntPtr surface ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static void nvttSurfaceSetNormalMap ( IntPtr surface , bool isNormalMap ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static bool nvttSurfaceGetNormalMap ( IntPtr surface ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static int nvttSurfaceGetWidth ( IntPtr surface ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static int nvttSurfaceGetHeight ( IntPtr surface ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static int nvttSurfaceGetDepth ( IntPtr surface ) ;
# endregion
internal IntPtr surface ;
public Surface ( )
{
surface = nvttCreateSurface ( ) ;
}
public Surface ( Surface s )
{
surface = nvttCreateSurface ( surface ) ;
}
~ Surface ( )
{
nvttDestroySurface ( surface ) ;
}
#region Properties
public WrapMode WrapMode {
set { nvttSurfaceSetWrapMode ( surface , value ) ; }
get { return nvttSurfaceGetWrapMode ( surface ) ; }
}
public AlphaMode AlphaMode {
set { nvttSurfaceSetAlphaMode ( surface , value ) ; }
get { return nvttSurfaceGetAlphaMode ( surface ) ; }
}
public bool IsNormalMap
{
set { nvttSurfaceSetNormalMap ( surface , value ) ; }
get { return nvttSurfaceGetNormalMap ( surface ) ; }
}
//public bool isNull();
public int Width
{
get { return nvttSurfaceGetWidth ( surface ) ; }
}
public int Height
{
get { return nvttSurfaceGetHeight ( surface ) ; }
}
public int Depth
{
get { return nvttSurfaceGetDepth ( surface ) ; }
}
# endregion
//public TextureType type();
//public int countMipmaps();
//public int countMipmaps(int min_size);
//public float alphaTestCoverage(float alphaRef = 0.5);
//public float average(int channel, int alpha_channel = -1, float gamma = 2.2f);
//public IntPtr data();
//public IntPtr channel(int i);
//public void histogram(int channel, float rangeMin, float rangeMax, int binCount, int binPtr[]);
//public void range(int channel, out float rangeMin, out float rangeMax, int alpha_channel = -1, float alpha_ref = 0.f);
// @@ TODO
}
# endregion
#region public static class CubeSurface
public class CubeSurface
{
#region Bindings
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static IntPtr nvttCreateCubeSurface ( ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static IntPtr nvttCreateCubeSurface ( IntPtr surface ) ;
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static void nvttDestroyCubeSurface ( IntPtr surface ) ;
# endregion
internal IntPtr cubeSurface ;
public CubeSurface ( )
{
cubeSurface = nvttCreateCubeSurface ( ) ;
}
public CubeSurface ( CubeSurface cs )
{
cubeSurface = nvttCreateCubeSurface ( cs . cubeSurface ) ;
}
~ CubeSurface ( )
{
nvttDestroyCubeSurface ( cubeSurface ) ;
}
//public bool IsNull(); // @@ Use properties?
//public int EdgeLength(); // @@ Use properties?
//public int CountMipmaps(); // @@ Use properties?
//public bool Load(String fileName, int mipmap);
//public bool Save(String fileName) const;
//public Surface & Face(int face);
//public const Surface & Face(int face) const;
// @@ TODO
}
# endregion
} // Nvidia.TextureTools namespace