mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:17:45 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
6a70ad23dd
3 changed files with 6 additions and 9 deletions
|
@ -399,11 +399,9 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case gpu::SRGB:
|
case gpu::SRGB:
|
||||||
texel.format = GL_RGB;
|
|
||||||
texel.internalFormat = GL_SRGB8;
|
texel.internalFormat = GL_SRGB8;
|
||||||
break;
|
break;
|
||||||
case gpu::SRGBA:
|
case gpu::SRGBA:
|
||||||
texel.format = GL_RGBA;
|
|
||||||
texel.internalFormat = GL_SRGB8_ALPHA8; // standard 2.2 gamma correction color
|
texel.internalFormat = GL_SRGB8_ALPHA8; // standard 2.2 gamma correction color
|
||||||
break;
|
break;
|
||||||
case gpu::COMPRESSED_RGBA:
|
case gpu::COMPRESSED_RGBA:
|
||||||
|
|
|
@ -215,7 +215,7 @@ bool GLBackend::GLTexture::isReady() const {
|
||||||
// Move content bits from the CPU to the GPU for a given mip / face
|
// Move content bits from the CPU to the GPU for a given mip / face
|
||||||
void GLBackend::GLTexture::transferMip(GLenum target, const Texture::PixelsPointer& mip) const {
|
void GLBackend::GLTexture::transferMip(GLenum target, const Texture::PixelsPointer& mip) const {
|
||||||
GLTexelFormat texelFormat = GLTexelFormat::evalGLTexelFormat(_gpuTexture.getTexelFormat(), mip->getFormat());
|
GLTexelFormat texelFormat = GLTexelFormat::evalGLTexelFormat(_gpuTexture.getTexelFormat(), mip->getFormat());
|
||||||
glTexSubImage2D(target, 0, 0, 0, _gpuTexture.getWidth(), _gpuTexture.getHeight(), texelFormat.format, texelFormat.type, mip->readData()); glTexSubImage2D(target, 0, 0, 0, _gpuTexture.getWidth(), _gpuTexture.getHeight(), texelFormat.format, texelFormat.type, mip->readData());
|
glTexSubImage2D(target, 0, 0, 0, _gpuTexture.getWidth(), _gpuTexture.getHeight(), texelFormat.format, texelFormat.type, mip->readData());
|
||||||
(void)CHECK_GL_ERROR();
|
(void)CHECK_GL_ERROR();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,6 @@ gpu::Texture* TextureUsage::createNormalTextureFromNormalImage(const QImage& src
|
||||||
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB);
|
gpu::Element formatGPU = gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB);
|
||||||
gpu::Element formatMip = gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB);
|
gpu::Element formatMip = gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::RGB);
|
||||||
|
|
||||||
|
|
||||||
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());
|
||||||
theTexture->autoGenerateMips(-1);
|
theTexture->autoGenerateMips(-1);
|
||||||
|
@ -232,10 +231,11 @@ double mapComponent(double sobelValue) {
|
||||||
gpu::Texture* TextureUsage::createNormalTextureFromBumpImage(const QImage& srcImage, const std::string& srcImageName) {
|
gpu::Texture* TextureUsage::createNormalTextureFromBumpImage(const QImage& srcImage, const std::string& srcImageName) {
|
||||||
QImage image = srcImage;
|
QImage image = srcImage;
|
||||||
|
|
||||||
|
if (image.format() != QImage::Format_RGB888) {
|
||||||
|
image = image.convertToFormat(QImage::Format_RGB888);
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
// PR 5540 by AlessandroSigna integrated here as a specialized TextureLoader for bumpmaps
|
||||||
// PR 5540 by AlessandroSigna
|
|
||||||
// integrated here as a specialized TextureLoader for bumpmaps
|
|
||||||
// The conversion is done using the Sobel Filter to calculate the derivatives from the grayscale image
|
// The conversion is done using the Sobel Filter to calculate the derivatives from the grayscale image
|
||||||
const double pStrength = 2.0;
|
const double pStrength = 2.0;
|
||||||
int width = image.width();
|
int width = image.width();
|
||||||
|
@ -284,8 +284,7 @@ gpu::Texture* TextureUsage::createNormalTextureFromBumpImage(const QImage& srcIm
|
||||||
result.setPixel(i, j, qRgbValue);
|
result.setPixel(i, j, qRgbValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
gpu::Texture* theTexture = nullptr;
|
gpu::Texture* theTexture = nullptr;
|
||||||
if ((image.width() > 0) && (image.height() > 0)) {
|
if ((image.width() > 0) && (image.height() > 0)) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue