nvtt.h | nvtt.h | |||
---|---|---|---|---|
skipping to change at line 52 | skipping to change at line 52 | |||
#endif | #endif | |||
#endif // NVTT_SHARED | #endif // NVTT_SHARED | |||
#if !defined NVTT_API | #if !defined NVTT_API | |||
# define NVTT_API | # define NVTT_API | |||
#endif | #endif | |||
#define NVTT_VERSION 200 | #define NVTT_VERSION 200 | |||
#define NVTT_DECLARE_PIMPL(Class) \ | ||||
private: \ | ||||
Class(const Class &); \ | ||||
void operator=(const Class &); \ | ||||
public: \ | ||||
struct Private; \ | ||||
Private & m | ||||
// Public interface. | // Public interface. | |||
namespace nvtt | namespace nvtt | |||
{ | { | |||
/// Supported compression formats. | /// Supported compression formats. | |||
enum Format | enum Format | |||
{ | { | |||
// No compression. | // No compression. | |||
Format_RGB, | Format_RGB, | |||
Format_RGBA = Format_RGB, | Format_RGBA = Format_RGB, | |||
skipping to change at line 91 | skipping to change at line 99 | |||
{ | { | |||
Quality_Fastest, | Quality_Fastest, | |||
Quality_Normal, | Quality_Normal, | |||
Quality_Production, | Quality_Production, | |||
Quality_Highest, | Quality_Highest, | |||
}; | }; | |||
/// Compression options. This class describes the desired compressio n format and other compression settings. | /// Compression options. This class describes the desired compressio n format and other compression settings. | |||
struct CompressionOptions | struct CompressionOptions | |||
{ | { | |||
NVTT_DECLARE_PIMPL(CompressionOptions); | ||||
NVTT_API CompressionOptions(); | NVTT_API CompressionOptions(); | |||
NVTT_API ~CompressionOptions(); | NVTT_API ~CompressionOptions(); | |||
NVTT_API void reset(); | NVTT_API void reset(); | |||
NVTT_API void setFormat(Format format); | NVTT_API void setFormat(Format format); | |||
NVTT_API void setQuality(Quality quality); | NVTT_API void setQuality(Quality quality); | |||
NVTT_API void setColorWeights(float red, float green, float blue, float alpha = 1.0f); | NVTT_API void setColorWeights(float red, float green, float blue, float alpha = 1.0f); | |||
NVTT_API void setExternalCompressor(const char * name); | NVTT_API void setExternalCompressor(const char * name); | |||
// 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 alph aDithering, bool binaryAlpha, int alphaThreshold = 127); | NVTT_API void setQuantization(bool colorDithering, bool alph aDithering, bool binaryAlpha, int alphaThreshold = 127); | |||
//private: | ||||
struct Private; | ||||
Private & m; | ||||
}; | }; | |||
/// Wrap modes. | /// Wrap modes. | |||
enum WrapMode | enum WrapMode | |||
{ | { | |||
WrapMode_Clamp, | WrapMode_Clamp, | |||
WrapMode_Repeat, | WrapMode_Repeat, | |||
WrapMode_Mirror, | WrapMode_Mirror, | |||
}; | }; | |||
skipping to change at line 171 | skipping to change at line 177 | |||
enum AlphaMode | enum AlphaMode | |||
{ | { | |||
AlphaMode_None, | AlphaMode_None, | |||
AlphaMode_Transparency, | AlphaMode_Transparency, | |||
AlphaMode_Premultiplied, | AlphaMode_Premultiplied, | |||
}; | }; | |||
/// Input options. Specify format and layout of the input texture. | /// Input options. Specify format and layout of the input texture. | |||
struct InputOptions | struct InputOptions | |||
{ | { | |||
NVTT_DECLARE_PIMPL(InputOptions); | ||||
NVTT_API InputOptions(); | NVTT_API InputOptions(); | |||
NVTT_API ~InputOptions(); | NVTT_API ~InputOptions(); | |||
// Set default options. | // Set default options. | |||
NVTT_API void reset(); | NVTT_API void reset(); | |||
// Setup input layout. | // Setup input layout. | |||
NVTT_API void setTextureLayout(TextureType type, int w, int h, int d = 1); | NVTT_API void setTextureLayout(TextureType type, int w, int h, int d = 1); | |||
NVTT_API void resetTextureLayout(); | NVTT_API void resetTextureLayout(); | |||
skipping to change at line 215 | skipping to change at line 223 | |||
NVTT_API void setNormalFilter(float sm, float medium, float big, float large); | NVTT_API void setNormalFilter(float sm, float medium, float big, float large); | |||
NVTT_API void setNormalizeMipmaps(bool b); | NVTT_API void setNormalizeMipmaps(bool b); | |||
// 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 setLinearTransform(int channel, float w0, floa t w1, float w2, float w3); | NVTT_API void setLinearTransform(int channel, float w0, floa t w1, float w2, float w3); | |||
// Set resizing options. | // Set resizing options. | |||
NVTT_API void setMaxExtents(int d); | NVTT_API void setMaxExtents(int d); | |||
NVTT_API void setRoundMode(RoundMode mode); | NVTT_API void setRoundMode(RoundMode mode); | |||
//private: | ||||
struct Private; | ||||
Private & m; | ||||
}; | }; | |||
/// Output handler. | /// Output handler. | |||
struct OutputHandler | struct OutputHandler | |||
{ | { | |||
virtual ~OutputHandler() {} | virtual ~OutputHandler() {} | |||
/// Indicate the start of a new compressed image that's part of the final texture. | /// Indicate the start of a new compressed image that's part of the final texture. | |||
virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel) = 0; | virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel) = 0; | |||
skipping to change at line 257 | skipping to change at line 261 | |||
virtual ~ErrorHandler() {} | virtual ~ErrorHandler() {} | |||
// Signal error. | // Signal error. | |||
virtual void error(Error e) = 0; | virtual void error(Error e) = 0; | |||
}; | }; | |||
/// Output Options. This class holds pointers to the interfaces that are used to report the output of | /// Output Options. This class holds pointers to the interfaces that are used to report the output of | |||
/// the compressor to the user. | /// the compressor to the user. | |||
struct OutputOptions | struct OutputOptions | |||
{ | { | |||
NVTT_DECLARE_PIMPL(OutputOptions); | ||||
NVTT_API OutputOptions(); | NVTT_API OutputOptions(); | |||
NVTT_API ~OutputOptions(); | NVTT_API ~OutputOptions(); | |||
// Set default options. | // Set default options. | |||
NVTT_API void reset(); | NVTT_API void reset(); | |||
NVTT_API void setFileName(const char * fileName); | NVTT_API void setFileName(const char * fileName); | |||
NVTT_API void setOutputHandler(OutputHandler * outputHandler ); | NVTT_API void setOutputHandler(OutputHandler * outputHandler ); | |||
NVTT_API void setErrorHandler(ErrorHandler * errorHandler); | NVTT_API void setErrorHandler(ErrorHandler * errorHandler); | |||
NVTT_API void setOutputHeader(bool outputHeader); | NVTT_API void setOutputHeader(bool outputHeader); | |||
//private: | ||||
struct Private; | ||||
Private & m; | ||||
}; | }; | |||
/// Texture compressor. | /// Texture compressor. | |||
struct Compressor | struct Compressor | |||
{ | { | |||
NVTT_DECLARE_PIMPL(Compressor); | ||||
NVTT_API Compressor(); | NVTT_API Compressor(); | |||
NVTT_API ~Compressor(); | NVTT_API ~Compressor(); | |||
NVTT_API void enableCudaAcceleration(bool enable); | NVTT_API void enableCudaAcceleration(bool enable); | |||
NVTT_API bool isCudaAccelerationEnabled() const; | NVTT_API bool isCudaAccelerationEnabled() const; | |||
// Main entrypoint of the compression library. | // Main entrypoint of the compression library. | |||
NVTT_API bool process(const InputOptions & inputOptions, con st CompressionOptions & compressionOptions, const OutputOptions & outputOpt ions) const; | NVTT_API bool process(const InputOptions & inputOptions, con st CompressionOptions & compressionOptions, const OutputOptions & outputOpt ions) const; | |||
// 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 estimateSize(const InputOptions & inputOptions, const CompressionOptions & compressionOptions) const; | NVTT_API int estimateSize(const InputOptions & inputOptions, const CompressionOptions & compressionOptions) const; | |||
//private: | ||||
struct Private; | ||||
Private & m; | ||||
}; | }; | |||
// Return string for the given error code. | // Return string for the given error code. | |||
NVTT_API const char * errorString(Error e); | NVTT_API const char * errorString(Error e); | |||
// Return NVTT version. | // Return NVTT version. | |||
NVTT_API unsigned int version(); | NVTT_API unsigned int version(); | |||
} // nvtt namespace | } // nvtt namespace | |||
End of changes. 9 change blocks. | ||||
16 lines changed or deleted | 16 lines changed or added | |||