STexture.hpp   StelTexture.hpp 
skipping to change at line 20 skipping to change at line 20
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#ifndef _STEXTURE_HPP_ #ifndef _STELTEXTURE_HPP_
#define _STEXTURE_HPP_ #define _STELTEXTURE_HPP_
#include "GLee.h" #include "GLee.h"
#include "fixx11h.h" #include "fixx11h.h"
#include "vecmath.h" #include "VecMath.hpp"
#include "STextureTypes.hpp" #include "StelTextureTypes.hpp"
#include <QObject> #include <QObject>
#include <QImage> #include <QImage>
class QMutex; class QMutex;
class QSemaphore; class QSemaphore;
class QFile; class QFile;
//! @class STexture //! @class StelTexture
//! Base texture class //! Base texture class. For creating an instance, use StelTextureMgr::creat
class STexture : public QObject eTexture() and StelTextureMgr::createTextureThread()
//! @sa StelTextureSP
class StelTexture : public QObject
{ {
Q_OBJECT; Q_OBJECT
friend class StelTextureMgr; friend class StelTextureMgr;
friend class ImageLoadThread; friend class ImageLoadThread;
public: public:
//! Destructor //! Destructor
virtual ~STexture(); virtual ~StelTexture();
//! Bind the texture so that it can be used for openGL drawing (call s glBindTexture). //! Bind the texture so that it can be used for openGL drawing (call s glBindTexture).
//! If the texture is lazyly loaded, this starts the loading and ret urn false immediately. //! If the texture is lazyly loaded, this starts the loading and ret urn false immediately.
//! @return true if the binding successfully occured, false if the t exture is not yet loaded. //! @return true if the binding successfully occured, false if the t exture is not yet loaded.
bool bind(); bool bind();
//! Return whether the texture can be binded, i.e. it is fully loade d //! Return whether the texture can be binded, i.e. it is fully loade d
bool canBind() const {return id!=0;} bool canBind() const {return id!=0;}
//! Get the average texture luminance. //! Get the average texture luminance.
skipping to change at line 71 skipping to change at line 72
//! Return the width and heigth of the texture in pixels //! Return the width and heigth of the texture in pixels
bool getDimensions(int &width, int &height); bool getDimensions(int &width, int &height);
//! Return the position of the 4 corners of the texture in texture c oordinates //! Return the position of the 4 corners of the texture in texture c oordinates
const Vec2d* getCoordinates() const {return texCoordinates;} const Vec2d* getCoordinates() const {return texCoordinates;}
//! Get the error message which caused the texture loading to fail //! Get the error message which caused the texture loading to fail
//! @return the human friendly error message or empty string if no e rrors occured //! @return the human friendly error message or empty string if no e rrors occured
const QString& getErrorMessage() const {return errorMessage;} const QString& getErrorMessage() const {return errorMessage;}
//! Return the full path to the image file //! Return the full path to the image file.
//! If the texture was downloaded from a remote location, this funct
ion return the full URL.
const QString& getFullPath() const {return fullPath;} const QString& getFullPath() const {return fullPath;}
//! Return whether the image is currently being loaded //! Return whether the image is currently being loaded
bool isLoading() const {return isLoadingImage && !canBind();} bool isLoading() const {return isLoadingImage && !canBind();}
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
skipping to change at line 93 skipping to change at line 95
private slots: private slots:
//! Called when the download for the texture file terminated //! Called when the download for the texture file terminated
void downloadFinished(); void downloadFinished();
//! Called when the file loading thread has terminated //! Called when the file loading thread has terminated
void fileLoadFinished(); void fileLoadFinished();
private: private:
//! Private constructor //! Private constructor
STexture(); StelTexture();
//! Load the texture already in the RAM to the openGL memory //! Load the texture already in the RAM to the openGL memory
//! This function uses openGL routines and must be called in the mai n thread //! This function uses openGL routines and must be called in the mai n thread
//! @return false if an error occured //! @return false if an error occured
bool glLoad(); bool glLoad();
//! Loading of the image data. //! Loading of the image data.
//! This method is thread safe //! This method is thread safe
//! @return false if an error occured //! @return false if an error occured
bool imageLoad(); 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);
//! Define the range mode used to rescale the texture when loading //! Define the range mode used to rescale the texture when loading
STextureTypes::DynamicRangeMode dynamicRangeMode; StelTextureTypes::DynamicRangeMode dynamicRangeMode;
//! Used to download remote files if needed //! Used to download remote files if needed
class QNetworkReply* httpReply; class QNetworkReply* httpReply;
//! Used to load in thread //! Used to load in thread
class ImageLoadThread* loadThread; 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
skipping to change at line 168 skipping to change at line 170
GLubyte* texels; GLubyte* texels;
GLenum type; GLenum type;
//! Position of the 4 corners of the texture in texture coordinates //! Position of the 4 corners of the texture in texture coordinates
Vec2d texCoordinates[4]; Vec2d texCoordinates[4];
//! Fix a limit to the number of maximum simultaneous loading thread s //! Fix a limit to the number of maximum simultaneous loading thread s
static QSemaphore* maxLoadThreadSemaphore; static QSemaphore* maxLoadThreadSemaphore;
}; };
#endif // _STEXTURE_HPP_ #endif // _STELTEXTURE_HPP_
 End of changes. 9 change blocks. 
12 lines changed or deleted 16 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/