using System.Runtime.CompilerServices; namespace BansheeEngine { /// /// Texture interface that encapsulates underlying texture which allows us to create a sprite texture atlas /// (e.g. multiple sprite textures referencing different parts of a single texture). /// public sealed class SpriteTexture : Resource { /// /// Constructor for internal use by the runtime. /// private SpriteTexture() { } /// /// Creates a new sprite texture that references the entire area of the provided texture. /// /// Texture to wrap by the sprite texture. public SpriteTexture(Texture2D texture) { Internal_CreateInstance(this, texture, Vector2.Zero, Vector2.One); } /// /// Creates a new sprite texture that references a sub-area of the provided texture. /// /// Texture to wrap by the sprite texture. /// Top-left position of the area used by the sprite texture, in normalized coordinates. /// /// Size of the area used by the sprite texture, in normalized coordinates. public SpriteTexture(Texture2D texture, Vector2 uvOffset, Vector2 uvScale) { Internal_CreateInstance(this, texture, uvOffset, uvScale); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_CreateInstance(SpriteTexture instance, Texture2D teture, Vector2 offset, Vector2 scale); } }