mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 23:44:09 +02:00
PR comments
This commit is contained in:
parent
839b8d432e
commit
7d99f9e72f
2 changed files with 4 additions and 9 deletions
libraries
|
@ -51,6 +51,7 @@ void AnimationReader::run() {
|
|||
if (originalPriority == QThread::InheritPriority) {
|
||||
originalPriority = QThread::NormalPriority;
|
||||
}
|
||||
QThread::currentThread()->setPriority(QThread::LowPriority);
|
||||
try {
|
||||
if (_data.isEmpty()) {
|
||||
throw QString("Reply is NULL ?!");
|
||||
|
|
|
@ -53,32 +53,26 @@ void TextureMap::setLightmapOffsetScale(float offset, float scale) {
|
|||
// FIXME why is this in the model library? Move to GPU or GPU_GL
|
||||
gpu::Texture* TextureUsage::create2DTextureFromImage(const QImage& srcImage, const std::string& srcImageName) {
|
||||
QImage image = srcImage;
|
||||
bool validAlpha = false;
|
||||
if (image.hasAlphaChannel()) {
|
||||
if (image.format() != QImage::Format_ARGB32) {
|
||||
image = image.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
|
||||
// Actual alpha channel?
|
||||
bool transparent { false };
|
||||
for (int y = 0; y < image.height(); ++y) {
|
||||
const QRgb* data = reinterpret_cast<const QRgb*>(image.constScanLine(y));
|
||||
for (int x = 0; x < image.width(); ++x) {
|
||||
auto alpha = qAlpha(data[x]);
|
||||
if (alpha != 255) {
|
||||
transparent = true;
|
||||
validAlpha = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// or bullshit alpha channel?
|
||||
if (!transparent) {
|
||||
qCDebug(modelLog) << "Image with alpha channel is completely opaque:" << QString(srcImageName.c_str());
|
||||
image = image.convertToFormat(QImage::Format_RGB888);
|
||||
}
|
||||
}
|
||||
|
||||
if (!image.hasAlphaChannel() && image.format() != QImage::Format_RGB888) {
|
||||
if (!validAlpha && image.format() != QImage::Format_RGB888) {
|
||||
image = image.convertToFormat(QImage::Format_RGB888);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue