PackedTexture Class |
Namespace: DigitalRune.Graphics
The PackedTexture type exposes the following members.
Name | Description | |
---|---|---|
PackedTexture(Texture2D) |
Initializes a new instance of the PackedTexture class for a single texture.
| |
PackedTexture(String, Texture2D, Vector2F, Vector2F) |
Initializes a new instance of the PackedTexture class.
| |
PackedTexture(String, Texture2D, Vector2F, Vector2F, Int32, Int32) |
Initializes a new instance of the PackedTexture class.
|
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetBounds |
Gets the bounds of the packed texture in pixel.
| |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetTextureCoordinates |
Converts texture coordinates.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
Name |
Gets or sets the name of the texture.
| |
NumberOfColumns |
Gets or sets the number of columns in the tile set.
| |
NumberOfRows |
Gets or sets the number of rows in the tile set.
| |
Offset |
Gets or sets the offset of the packed texture in the texture atlas in UV coordinates.
| |
Scale |
Gets or sets the scale of the packed texture relative to the texture atlas.
| |
TextureAtlas |
Gets or sets the texture atlas containing the packed texture.
|
A texture atlas is a large image containing a collection of textures. It is often more efficient to pack multiple textures into a texture atlas which can be treated as a single unit by the graphics hardware. The PackedTexture represents a single texture within the texture atlas.
Tile Sets:
A packed texture can further be divided into tiles (= tile set). A tile set is a collection
of images ("sprites" or "tiles"). All tiles have the same size and are packed in a regular
grid: NumberOfColumns defines the number of tiles in x direction and
NumberOfRows defines the number of tiles in y direction.
2D Animations:
A tile set can be used for 2D animations ("flipbook animations", "sprite sheet animations"):
The tile set contains a sequence of images (animation frames). Cycling through the images in
rapid succession creates the illusion of movement.
When a tile set is used for animation, the top-left tile contains the first animation frame, the second tile in the upper row contains the second animation frame, and so on. The bottom-right tile contains the last animation frame.
Important: Most renderers require that the animation frames are tightly packed and the tile set does not contain empty tiles. For example, an animation consisting of 3 frames can be packed as a 1x3 or 3x1 tile set, but not as 2x2!