StelTexture.hpp   StelTexture.hpp 
skipping to change at line 29 skipping to change at line 29
#ifndef _STELTEXTURE_HPP_ #ifndef _STELTEXTURE_HPP_
#define _STELTEXTURE_HPP_ #define _STELTEXTURE_HPP_
#include "StelTextureTypes.hpp" #include "StelTextureTypes.hpp"
#include <QObject> #include <QObject>
#include <QImage> #include <QImage>
#include <QtOpenGL> #include <QtOpenGL>
class QMutex;
class QSemaphore;
class QFile; class QFile;
class StelTextureMgr;
class QNetworkReply;
#ifndef GL_CLAMP_TO_EDGE #ifndef GL_CLAMP_TO_EDGE
#define GL_CLAMP_TO_EDGE 0x812F #define GL_CLAMP_TO_EDGE 0x812F
#endif #endif
// This class is just used internally to load the texture data.
class ImageLoader : QObject
{
Q_OBJECT
private:
friend class StelTextureMgr;
friend class StelTexture;
ImageLoader(const QString& path, int delay);
void abort();
signals:
void finished(QImage);
void error(const QString& errorMsg);
public slots:
void start();
private slots:
void onNetworkReply();
void directLoad();
private:
QString path;
QNetworkReply* networkReply;
};
//! @class StelTexture //! @class StelTexture
//! Base texture class. For creating an instance, use StelTextureMgr::creat eTexture() and StelTextureMgr::createTextureThread() //! Base texture class. For creating an instance, use StelTextureMgr::creat eTexture() and StelTextureMgr::createTextureThread()
//! @sa StelTextureSP //! @sa StelTextureSP
class StelTexture : public QObject class StelTexture : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
//! Contains the parameters defining how a texture is created. //! Contains the parameters defining how a texture is created.
struct StelTextureParams struct StelTextureParams
skipping to change at line 98 skipping to change at line 126
bool glLoad(); bool glLoad();
signals: signals:
//! Emitted when the texture is ready to be bind(), i.e. when downlo aded, imageLoading and glLoading is over //! Emitted when the texture is ready to be bind(), i.e. when downlo aded, imageLoading and glLoading is over
//! or when an error occured and the texture will never be available //! or when an error occured and the texture will never be available
//! In case of error, you can query what the problem was by calling getErrorMessage() //! In case of error, you can query what the problem was by calling getErrorMessage()
//! @param error is equal to true if an error occured while loading the texture //! @param error is equal to true if an error occured while loading the texture
void loadingProcessFinished(bool error); void loadingProcessFinished(bool error);
private slots: private slots:
//! Called when the download for the texture file terminated //! Called by the loader when the data has finished loading
void downloadFinished(); void onImageLoaded(QImage image);
//! Called by the loader in case of an error
//! Called when the file loading thread has terminated void onLoadingError(const QString& errorMessage) {reportError(errorM
void fileLoadFinished(); essage);}
private: private:
friend class StelTextureMgr; friend class StelTextureMgr;
friend class ImageLoadThread; friend class TextureLoader;
//! Private constructor //! Private constructor
StelTexture(); StelTexture();
//! Loading of the image data.
//! This method is thread safe
//! @return false if an error occured
bool imageLoad();
//! This method should be called if the texture loading failed for a ny reasons //! This method should be called if the texture loading failed for a ny reasons
//! @param errorMessage the human friendly error message //! @param errorMessage the human friendly error message
void reportError(const QString& errorMessage); void reportError(const QString& errorMessage);
StelTextureParams loadParams; StelTextureParams loadParams;
//! Used to download remote files if needed //! The loader object
class QNetworkReply* httpReply; ImageLoader* loader;
//! Used to load in thread
class ImageLoadThread* loadThread;
//! Define if the texture was already downloaded if it was a remote one //! Define if the texture was already downloaded if it was a remote one
bool downloaded; bool downloaded;
//! Define whether the image is already loading //! Define whether the image is already loading
bool isLoadingImage; bool isLoadingImage;
//! The URL where to download the file //! The URL where to download the file
QString fullPath; QString fullPath;
//! The data that was loaded from http //! The data that was loaded from http
QByteArray downloadedData;
QImage qImage; QImage qImage;
//! Used ony when creating temporary file //! Used ony when creating temporary file
QString fileExtension; QString fileExtension;
//! True when something when wrong in the loading process //! True when something when wrong in the loading process
bool errorOccured; bool errorOccured;
//! Human friendly error message if loading failed //! Human friendly error message if loading failed
QString errorMessage; QString errorMessage;
//! OpenGL id //! OpenGL id
GLuint id; GLuint id;
////////////////////////////////////////////////////////////////////
///////
// Attributes protected by the Mutex
//! Mutex used to protect all the attributes below
QMutex* mutex;
//! Cached average luminance //! Cached average luminance
float avgLuminance; float avgLuminance;
GLsizei width; //! Texture image width GLsizei width; //! Texture image width
GLsizei height; //! Texture image height GLsizei height; //! Texture image height
//! Fix a limit to the number of maximum simultaneous loading thread
s
static QSemaphore* maxLoadThreadSemaphore;
}; };
#endif // _STELTEXTURE_HPP_ #endif // _STELTEXTURE_HPP_
 End of changes. 10 change blocks. 
29 lines changed or deleted 38 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/