Add missing files for previous change.
Some cleanup.
This commit is contained in:
@ -113,7 +113,7 @@ Image * FloatImage::createImageGammaCorrect(float gamma/*= 2.2f*/) const
|
||||
const float * aChannel = this->channel(3);
|
||||
|
||||
const uint size = m_width * m_height;
|
||||
for(uint i = 0; i < size; i++)
|
||||
for (uint i = 0; i < size; i++)
|
||||
{
|
||||
const uint8 r = nv::clamp(int(255.0f * pow(rChannel[i], 1.0f/gamma)), 0, 255);
|
||||
const uint8 g = nv::clamp(int(255.0f * pow(gChannel[i], 1.0f/gamma)), 0, 255);
|
||||
@ -145,9 +145,24 @@ void FloatImage::free()
|
||||
m_mem = NULL;
|
||||
}
|
||||
|
||||
void FloatImage::resizeChannelCount(uint c)
|
||||
{
|
||||
if (m_componentNum != c) {
|
||||
uint count = w * h * c;
|
||||
nv::mem::realloc(m_mem, count * sizeof(float));
|
||||
|
||||
if (c > m_componentNum) {
|
||||
memset(m_mem + m_count, 0, (count - m_count) * sizeof(float));
|
||||
}
|
||||
|
||||
m_componentNum = c;
|
||||
m_count = count;
|
||||
}
|
||||
}
|
||||
|
||||
void FloatImage::clear(float f/*=0.0f*/)
|
||||
{
|
||||
for(uint i = 0; i < m_count; i++) {
|
||||
for (uint i = 0; i < m_count; i++) {
|
||||
m_mem[i] = f;
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ namespace nv
|
||||
//@{
|
||||
NVIMAGE_API void allocate(uint c, uint w, uint h);
|
||||
NVIMAGE_API void free(); // Does not clear members.
|
||||
NVIMAGE_API void resizeChannelCount(uint c);
|
||||
//@}
|
||||
|
||||
/** @name Manipulation. */
|
||||
|
@ -231,7 +231,7 @@ FloatImage * nv::ImageIO::loadFloat(const char * fileName, Stream & s)
|
||||
if (floatImage == NULL) {
|
||||
s.seek(spos); // Restore stream position.
|
||||
|
||||
AutoPtr<Image> img = load(fileName, s);
|
||||
AutoPtr<Image> img(load(fileName, s));
|
||||
if (img != NULL) {
|
||||
floatImage = new FloatImage(img.ptr());
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ void nv::normalizeNormalMap(FloatImage * img)
|
||||
{
|
||||
nvDebugCheck(img != NULL);
|
||||
|
||||
#pragma message(NV_FILE_LINE "TODO: Pack and expand normals explicitly")
|
||||
#pragma message(NV_FILE_LINE "TODO: Pack and expand normals explicitly?")
|
||||
|
||||
img->expandNormals(0);
|
||||
img->normalize(0);
|
||||
|
Reference in New Issue
Block a user