Final API changes.

Rename OutputHandler::mipmap method to beginImage.
Add NVTT_VERSION.
Add nvtt::version function.
2.0
castano 16 years ago
parent 91ff256adf
commit 3c90686e00

@ -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?

@ -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.
}

@ -47,3 +47,9 @@ const char * nvtt::errorString(Error e)
return "Invalid error";
}
/// Return NVTT version.
unsigned int nvtt::version()
{
return NVTT_VERSION;
}

@ -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

@ -201,3 +201,8 @@ const char * nvttErrorString(NvttError e)
{
return nvtt::errorString((nvtt::Error)e);
}
unsigned int nvttVersion()
{
return nvtt::version();
}

@ -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

@ -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.
}

Loading…
Cancel
Save