Add more todo items.
Delete images more efficiently?
This commit is contained in:
parent
34cd266d8c
commit
8c7f54056c
@ -142,22 +142,25 @@ void TexImage::setTextureType(TextureType type)
|
|||||||
|
|
||||||
m->type = type;
|
m->type = type;
|
||||||
|
|
||||||
// Free images. @@ Use AutoPtr?
|
int count = 0;
|
||||||
foreach (i, m->imageArray)
|
|
||||||
{
|
|
||||||
delete m->imageArray[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == TextureType_2D)
|
if (type == TextureType_2D)
|
||||||
{
|
{
|
||||||
// @@ Free images.
|
count = 1;
|
||||||
m->imageArray.resize(1, NULL);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nvCheck (type == TextureType_Cube);
|
nvCheck (type == TextureType_Cube);
|
||||||
m->imageArray.resize(6, NULL);
|
count = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete all but the first 'count' images.
|
||||||
|
const uint imageCount = m->imageArray.count();
|
||||||
|
for (uint i = count; i < imageCount; i++)
|
||||||
|
{
|
||||||
|
delete m->imageArray[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
m->imageArray.resize(count, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +211,7 @@ int TexImage::height() const
|
|||||||
|
|
||||||
int TexImage::depth() const
|
int TexImage::depth() const
|
||||||
{
|
{
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TexImage::faceCount() const
|
int TexImage::faceCount() const
|
||||||
@ -495,6 +498,8 @@ bool TexImage::setImage2D(Format format, Decoder decoder, int w, int h, int idx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma message(NV_FILE_LINE "TODO: provide a TexImage::resize that can override filter width and parameters.")
|
||||||
|
|
||||||
void TexImage::resize(int w, int h, ResizeFilter filter)
|
void TexImage::resize(int w, int h, ResizeFilter filter)
|
||||||
{
|
{
|
||||||
if (m->imageArray.count() > 0)
|
if (m->imageArray.count() > 0)
|
||||||
@ -502,7 +507,11 @@ void TexImage::resize(int w, int h, ResizeFilter filter)
|
|||||||
if (w == m->imageArray[0]->width() && h == m->imageArray[0]->height()) return;
|
if (w == m->imageArray[0]->width() && h == m->imageArray[0]->height()) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @@ TODO: if cubemap, make sure w == h.
|
if (m->type == TextureType_Cube)
|
||||||
|
{
|
||||||
|
#pragma message(NV_FILE_LINE "Output error when image is cubemap and w != h.")
|
||||||
|
h = w;
|
||||||
|
}
|
||||||
|
|
||||||
detach();
|
detach();
|
||||||
|
|
||||||
@ -510,7 +519,9 @@ void TexImage::resize(int w, int h, ResizeFilter filter)
|
|||||||
|
|
||||||
foreach (i, m->imageArray)
|
foreach (i, m->imageArray)
|
||||||
{
|
{
|
||||||
if (m->imageArray[i] == NULL) continue;
|
FloatImage * img = m->imageArray[i];
|
||||||
|
|
||||||
|
if (img == NULL) continue;
|
||||||
|
|
||||||
if (m->alphaMode == AlphaMode_Transparency)
|
if (m->alphaMode == AlphaMode_Transparency)
|
||||||
{
|
{
|
||||||
@ -608,6 +619,12 @@ void TexImage::resize(int maxExtent, RoundMode roundMode, ResizeFilter filter)
|
|||||||
h = previousPowerOfTwo(h);
|
h = previousPowerOfTwo(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure cube faces are square.
|
||||||
|
if (m->type == TextureType_Cube)
|
||||||
|
{
|
||||||
|
w = h = max(w, h);
|
||||||
|
}
|
||||||
|
|
||||||
resize(w, h, filter);
|
resize(w, h, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -951,7 +968,7 @@ void TexImage::toHeightMap()
|
|||||||
{
|
{
|
||||||
if (m->imageArray[i] == NULL) continue;
|
if (m->imageArray[i] == NULL) continue;
|
||||||
|
|
||||||
// @@ Not implemented.
|
#pragma message(NV_FILE_LINE "Implement TexImage::toHeightMap")
|
||||||
}
|
}
|
||||||
|
|
||||||
m->isNormalMap = false;
|
m->isNormalMap = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user