Adding support for floating point input/output. Work in progress.

This commit is contained in:
castano
2008-07-31 02:04:44 +00:00
parent 3161fca9d9
commit e9002a7d86
12 changed files with 282 additions and 27 deletions

View File

@ -654,6 +654,20 @@ void DDSHeader::setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3)
this->pf.amask = 0;
}
void DDSHeader::setFormatCode(uint32 code)
{
// set fourcc pixel format.
this->pf.flags = DDPF_FOURCC;
this->pf.fourcc = code;
this->pf.bitcount = 0;
this->pf.rmask = 0;
this->pf.gmask = 0;
this->pf.bmask = 0;
this->pf.amask = 0;
}
void DDSHeader::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
{
// Make sure the masks are correct.

View File

@ -93,6 +93,7 @@ namespace nv
void setLinearSize(uint size);
void setPitch(uint pitch);
void setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3);
void setFormatCode(uint code);
void setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask);
void setDX10Format(uint format);
void setNormalFlag(bool b);

View File

@ -141,7 +141,8 @@ Image * FloatImage::createImageGammaCorrect(float gamma/*= 2.2f*/) const
/// Allocate a 2d float image of the given format and the given extents.
void FloatImage::allocate(uint c, uint w, uint h)
{
nvCheck(m_mem == NULL);
free();
m_width = w;
m_height = h;
m_componentNum = c;
@ -152,7 +153,6 @@ void FloatImage::allocate(uint c, uint w, uint h)
/// Free the image, but don't clear the members.
void FloatImage::free()
{
nvCheck(m_mem != NULL);
nv::mem::free( reinterpret_cast<void *>(m_mem) );
m_mem = NULL;
}

View File

@ -39,9 +39,10 @@ const Image & Image::operator=(const Image & img)
void Image::allocate(uint w, uint h)
{
free();
m_width = w;
m_height = h;
m_data = (Color32 *)realloc(m_data, w * h * sizeof(Color32));
m_data = (Color32 *)nv::mem::malloc(w * h * sizeof(Color32));
}
bool Image::load(const char * name)