Merge changes from the witness.
This commit is contained in:
@ -169,6 +169,17 @@ void FloatImage::clear(uint c, float f/*= 0.0f*/)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FloatImage::copyChannel(uint src, uint dst)
|
||||||
|
{
|
||||||
|
nvCheck(src < m_componentCount);
|
||||||
|
nvCheck(dst < m_componentCount);
|
||||||
|
|
||||||
|
const float * srcChannel = this->channel(src);
|
||||||
|
float * dstChannel = this->channel(dst);
|
||||||
|
|
||||||
|
memcpy(dstChannel, srcChannel, sizeof(float)*m_pixelCount);
|
||||||
|
}
|
||||||
|
|
||||||
void FloatImage::normalize(uint baseComponent)
|
void FloatImage::normalize(uint baseComponent)
|
||||||
{
|
{
|
||||||
nvCheck(baseComponent + 3 <= m_componentCount);
|
nvCheck(baseComponent + 3 <= m_componentCount);
|
||||||
|
@ -152,6 +152,26 @@ int Compressor::estimateSize(const TexImage & tex, int mipmapCount, const Compre
|
|||||||
return estimateSize(w, h, d, mipmapCount, compressionOptions);
|
return estimateSize(w, h, d, mipmapCount, compressionOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Compressor::outputHeader(const CubeImage & cube, int mipmapCount, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const
|
||||||
|
{
|
||||||
|
return m.outputHeader(TextureType_Cube, cube.size(), cube.size(), 1, mipmapCount, false, compressionOptions.m, outputOptions.m);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Compressor::compress(const CubeImage & cube, int mipmap, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
if(!m.compress(cube.face(i), i, mipmap, compressionOptions.m, outputOptions.m)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Compressor::estimateSize(const CubeImage & cube, int mipmapCount, const CompressionOptions & compressionOptions) const
|
||||||
|
{
|
||||||
|
return 6 * estimateSize(cube.size(), cube.size(), 1, mipmapCount, compressionOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Raw API.
|
// Raw API.
|
||||||
bool Compressor::outputHeader(TextureType type, int w, int h, int d, int mipmapCount, bool isNormalMap, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const
|
bool Compressor::outputHeader(TextureType type, int w, int h, int d, int mipmapCount, bool isNormalMap, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const
|
||||||
|
@ -87,32 +87,57 @@ TexImage & CubeImage::face(int f)
|
|||||||
return m->face[f];
|
return m->face[f];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TexImage & CubeImage::face(int f) const
|
||||||
|
{
|
||||||
|
nvDebugCheck(f >= 0 && f < 6);
|
||||||
|
return m->face[f];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CubeImage::load(const char * fileName)
|
bool CubeImage::load(const char * fileName)
|
||||||
{
|
{
|
||||||
|
// @@ TODO
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CubeImage::save(const char * fileName) const
|
bool CubeImage::save(const char * fileName) const
|
||||||
{
|
{
|
||||||
|
// @@ TODO
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CubeImage::fold(const TexImage & tex, CubeLayout layout)
|
void CubeImage::fold(const TexImage & tex, CubeLayout layout)
|
||||||
{
|
{
|
||||||
|
// @@ TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
TexImage CubeImage::unfold(CubeLayout layout)
|
TexImage CubeImage::unfold(CubeLayout layout) const
|
||||||
{
|
{
|
||||||
|
// @@ TODO
|
||||||
|
return TexImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CubeImage CubeImage::irradianceFilter(int size) const
|
||||||
|
{
|
||||||
|
// @@ TODO
|
||||||
|
return CubeImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
CubeImage CubeImage::cosinePowerFilter(int size, float cosinePower) const
|
||||||
|
{
|
||||||
|
// @@ TODO
|
||||||
|
return CubeImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CubeImage::toLinear(float gamma)
|
void CubeImage::toLinear(float gamma)
|
||||||
{
|
{
|
||||||
|
if (isNull()) return;
|
||||||
|
|
||||||
|
detach();
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
m->face[i].toLinear(gamma);
|
m->face[i].toLinear(gamma);
|
||||||
}
|
}
|
||||||
@ -120,6 +145,10 @@ void CubeImage::toLinear(float gamma)
|
|||||||
|
|
||||||
void CubeImage::toGamma(float gamma)
|
void CubeImage::toGamma(float gamma)
|
||||||
{
|
{
|
||||||
|
if (isNull()) return;
|
||||||
|
|
||||||
|
detach();
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
m->face[i].toGamma(gamma);
|
m->face[i].toGamma(gamma);
|
||||||
}
|
}
|
||||||
|
@ -1224,8 +1224,7 @@ void TexImage::toRGBM(float range/*= 1*/, float threshold/*= 0.25*/)
|
|||||||
|
|
||||||
detach();
|
detach();
|
||||||
|
|
||||||
//threshold = clamp(threshold, 1e-6f, 1.0f);
|
threshold = ::clamp(threshold, 1e-6f, 1.0f);
|
||||||
threshold = 1e-6f;
|
|
||||||
float irange = 1.0f / range;
|
float irange = 1.0f / range;
|
||||||
|
|
||||||
FloatImage * img = m->image;
|
FloatImage * img = m->image;
|
||||||
|
@ -68,6 +68,7 @@ namespace nvtt
|
|||||||
{
|
{
|
||||||
// Forward declarations.
|
// Forward declarations.
|
||||||
struct TexImage;
|
struct TexImage;
|
||||||
|
struct CubeImage;
|
||||||
|
|
||||||
/// Supported compression formats.
|
/// Supported compression formats.
|
||||||
enum Format
|
enum Format
|
||||||
@ -382,6 +383,11 @@ namespace nvtt
|
|||||||
NVTT_API bool compress(const TexImage & tex, int face, int mipmap, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const;
|
NVTT_API bool compress(const TexImage & tex, int face, int mipmap, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const;
|
||||||
NVTT_API int estimateSize(const TexImage & tex, int mipmapCount, const CompressionOptions & compressionOptions) const;
|
NVTT_API int estimateSize(const TexImage & tex, int mipmapCount, const CompressionOptions & compressionOptions) const;
|
||||||
|
|
||||||
|
// CubeImage API.
|
||||||
|
NVTT_API bool outputHeader(const CubeImage & cube, int mipmapCount, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const;
|
||||||
|
NVTT_API bool compress(const CubeImage & cube, int mipmap, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const;
|
||||||
|
NVTT_API int estimateSize(const CubeImage & cube, int mipmapCount, const CompressionOptions & compressionOptions) const;
|
||||||
|
|
||||||
// Raw API.
|
// Raw API.
|
||||||
NVTT_API bool outputHeader(TextureType type, int w, int h, int d, int mipmapCount, bool isNormalMap, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const;
|
NVTT_API bool outputHeader(TextureType type, int w, int h, int d, int mipmapCount, bool isNormalMap, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const;
|
||||||
NVTT_API bool compress(int w, int h, int d, int face, int mipmap, const float * rgba, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const;
|
NVTT_API bool compress(int w, int h, int d, int face, int mipmap, const float * rgba, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const;
|
||||||
@ -541,17 +547,20 @@ namespace nvtt
|
|||||||
NVTT_API bool save(const char * fileName) const;
|
NVTT_API bool save(const char * fileName) const;
|
||||||
|
|
||||||
TexImage & face(int face);
|
TexImage & face(int face);
|
||||||
|
const TexImage & face(int face) const;
|
||||||
|
|
||||||
// Layout conversion.
|
// Layout conversion.
|
||||||
void fold(const TexImage & img, CubeLayout layout);
|
void fold(const TexImage & img, CubeLayout layout);
|
||||||
TexImage unfold(CubeLayout layout);
|
TexImage unfold(CubeLayout layout) const;
|
||||||
|
|
||||||
// @@ Angular extent filtering.
|
// @@ Angular extent filtering.
|
||||||
|
|
||||||
// @@ Add resizing methods.
|
// @@ Add resizing methods.
|
||||||
|
|
||||||
// @@ Irradiance cubemaps.
|
// Filtering.
|
||||||
CubeImage irradiance(int size);
|
CubeImage irradianceFilter(int size) const;
|
||||||
|
CubeImage cosinePowerFilter(int size, float cosinePower) const;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NVTT_API void resize(int w, int h, ResizeFilter filter);
|
NVTT_API void resize(int w, int h, ResizeFilter filter);
|
||||||
|
Reference in New Issue
Block a user