From 3c90686e001412467dde5d9b5a2edbada964851d Mon Sep 17 00:00:00 2001 From: castano Date: Tue, 5 Feb 2008 00:28:13 +0000 Subject: [PATCH] Final API changes. Rename OutputHandler::mipmap method to beginImage. Add NVTT_VERSION. Add nvtt::version function. --- src/nvtt/Compressor.cpp | 2 +- src/nvtt/OutputOptions.h | 2 +- src/nvtt/nvtt.cpp | 6 ++++++ src/nvtt/nvtt.h | 8 ++++++-- src/nvtt/nvtt_wrapper.cpp | 5 +++++ src/nvtt/nvtt_wrapper.h | 3 +++ src/nvtt/tools/compress.cpp | 2 +- 7 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/nvtt/Compressor.cpp b/src/nvtt/Compressor.cpp index 9b98507..9d54405 100644 --- a/src/nvtt/Compressor.cpp +++ b/src/nvtt/Compressor.cpp @@ -384,7 +384,7 @@ bool Compressor::Private::compressMipmaps(uint f, const InputOptions::Private & if (outputOptions.outputHandler) { int size = computeImageSize(w, h, d, compressionOptions.bitcount, compressionOptions.format); - outputOptions.outputHandler->mipmap(size, w, h, d, f, m); + outputOptions.outputHandler->beginImage(size, w, h, d, f, m); } // @@ Where to do the color transform? diff --git a/src/nvtt/OutputOptions.h b/src/nvtt/OutputOptions.h index c0ed8bc..bddc28f 100644 --- a/src/nvtt/OutputOptions.h +++ b/src/nvtt/OutputOptions.h @@ -39,7 +39,7 @@ namespace nvtt { } - virtual void mipmap(int size, int width, int height, int depth, int face, int miplevel) + virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel) { // ignore. } diff --git a/src/nvtt/nvtt.cpp b/src/nvtt/nvtt.cpp index 263955a..5c9e884 100644 --- a/src/nvtt/nvtt.cpp +++ b/src/nvtt/nvtt.cpp @@ -47,3 +47,9 @@ const char * nvtt::errorString(Error e) return "Invalid error"; } +/// Return NVTT version. +unsigned int nvtt::version() +{ + return NVTT_VERSION; +} + diff --git a/src/nvtt/nvtt.h b/src/nvtt/nvtt.h index f04eec0..d8a2966 100644 --- a/src/nvtt/nvtt.h +++ b/src/nvtt/nvtt.h @@ -47,6 +47,8 @@ # define NVTT_API #endif +#define NVTT_VERSION 200 + // Public interface. namespace nvtt @@ -162,7 +164,7 @@ namespace nvtt { AlphaMode_None, AlphaMode_Transparency, - AlphaMode_Premultiplied, + AlphaMode_Premultiplied, }; /// Input options. Specify format and layout of the input texture. @@ -225,7 +227,7 @@ namespace nvtt virtual ~OutputHandler() {} /// Indicate the start of a new compressed image that's part of the final texture. - virtual void mipmap(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; /// Output data. Compressed data is output as soon as it's generated to minimize memory allocations. virtual bool writeData(const void * data, int size) = 0; @@ -298,6 +300,8 @@ namespace nvtt // Return string for the given error code. NVTT_API const char * errorString(Error e); + // Return NVTT version. + NVTT_API unsigned int version(); } // nvtt namespace diff --git a/src/nvtt/nvtt_wrapper.cpp b/src/nvtt/nvtt_wrapper.cpp index 571820f..66c16aa 100644 --- a/src/nvtt/nvtt_wrapper.cpp +++ b/src/nvtt/nvtt_wrapper.cpp @@ -201,3 +201,8 @@ const char * nvttErrorString(NvttError e) { return nvtt::errorString((nvtt::Error)e); } + +unsigned int nvttVersion() +{ + return nvtt::version(); +} diff --git a/src/nvtt/nvtt_wrapper.h b/src/nvtt/nvtt_wrapper.h index 116fe99..a953597 100644 --- a/src/nvtt/nvtt_wrapper.h +++ b/src/nvtt/nvtt_wrapper.h @@ -47,6 +47,8 @@ # define NVTT_API #endif +#define NVTT_VERSION 200 + #ifdef __cplusplus typedef struct nvtt::InputOptions NvttInputOptions; typedef struct nvtt::CompressionOptions NvttCompressionOptions; @@ -230,6 +232,7 @@ NVTT_API int nvttEstimateSize(const NvttCompressor * compressor, const NvttInput // Global functions. NVTT_API const char * nvttErrorString(NvttError e); +NVTT_API unsigned int nvttVersion(); #ifdef __cplusplus diff --git a/src/nvtt/tools/compress.cpp b/src/nvtt/tools/compress.cpp index c4e74ae..11d2222 100644 --- a/src/nvtt/tools/compress.cpp +++ b/src/nvtt/tools/compress.cpp @@ -51,7 +51,7 @@ struct MyOutputHandler : public nvtt::OutputHandler verbose = b; } - virtual void mipmap(int size, int width, int height, int depth, int face, int miplevel) + virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel) { // ignore. }