| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #pragma once
- #include "Critical.h"
- #include "Point.h"
- #include "ReferenceCounter.h"
- namespace Framework
- {
- class Image; //! Image.h
- class TextureList; //! TextureList.h
- enum TextureDirection
- {
- RAM_TO_GPU = 0, //! The texture is copied from an Image to GPU and then
- //! used in shaders
- GPU_TO_RAM = 1, //! The texture is created by a shader and then copied
- //! to an Image
- };
- //! Converts an image to a texture that can be passed to the graphics
- //! card for rendering
- class Texture : public virtual ReferenceCounter
- {
- protected:
- Image* bild;
- bool changed;
- Point lastGr;
- int id;
- TextureDirection direction;
- public:
- //! Constructor
- DLLEXPORT Texture(TextureDirection dir);
- //! Destructor
- DLLEXPORT virtual ~Texture();
- //! Sets a pointer to the image that contains the texture
- //! \param b The pointer to the image
- DLLEXPORT void setImageZ(Image* b);
- //! Sets the image that contains the texture by copying it
- //! \param b The image to copy
- DLLEXPORT void setImage(Image* b);
- //! Updates the texture. The pixels of the current image are copied
- //! to graphics memory
- DLLEXPORT virtual bool updateTextur() = 0;
- //! Returns true if updateTextur needs to be called
- DLLEXPORT virtual bool needsUpdate() const = 0;
- //! Returns a pointer to the image
- DLLEXPORT Image* getImage() const;
- //! Returns a pointer to the image without increased reference counter
- DLLEXPORT Image* zImage() const;
- //! Returns the id of the texture if it was registered in a TextureList.
- //! (see Framework::zTextureRegister())
- DLLEXPORT int getId() const;
- //! Returns the direction of the texture
- DLLEXPORT TextureDirection getDirection() const;
- friend TextureList;
- };
- } // namespace Framework
|