Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mezzanine::UI::TextureAtlas Class Reference

This is a collection of smaller textures packed into a larger texture, intended to increase UI performance. More...

#include <textureatlas.h>

+ Collaboration diagram for Mezzanine::UI::TextureAtlas:

Public Types

typedef FontDataContainer::const_iterator ConstFontDataIterator
 Const Iterator type for fonts stored in this class.
 
typedef SpriteContainer::const_iterator ConstSpriteIterator
 Const Iterator type for images stored in this class.
 
typedef std::map< String, FontData * > FontDataContainer
 Container type for storing fonts packed into this atlas.
 
typedef FontDataContainer::iterator FontDataIterator
 Iterator type for fonts stored in this class.
 
typedef std::map< String, Sprite * > SpriteContainer
 Container type for storing images packed into this atlas.
 
typedef SpriteContainer::iterator SpriteIterator
 Iterator type for images stored in this class.
 

Public Member Functions

 TextureAtlas (const String &Name, const UInt32 &Width, const UInt32 &Height)
 Proceadural constructor. More...
 
 TextureAtlas (XML::Node &AtlasNode)
 XML constructor. More...
 
 ~TextureAtlas ()
 Class destructor.
 
Ogre::Pass * _Get2DPass () const
 Gets the 2D Material Pass for this TextureAtlas. More...
 
Ogre::Pass * _Get3DPass () const
 Gets the 3D Material Pass for this TextureAtlas. More...
 
Ogre::MaterialPtr _GetOrCreate2DMaterial ()
 Gets the 2D Material for this TextureAtlas, creating it also if neccessary. More...
 
Ogre::MaterialPtr _GetOrCreate3DMaterial ()
 Gets the 3D Material for this TextureAtlas, creating it also if neccessary. More...
 
Ogre::TexturePtr _GetTexture ()
 Gets the texture being used by this Atlas. More...
 
FontDataGetFont (const String &FontName) const
 Gets the set of Glyphs of the specified name. More...
 
FontDataContainerGetFonts ()
 Gets the full listing of all the FontData instances in this TextureAtlas. More...
 
Real GetInvTextureCoordsX () const
 Gets the inverse size of the TextureAtlas on the X size. More...
 
Real GetInvTextureCoordsY () const
 Gets the inverse size of the TextureAtlas on the Y size. More...
 
const StringGetName () const
 Gets the name of this Texture Atlas. More...
 
SpriteGetSprite (const String &SpriteName) const
 Gets a Sprite by name. More...
 
SpriteContainerGetSprites ()
 Gets the full listing of all the Sprite's in this TextureAtlas. More...
 
Vector2 GetTextureSize () const
 Gets the size of the TextureAtlas. More...
 
Vector2 GetWhitePixel () const
 Gets the location of the WhitePixel on the TextureAtlas. More...
 
Real GetWhitePixelX () const
 Gets the X coordinate for the WhitePixel. More...
 
Real GetWhitePixelY () const
 Gets the Y coordinate for the WhitePixel. More...
 

Protected Member Functions

void Create2DMaterial ()
 Creates the material to be used by 2D interfaces with this Atlas.
 
void Create3DMaterial ()
 Creates the material to be used by 3D interfaces with this Atlas.
 
Ogre::MaterialPtr GetOrCreate2DMasterMaterial ()
 Gets or creates the 2D "template" or "master" material that is to be used to copy from for all Atlases.
 
Ogre::MaterialPtr GetOrCreate3DMasterMaterial ()
 Gets or creates the 3D "template" or "master" material that is to be used to copy from for all Atlases.
 
void ParseFonts (XML::Node &AtlasFontsNode)
 Parses the data for a font.
 
void ParseGlyphs (XML::Node &GlyphsNode, const Vector2 &Offset, FontData *GlyphD)
 Parses the glyphs section of the Texture Atlas.
 
void ParseKernings (XML::Node &KerningsNode, FontData *FontD)
 Parses the kerning section of the Texture Atlas.
 
void ParseSprites (XML::Node &AtlasSpritesNode)
 Parses the sprites section of the Texture Atlas.
 
void ParseTexture (XML::Node &AtlasTextureNode)
 Parses the texture section of the Texture Atlas.
 
void ParseVerticalOffsets (XML::Node &VerticalOffsetsNode, FontData *FontD)
 Parses the vertical offsets section of the Texture Atlas.
 

Protected Attributes

String AtlasName
 The name of this atlas. More...
 
FontDataContainer Fonts
 A container of the fonts packed into this atlas. More...
 
Vector2 InverseTextureSize
 This is (Size / 1) on the X and Y. Useful for doing math. More...
 
SpriteContainer Sprites
 A container of the images packed into this atlas. More...
 
TextureAtlasInternalData * TAID
 A pointer to internal rendering data that cannot be exposed here. More...
 
Vector2 WhitePixel
 A known position on the atlas where the pixel is flat white. Surrounding pixels should also be white. More...
 

Detailed Description

This is a collection of smaller textures packed into a larger texture, intended to increase UI performance.

Definition at line 71 of file textureatlas.h.

Constructor & Destructor Documentation

Mezzanine::UI::TextureAtlas::TextureAtlas ( const String Name,
const UInt32 Width,
const UInt32 Height 
)

Proceadural constructor.

Parameters
NameThe name to be given to this Texture Atlas.
WidthThe width of the desired texture to create for this atlas.
HeightThe height of the desired texture to create for this atlas.
Todo:
This is just a starter code sample for proceadurally generated texture atlases. Not ready and needs to be completed.

Definition at line 103 of file textureatlas.cpp.

Mezzanine::UI::TextureAtlas::TextureAtlas ( XML::Node AtlasNode)

XML constructor.

Parameters
AtlasNodeThe XML node containing all the information to create and configure this texture atlas.

