![]() |
Gorgon Game Engine
|
This class represents an image depends on a GL texture. More...
Public Member Functions | |
| Texture () | |
| Default constructor, creates an empty texture. More... | |
| Texture (const Containers::Image &image) | |
| This constructor creates a new texture from the given Image. More... | |
| Texture (GL::Texture id, ColorMode mode, const Geometry::Size &size) | |
| Regular, full texture constructor. More... | |
| Texture (GL::Texture id, ColorMode mode, const Geometry::Size &size, const Geometry::Bounds &location) | |
| Atlas constructor, specifies a region of the texture. More... | |
| Texture (Texture &&other) | |
| Moves a texture. More... | |
| Texture (Texture &other) | |
| Copies a texture. This newly created texture will not assume ownership. More... | |
| virtual | ~Texture () |
| void | Assume (GL::Texture id, ColorMode mode, const Geometry::Size &size) |
| Sets the texture to the given id with the given size. More... | |
| void | Assume (GL::Texture id, ColorMode mode, const Geometry::Size &size, const Geometry::Bounds &location) |
| Sets the texture to the given id with the given size. More... | |
| void | CreateEmpty (const Geometry::Size &size, ColorMode mode) |
| Create an empty texture. More... | |
| void | Destroy () |
| Remove the texture from this object. If this object is the owner of the texture, then it is destroyed. More... | |
| virtual const Geometry::Pointf * | GetCoordinates () const override final |
| Returns the coordinates of the texture to be used. Declared final to allow inlining. More... | |
| virtual GL::Texture | GetID () const override final |
| Returns GL::Texture to be drawn. Declared final to allow inlining. More... | |
| virtual Geometry::Size | GetImageSize () const override final |
| Returns the size of the texture in pixels. Declared final to allow inlining. More... | |
| ColorMode | GetMode () const override |
| GL::Texture | Release () |
| Releases the texture id that might be owned by this object without destroying it. More... | |
| void | Set (const Containers::Image &image) |
| Sets the texture to the given id with the given size. More... | |
| void | Set (GL::Texture id) |
| Sets the texture to the given id without any modification to size or color mode. More... | |
| void | Set (GL::Texture id, ColorMode mode, const Geometry::Size &size) |
| Sets the texture to the given id with the given size. More... | |
| void | Set (GL::Texture id, ColorMode mode, const Geometry::Size &size, const Geometry::Bounds &location) |
| Sets the texture to the given id with the given size. More... | |
| void | Swap (Texture &other) |
| Swaps two textures. More... | |
Public Member Functions inherited from TextureSource | |
| bool | IsPartial () const |
| Returns whether this texture uses only a part of the GL::Texture. More... | |
Protected Attributes | |
| Geometry::Pointf | coordinates [4] |
| Readily calculated texture coordinates of the image. More... | |
| GL::Texture | id |
| GL texture id. More... | |
| ColorMode | mode |
| Color mode of the texture, necessary to choose correct texture. More... | |
| bool | owner |
| Whether this object owns this texture. More... | |
| Geometry::Size | size |
| Size of the texture. More... | |
Additional Inherited Members | |
Static Protected Attributes inherited from TextureSource | |
| static const Geometry::Pointf | fullcoordinates [4] |
| Coordinates that selects the entire texture to be used. More... | |
This class represents an image depends on a GL texture.
Fulfills the requirements of Graphics::TextureSource. Unless GL::Texture created by this object, it is not destroyed by constructor. This is because a GL::Texture could be shared between multiple Graphics::Textures.
| Texture | ( | ) |
Default constructor, creates an empty texture.
References Gorgon::Graphics::Invalid, and Texture::Set().
| Texture | ( | GL::Texture | id, |
| ColorMode | mode, | ||
| const Geometry::Size & | size | ||
| ) |
Regular, full texture constructor.
References Texture::mode, Texture::Set(), and Texture::size.
| Texture | ( | GL::Texture | id, |
| ColorMode | mode, | ||
| const Geometry::Size & | size, | ||
| const Geometry::Bounds & | location | ||
| ) |
Atlas constructor, specifies a region of the texture.
References Texture::mode, Texture::Set(), and Texture::size.
| Texture | ( | const Containers::Image & | image | ) |
This constructor creates a new texture from the given Image.
References Texture::owner.
Copies a texture. This newly created texture will not assume ownership.
References Texture::coordinates.
Moves a texture.
This newly created texture object will own the texture if the other object owns it
References Texture::coordinates.
|
virtual |
References Texture::Destroy().
| void Assume | ( | GL::Texture | id, |
| ColorMode | mode, | ||
| const Geometry::Size & | size | ||
| ) |
Sets the texture to the given id with the given size.
Resets the coordinates to cover entire GL texture. Transfers the ownership of the texture.
References Texture::mode, Texture::owner, Texture::Set(), and Texture::size.
| void Assume | ( | GL::Texture | id, |
| ColorMode | mode, | ||
| const Geometry::Size & | size, | ||
| const Geometry::Bounds & | location | ||
| ) |
Sets the texture to the given id with the given size.
Calculates the texture coordinates for the specified location in pixels. Transfers the ownership of the texture
| id | id of the texture, reported by the underlying GL framework |
| size | of the GL texture in pixels |
| location | is the location of this texture over GL texture in pixels. |
References Texture::mode, Texture::owner, Texture::Set(), and Texture::size.
| void CreateEmpty | ( | const Geometry::Size & | size, |
| ColorMode | mode | ||
| ) |
Create an empty texture.
References Gorgon::GL::GenerateEmptyTexture(), Texture::mode, Texture::owner, and Texture::size.
| void Destroy | ( | ) |
Remove the texture from this object. If this object is the owner of the texture, then it is destroyed.
References Gorgon::GL::DestroyTexture(), Texture::owner, and Texture::size.
|
finaloverridevirtual |
Returns the coordinates of the texture to be used. Declared final to allow inlining.
Implements TextureSource.
References Texture::coordinates.
|
finaloverridevirtual |
Returns GL::Texture to be drawn. Declared final to allow inlining.
Implements TextureSource.
References Texture::id.
|
finaloverridevirtual |
Returns the size of the texture in pixels. Declared final to allow inlining.
Implements TextureSource.
References Texture::size.
|
overridevirtual |
Implements TextureSource.
References Texture::mode.
| GL::Texture Release | ( | ) |
Releases the texture id that might be owned by this object without destroying it.
References Texture::id, Texture::owner, and Texture::size.
| void Set | ( | const Containers::Image & | image | ) |
Sets the texture to the given id with the given size.
Resets the coordinates to cover entire GL texture
References Texture::coordinates, Texture::Destroy(), TextureSource::fullcoordinates, Gorgon::GL::GenerateTexture(), basic_Image< T_ >::GetMode(), basic_Image< T_ >::GetSize(), Texture::mode, Texture::owner, and Texture::size.
| void Set | ( | GL::Texture | id | ) |
Sets the texture to the given id without any modification to size or color mode.
Use this function to change atlas base.
References Gorgon::GL::DestroyTexture(), Texture::id, and Texture::owner.
| void Set | ( | GL::Texture | id, |
| ColorMode | mode, | ||
| const Geometry::Size & | size | ||
| ) |
Sets the texture to the given id with the given size.
Resets the coordinates to cover entire GL texture
References Texture::coordinates, Texture::Destroy(), TextureSource::fullcoordinates, Texture::id, Texture::mode, and Texture::size.
| void Set | ( | GL::Texture | id, |
| ColorMode | mode, | ||
| const Geometry::Size & | size, | ||
| const Geometry::Bounds & | location | ||
| ) |
Sets the texture to the given id with the given size.
Calculates the texture coordinates for the specified location in pixels
| id | id of the texture, reported by the underlying GL framework |
| size | of the GL texture in pixels |
| location | is the location of this texture over GL texture in pixels. |
References basic_Bounds< T_ >::Bottom, Texture::coordinates, Texture::Destroy(), basic_Bounds< T_ >::GetSize(), basic_Size< T_ >::Height, Texture::id, basic_Bounds< T_ >::Left, Texture::mode, basic_Bounds< T_ >::Right, Texture::size, basic_Bounds< T_ >::Top, and basic_Size< T_ >::Width.
| void Swap | ( | Texture & | other | ) |
Swaps two textures.
References Texture::coordinates, Texture::id, Texture::mode, Texture::owner, Texture::size, and Gorgon::swap().
|
protected |
|
protected |
GL texture id.
|
protected |
Whether this object owns this texture.
|
protected |
Size of the texture.