mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-14 09:34:58 +02:00
Cleaning up the TextureMap loaders and cleaning for pr
This commit is contained in:
parent
1ca87fa069
commit
be38de3239
3 changed files with 32 additions and 10 deletions
|
@ -192,13 +192,22 @@ enum Semantic {
|
||||||
SRGBA,
|
SRGBA,
|
||||||
SBGRA,
|
SBGRA,
|
||||||
|
|
||||||
|
// These are generic compression format smeantic for images
|
||||||
COMPRESSED_R,
|
COMPRESSED_R,
|
||||||
COMPRESSED_RGB,
|
|
||||||
|
COMPRESSED_RGB,
|
||||||
COMPRESSED_RGBA,
|
COMPRESSED_RGBA,
|
||||||
|
|
||||||
COMPRESSED_SRGB,
|
COMPRESSED_SRGB,
|
||||||
COMPRESSED_SRGBA,
|
COMPRESSED_SRGBA,
|
||||||
|
|
||||||
|
// FIXME: Will have to be supported later:
|
||||||
|
/*COMPRESSED_BC3_RGBA, // RGBA_S3TC_DXT5_EXT,
|
||||||
|
COMPRESSED_BC3_SRGBA, // SRGB_ALPHA_S3TC_DXT5_EXT
|
||||||
|
|
||||||
|
COMPRESSED_BC7_RGBA,
|
||||||
|
COMPRESSED_BC7_SRGBA, */
|
||||||
|
|
||||||
R11G11B10,
|
R11G11B10,
|
||||||
|
|
||||||
UNIFORM,
|
UNIFORM,
|
||||||
|
|
|
@ -184,6 +184,24 @@ public:
|
||||||
case gpu::COMPRESSED_SRGBA:
|
case gpu::COMPRESSED_SRGBA:
|
||||||
texel.internalFormat = GL_COMPRESSED_SRGB_ALPHA;
|
texel.internalFormat = GL_COMPRESSED_SRGB_ALPHA;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// FIXME: WE will want to support this later
|
||||||
|
/*
|
||||||
|
case gpu::COMPRESSED_BC3_RGBA:
|
||||||
|
texel.internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||||
|
break;
|
||||||
|
case gpu::COMPRESSED_BC3_SRGBA:
|
||||||
|
texel.internalFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case gpu::COMPRESSED_BC7_RGBA:
|
||||||
|
texel.internalFormat = GL_COMPRESSED_RGBA_BPTC_UNORM_ARB;
|
||||||
|
break;
|
||||||
|
case gpu::COMPRESSED_BC7_SRGBA:
|
||||||
|
texel.internalFormat = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM;
|
||||||
|
break;
|
||||||
|
*/
|
||||||
|
|
||||||
default:
|
default:
|
||||||
qCDebug(gpulogging) << "Unknown combination of texel format";
|
qCDebug(gpulogging) << "Unknown combination of texel format";
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,9 +182,7 @@ gpu::Texture* TextureUsage::createNormalTextureFromNormalImage(const QImage& src
|
||||||
image = image.convertToFormat(QImage::Format_RGB888);
|
image = image.convertToFormat(QImage::Format_RGB888);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (image.format() != QImage::Format_ARGB32) {
|
image = image.convertToFormat(QImage::Format_RGB888);
|
||||||
image = image.convertToFormat(QImage::Format_ARGB32);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu::Texture* theTexture = nullptr;
|
gpu::Texture* theTexture = nullptr;
|
||||||
|
@ -192,12 +190,9 @@ gpu::Texture* TextureUsage::createNormalTextureFromNormalImage(const QImage& src
|
||||||
|
|
||||||
bool isLinearRGB = true;
|
bool isLinearRGB = true;
|
||||||
|
|
||||||
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::NUINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB);
|
||||||
gpu::Element formatMip = gpu::Element(gpu::VEC3, gpu::NUINT8, (isLinearRGB ? gpu::RGB : gpu::SRGB));
|
gpu::Element formatMip = gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB);
|
||||||
if (image.hasAlphaChannel()) {
|
|
||||||
formatGPU = gpu::Element(gpu::VEC4, gpu::NUINT8, (isLinearRGB ? gpu::RGBA : gpu::SRGBA));
|
|
||||||
formatMip = gpu::Element(gpu::VEC4, gpu::NUINT8, (isLinearRGB ? gpu::BGRA : gpu::SBGRA));
|
|
||||||
}
|
|
||||||
|
|
||||||
theTexture = (gpu::Texture::create2D(formatGPU, image.width(), image.height(), gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)));
|
theTexture = (gpu::Texture::create2D(formatGPU, image.width(), image.height(), gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)));
|
||||||
theTexture->assignStoredMip(0, formatMip, image.byteCount(), image.constBits());
|
theTexture->assignStoredMip(0, formatMip, image.byteCount(), image.constBits());
|
||||||
|
|
Loading…
Reference in a new issue