mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:44:21 +02:00
moving forward with the void* hack for gpu::Texture
This commit is contained in:
parent
97b18fcd52
commit
07fe43e175
2 changed files with 6 additions and 7 deletions
|
@ -484,6 +484,7 @@ void ImageReader::run() {
|
|||
|
||||
int opaquePixels = 0;
|
||||
int translucentPixels = 0;
|
||||
bool isTransparent = false;
|
||||
int redTotal = 0, greenTotal = 0, blueTotal = 0, alphaTotal = 0;
|
||||
const int EIGHT_BIT_MAXIMUM = 255;
|
||||
QColor averageColor(EIGHT_BIT_MAXIMUM, EIGHT_BIT_MAXIMUM, EIGHT_BIT_MAXIMUM);
|
||||
|
@ -535,6 +536,8 @@ void ImageReader::run() {
|
|||
|
||||
averageColor = QColor(redTotal / imageArea,
|
||||
greenTotal / imageArea, blueTotal / imageArea, alphaTotal / imageArea);
|
||||
|
||||
isTransparent = (translucentPixels >= imageArea / 2);
|
||||
}
|
||||
|
||||
gpu::Texture* theTexture = nullptr;
|
||||
|
@ -703,14 +706,11 @@ void ImageReader::run() {
|
|||
QMetaObject::invokeMethod(texture.data(), "setImage",
|
||||
Q_ARG(const QImage&, image),
|
||||
Q_ARG(void*, theTexture),
|
||||
Q_ARG(bool, translucentPixels >= imageArea / 2), Q_ARG(const QColor&, averageColor),
|
||||
Q_ARG(bool, isTransparent),
|
||||
Q_ARG(const QColor&, averageColor),
|
||||
Q_ARG(int, originalWidth), Q_ARG(int, originalHeight));
|
||||
|
||||
|
||||
/* QMetaObject::invokeMethod(texture.data(), "setImage", Q_ARG(const QImage&, image), Q_ARG(bool, false),
|
||||
Q_ARG(const QColor&, averageColor), Q_ARG(int, originalWidth), Q_ARG(int, originalHeight));
|
||||
return;
|
||||
*/
|
||||
}
|
||||
|
||||
void NetworkTexture::setImage(const QImage& image, void* voidTexture, bool translucent, const QColor& averageColor, int originalWidth,
|
||||
|
|
|
@ -149,8 +149,6 @@ private:
|
|||
|
||||
/// A texture loaded from the network.
|
||||
|
||||
Q_DECLARE_METATYPE(gpu::Texture);
|
||||
|
||||
class NetworkTexture : public Resource, public Texture {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -175,6 +173,7 @@ protected:
|
|||
virtual void downloadFinished(QNetworkReply* reply);
|
||||
|
||||
Q_INVOKABLE void loadContent(const QByteArray& content);
|
||||
// FIXME: This void* should be a gpu::Texture* but i cannot get it to work for now, moving on...
|
||||
Q_INVOKABLE void setImage(const QImage& image, void* texture, bool translucent, const QColor& averageColor, int originalWidth,
|
||||
int originalHeight);
|
||||
|
||||
|
|
Loading…
Reference in a new issue