mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-26 06:28:35 +01:00
Store a RuntimeTexturePacker packed texture region's source region
This commit is contained in:
parent
6ac2ba6151
commit
db02dfcfde
3 changed files with 11 additions and 2 deletions
|
@ -76,6 +76,7 @@ Improvements
|
||||||
- Made RuntimeTexturePacker restore texture region name and pivot when packing
|
- Made RuntimeTexturePacker restore texture region name and pivot when packing
|
||||||
- Multi-target net452, making MLEM compatible with MonoGame for consoles
|
- Multi-target net452, making MLEM compatible with MonoGame for consoles
|
||||||
- Added trimming and AOT annotations and made MLEM.Data trimmable
|
- Added trimming and AOT annotations and made MLEM.Data trimmable
|
||||||
|
- Store a RuntimeTexturePacker packed texture region's source region
|
||||||
|
|
||||||
Fixes
|
Fixes
|
||||||
- Fixed data texture atlases not allowing most characters in their region names
|
- Fixed data texture atlases not allowing most characters in their region names
|
||||||
|
|
|
@ -203,7 +203,8 @@ namespace MLEM.Data {
|
||||||
var packedArea = request.PackedArea.Shrink(new Point(request.Padding, request.Padding));
|
var packedArea = request.PackedArea.Shrink(new Point(request.Padding, request.Padding));
|
||||||
request.Result.Invoke(new TextureRegion(this.PackedTexture, packedArea) {
|
request.Result.Invoke(new TextureRegion(this.PackedTexture, packedArea) {
|
||||||
Pivot = request.Texture.Pivot,
|
Pivot = request.Texture.Pivot,
|
||||||
Name = request.Texture.Name
|
Name = request.Texture.Name,
|
||||||
|
Source = request.Texture
|
||||||
});
|
});
|
||||||
if (this.disposeTextures)
|
if (this.disposeTextures)
|
||||||
request.Texture.Texture.Dispose();
|
request.Texture.Texture.Dispose();
|
||||||
|
|
|
@ -58,6 +58,11 @@ namespace MLEM.Textures {
|
||||||
/// The name of this texture region. By default, this name is <see cref="string.Empty"/>.
|
/// The name of this texture region. By default, this name is <see cref="string.Empty"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name = string.Empty;
|
public string Name = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="TextureRegion"/> that this texture region was created from.
|
||||||
|
/// This value is set in the various constructors that accept another <see cref="TextureRegion"/> to create sub-regions from, as well as by MLEM.Data's <c>RuntimeTexturePacker</c>.
|
||||||
|
/// </summary>
|
||||||
|
public TextureRegion Source;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new texture region from a texture and a rectangle which defines the region's area
|
/// Creates a new texture region from a texture and a rectangle which defines the region's area
|
||||||
|
@ -116,7 +121,9 @@ namespace MLEM.Textures {
|
||||||
/// <param name="region">The texture region to create a sub-region of</param>
|
/// <param name="region">The texture region to create a sub-region of</param>
|
||||||
/// <param name="uv">The top left corner of this area</param>
|
/// <param name="uv">The top left corner of this area</param>
|
||||||
/// <param name="size">The size of this area</param>
|
/// <param name="size">The size of this area</param>
|
||||||
public TextureRegion(TextureRegion region, Point uv, Point size) : this(region.Texture, region.Position + uv, size) {}
|
public TextureRegion(TextureRegion region, Point uv, Point size) : this(region.Texture, region.Position + uv, size) {
|
||||||
|
this.Source = region;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a new <see cref="TextureRegion"/> that has the same <see cref="Texture"/>, <see cref="Pivot"/> and <see cref="Size"/> as this texture, but the returned region's <see cref="Position"/> will be offset by <paramref name="offset"/>.
|
/// Returns a new <see cref="TextureRegion"/> that has the same <see cref="Texture"/>, <see cref="Pivot"/> and <see cref="Size"/> as this texture, but the returned region's <see cref="Position"/> will be offset by <paramref name="offset"/>.
|
||||||
|
|
Loading…
Reference in a new issue