Definition at line 114 of file textureatlas.cpp.

Member Function Documentation

Ogre::Pass * Mezzanine::UI::TextureAtlas::_Get2DPass ( ) const

Gets the 2D Material Pass for this TextureAtlas.

Returns
Returns a pointer to the 2D Pass used for this TextureAtlas.

Definition at line 614 of file textureatlas.cpp.

Ogre::Pass * Mezzanine::UI::TextureAtlas::_Get3DPass ( ) const

Gets the 3D Material Pass for this TextureAtlas.

Returns
Returns a pointer to the 3D Pass used for this TextureAtlas.

Definition at line 617 of file textureatlas.cpp.

Ogre::MaterialPtr Mezzanine::UI::TextureAtlas::_GetOrCreate2DMaterial ( )

Gets the 2D Material for this TextureAtlas, creating it also if neccessary.

Returns
Returns a shared pointer to the internal material for this Atlas.

Definition at line 595 of file textureatlas.cpp.

Ogre::MaterialPtr Mezzanine::UI::TextureAtlas::_GetOrCreate3DMaterial ( )

Gets the 3D Material for this TextureAtlas, creating it also if neccessary.

Returns
Returns a shared pointer to the internal material for this Atlas.

Definition at line 603 of file textureatlas.cpp.

Ogre::TexturePtr Mezzanine::UI::TextureAtlas::_GetTexture ( )

Gets the texture being used by this Atlas.

Returns
Returns a shared pointer to the internal texture for this Atlas.

Definition at line 611 of file textureatlas.cpp.

FontData * Mezzanine::UI::TextureAtlas::GetFont ( const String FontName) const

Gets the set of Glyphs of the specified name.

Parameters
FontNameThe name of the font as specified in the MTA file.
Returns
Returns a pointer to the GlyphData containing all the Glyphs.

Definition at line 550 of file textureatlas.cpp.

TextureAtlas::FontDataContainer & Mezzanine::UI::TextureAtlas::GetFonts ( )

Gets the full listing of all the FontData instances in this TextureAtlas.

Returns
Returns a reference to the map storing all the FontData instances loaded for this TextureAtlas.

Definition at line 558 of file textureatlas.cpp.

Real Mezzanine::UI::TextureAtlas::GetInvTextureCoordsX ( ) const

Gets the inverse size of the TextureAtlas on the X size.

Returns
Returns a Real containing the inverse width of the TextureAtlas.

Definition at line 586 of file textureatlas.cpp.

Real Mezzanine::UI::TextureAtlas::GetInvTextureCoordsY ( ) const

Gets the inverse size of the TextureAtlas on the Y size.

Returns
Returns a Real containing the inverse height of the TextureAtlas.

Definition at line 589 of file textureatlas.cpp.

const String & Mezzanine::UI::TextureAtlas::GetName ( ) const

Gets the name of this Texture Atlas.

Returns
Returns a string containing the name of this Texture Atlas

Definition at line 542 of file textureatlas.cpp.

Sprite * Mezzanine::UI::TextureAtlas::GetSprite ( const String SpriteName) const

Gets a Sprite by name.

Parameters
SpriteNameThe name of the Sprite to get.
Returns
Returns a pointer to the named Sprite.

Definition at line 563 of file textureatlas.cpp.

TextureAtlas::SpriteContainer & Mezzanine::UI::TextureAtlas::GetSprites ( )

Gets the full listing of all the Sprite's in this TextureAtlas.

Returns
Returns a reference to the map storing all the Sprite's loaded for this TextureAtlas.

Definition at line 571 of file textureatlas.cpp.

Vector2 Mezzanine::UI::TextureAtlas::GetTextureSize ( ) const

Gets the size of the TextureAtlas.

Returns
Returns a Vector2 with the size of this TextureAtlas.

Definition at line 583 of file textureatlas.cpp.

Vector2 Mezzanine::UI::TextureAtlas::GetWhitePixel ( ) const

Gets the location of the WhitePixel on the TextureAtlas.

Returns
Returns a Vector2 with the location of the WhitePixel.

Definition at line 574 of file textureatlas.cpp.

Real Mezzanine::UI::TextureAtlas::GetWhitePixelX ( ) const

Gets the X coordinate for the WhitePixel.

Returns
Returns a Real containing the X coordinate of the WhitePixel.

Definition at line 577 of file textureatlas.cpp.

Real Mezzanine::UI::TextureAtlas::GetWhitePixelY ( ) const

Gets the Y coordinate for the WhitePixel.

Returns
Returns a Real containing the Y coordinate of the WhitePixel.

Definition at line 580 of file textureatlas.cpp.

Member Data Documentation

String Mezzanine::UI::TextureAtlas::AtlasName
protected

The name of this atlas.

Definition at line 98 of file textureatlas.h.

FontDataContainer Mezzanine::UI::TextureAtlas::Fonts
protected

A container of the fonts packed into this atlas.

Definition at line 92 of file textureatlas.h.

Vector2 Mezzanine::UI::TextureAtlas::InverseTextureSize
protected

This is (Size / 1) on the X and Y. Useful for doing math.

Definition at line 104 of file textureatlas.h.

SpriteContainer Mezzanine::UI::TextureAtlas::Sprites
protected

A container of the images packed into this atlas.

Definition at line 95 of file textureatlas.h.

TextureAtlasInternalData* Mezzanine::UI::TextureAtlas::TAID
protected

A pointer to internal rendering data that cannot be exposed here.

Definition at line 89 of file textureatlas.h.

Vector2 Mezzanine::UI::TextureAtlas::WhitePixel
protected

A known position on the atlas where the pixel is flat white. Surrounding pixels should also be white.

Definition at line 101 of file textureatlas.h.


The documentation for this class was generated from the following files: