Add kaiser filter parameters.

This commit is contained in:
castano 2007-11-22 01:02:01 +00:00
parent 365ab33e61
commit fd9ae63a4f
4 changed files with 23 additions and 9 deletions

View File

@ -90,6 +90,10 @@ void InputOptions::reset()
m.maxLevel = -1; m.maxLevel = -1;
m.mipmapFilter = MipmapFilter_Box; m.mipmapFilter = MipmapFilter_Box;
m.kaiserWidth = 10;
m.kaiserAlpha = 8.0f;
m.kaiserStretch = 0.75f;
m.normalizeMipmaps = false; m.normalizeMipmaps = false;
m.convertToNormalMap = false; m.convertToNormalMap = false;
m.heightFactors.set(0.0f, 0.0f, 0.0f, 1.0f); m.heightFactors.set(0.0f, 0.0f, 0.0f, 1.0f);
@ -207,13 +211,20 @@ void InputOptions::setWrapMode(WrapMode mode)
/// Set mipmapping options. /// Set mipmapping options.
void InputOptions::setMipmapping(bool generateMipmaps, MipmapFilter filter/*= MipmapFilter_Kaiser*/, int maxLevel/*= -1*/) void InputOptions::setMipmapping(bool generateMipmaps, MipmapFilter filter/*= MipmapFilter_Box*/, int maxLevel/*= -1*/)
{ {
m.generateMipmaps = generateMipmaps; m.generateMipmaps = generateMipmaps;
m.mipmapFilter = filter; m.mipmapFilter = filter;
m.maxLevel = maxLevel; m.maxLevel = maxLevel;
} }
/// Set Kaiser filter parameters.
void InputOptions::setKaiserParameters(int width, float alpha, float stretch)
{
m.kaiserWidth = width;
m.kaiserAlpha = alpha;
m.kaiserStretch = stretch;
}
/// Set quantization options. /// Set quantization options.
/// @warning Do not enable dithering unless you know what you are doing. Quantization /// @warning Do not enable dithering unless you know what you are doing. Quantization

View File

@ -68,7 +68,12 @@ namespace nvtt
bool generateMipmaps; bool generateMipmaps;
int maxLevel; int maxLevel;
MipmapFilter mipmapFilter; MipmapFilter mipmapFilter;
// Kaiser filter parameters.
uint kaiserWidth;
float kaiserAlpha;
float kaiserStretch;
// Normal map options. // Normal map options.
bool normalMap; bool normalMap;
bool normalizeMipmaps; bool normalizeMipmaps;

View File

@ -331,8 +331,8 @@ static FloatImage * createMipmap(const FloatImage * floatImage, const InputOptio
} }
else /*if (inputOptions.mipmapFilter == MipmapFilter_Kaiser)*/ else /*if (inputOptions.mipmapFilter == MipmapFilter_Kaiser)*/
{ {
Kernel1 kernel(10); Kernel1 kernel(inputOptions.kaiserWidth);
kernel.initKaiser(8.0, 0.75f); kernel.initKaiser(inputOptions.kaiserAlpha, inputOptions.kaiserStretch);
result = floatImage->downSample(kernel, (FloatImage::WrapMode)inputOptions.wrapMode); result = floatImage->downSample(kernel, (FloatImage::WrapMode)inputOptions.wrapMode);
} }

View File

@ -26,9 +26,6 @@
#include <nvcore/nvcore.h> #include <nvcore/nvcore.h>
//#define HAVE_S3QUANT
//#define HAVE_ATITC
// Function linkage // Function linkage
#if NVTT_SHARED #if NVTT_SHARED
#ifdef NVTT_EXPORTS #ifdef NVTT_EXPORTS
@ -173,8 +170,9 @@ namespace nvtt
NVTT_API void setWrapMode(WrapMode mode); NVTT_API void setWrapMode(WrapMode mode);
// Set mipmapping options. // Set mipmapping options.
NVTT_API void setMipmapping(bool generateMipmaps, MipmapFilter filter = MipmapFilter_Kaiser, int maxLevel = -1); NVTT_API void setMipmapping(bool generateMipmaps, MipmapFilter filter = MipmapFilter_Box, int maxLevel = -1);
NVTT_API void setKaiserParameters(int width, float alpha, float stretch);
// Set quantization options. // Set quantization options.
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);