|
|
|
@ -26,23 +26,24 @@
|
|
|
|
|
using namespace nvtt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Texture::Texture() : m(*new Texture::Private())
|
|
|
|
|
Texture::Texture() : m(NULL)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Texture::~Texture()
|
|
|
|
|
Texture::Texture(const Texture & tex) : m(tex.m)
|
|
|
|
|
{
|
|
|
|
|
delete &m;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Texture::Texture(const Texture & tex) : m(*new Texture::Private())
|
|
|
|
|
Texture::~Texture()
|
|
|
|
|
{
|
|
|
|
|
// @@ Not implemented.
|
|
|
|
|
delete m;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Texture::operator=(const Texture & tex)
|
|
|
|
|
{
|
|
|
|
|
// @@ Not implemented.
|
|
|
|
|
tex.m->addRef();
|
|
|
|
|
m = tex.m;
|
|
|
|
|
m->release();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Texture::load(const char * fileName)
|
|
|
|
@ -53,7 +54,7 @@ bool Texture::load(const char * fileName)
|
|
|
|
|
|
|
|
|
|
void Texture::setType(TextureType type)
|
|
|
|
|
{
|
|
|
|
|
m.type = type;
|
|
|
|
|
m->type = type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Texture::setTexture2D(InputFormat format, int w, int h, int idx, void * data)
|
|
|
|
@ -67,7 +68,7 @@ void Texture::resize(int w, int h, ResizeFilter filter)
|
|
|
|
|
// @@ Not implemented.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Texture::buildMipmap(MipmapFilter filter)
|
|
|
|
|
bool Texture::buildNextMipmap(MipmapFilter filter)
|
|
|
|
|
{
|
|
|
|
|
// @@ Not implemented.
|
|
|
|
|
}
|
|
|
|
@ -75,17 +76,17 @@ bool Texture::buildMipmap(MipmapFilter filter)
|
|
|
|
|
// Color transforms.
|
|
|
|
|
void Texture::toLinear(float gamma)
|
|
|
|
|
{
|
|
|
|
|
foreach(i, m.imageArray)
|
|
|
|
|
foreach(i, m->imageArray)
|
|
|
|
|
{
|
|
|
|
|
m.imageArray[i].toLinear(0, 3, gamma);
|
|
|
|
|
m->imageArray[i].toLinear(0, 3, gamma);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Texture::toGamma(float gamma)
|
|
|
|
|
{
|
|
|
|
|
foreach(i, m.imageArray)
|
|
|
|
|
foreach(i, m->imageArray)
|
|
|
|
|
{
|
|
|
|
|
m.imageArray[i].toGamma(0, 3, gamma);
|
|
|
|
|
m->imageArray[i].toGamma(0, 3, gamma);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -96,25 +97,25 @@ void Texture::transform(const float w0[4], const float w1[4], const float w2[4],
|
|
|
|
|
|
|
|
|
|
void Texture::swizzle(int r, int g, int b, int a)
|
|
|
|
|
{
|
|
|
|
|
foreach(i, m.imageArray)
|
|
|
|
|
foreach(i, m->imageArray)
|
|
|
|
|
{
|
|
|
|
|
m.imageArray[i].swizzle(0, r, g, b, a);
|
|
|
|
|
m->imageArray[i].swizzle(0, r, g, b, a);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Texture::scaleBias(int channel, float scale, float bias)
|
|
|
|
|
{
|
|
|
|
|
foreach(i, m.imageArray)
|
|
|
|
|
foreach(i, m->imageArray)
|
|
|
|
|
{
|
|
|
|
|
m.imageArray[i].scaleBias(channel, 1, scale, bias);
|
|
|
|
|
m->imageArray[i].scaleBias(channel, 1, scale, bias);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Texture::normalize()
|
|
|
|
|
{
|
|
|
|
|
foreach(i, m.imageArray)
|
|
|
|
|
foreach(i, m->imageArray)
|
|
|
|
|
{
|
|
|
|
|
m.imageArray[i].normalize(0);
|
|
|
|
|
m->imageArray[i].normalize(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|