AtlasTexture
Region of a shared atlas for 2D drawing without copying source pixels.
AtlasTexture selects a Region from a shared Atlas and adds a logical Margin. Use multiple resources for elements of one sprite sheet; the source image stays shared. To create a separate pixel texture, obtain a GetImage crop and create an ImageTexture if source data is available. AtlasTexture itself does not allocate a GPU copy of the region.
Region uses texture coordinates. Margin.Position offsets content, Margin.Size adds logical dimensions, and GetImage excludes those margins. Zero Region axes use the corresponding source dimensions. Use integer boundaries inside the atlas for precise slicing.
Region repetition is not equivalent to an independent tiling texture: current DrawRect tile does not create a repeated crop. Use an appropriate source or separate image for tiling. FilterClip restricts drawing samples without repairing source mipmaps. Do not rely on 2D crop commands in 3D: the RID refers to the shared source.
Crop pixels, dimensions, margins, nesting, draw-argument forwarding and persistence were checked in Windows Forward+/Vulkan. Visible seams, packing performance, 3D materials and all repeat variants did not receive visual acceptance in this run.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
AtlasTextureConstructor
public AtlasTexture();Creates AtlasTexture without a source: Atlas = null, zero Region and Margin, FilterClip = false. Without a source the placeholder size is 1×1 and GetImage returns null. Assign Atlas before using pixel data.
Properties4
AtlasProperty
public Texture2D Atlas { get; set; }Shared source Texture2D; null by default. Assignment neither copies pixels nor creates a separate GPU texture for the crop. GetRid returns the source RID. Nested AtlasTexture resources are supported, but do not create self-references or cycles. Multiple regions can share one source.
FilterClipProperty
public bool FilterClip { get; set; }Defaults to false. Passes region sampling clipping during 2D drawing to help separate neighboring atlas elements under filtering. It does not edit pixels or generate mipmap padding. Current AtlasTexture uses this property even in DrawRectRegion, independently of its clipUV argument. Visual edge quality was not checked in this run.
MarginProperty
public Rect2 Margin { get; set; }Additional logical margin, defaulting to a zero Rect2. Position offsets drawn content; Size adds total canvas dimensions on nonzero Region axes. These are not four independent side widths. For example, a 4×4 Region with Margin.Size 3×4 has logical size 7×8. GetImage returns the crop without these margins. Margin neither edits source pixels nor generates mipmap padding.
RegionProperty
public Rect2 Region { get; set; }Region in source texture coordinates, not 0…1 UVs. Defaults to a zero-sized Rect2: that axis uses the source size. A nonzero axis has logical size floor(Region.Size) plus Margin.Size; a zero axis uses source size without adding Margin.Size. The property retains fractional input, but internal region dimensions are floored. Use integer boundaries inside the source for predictable slicing.
Methods8
GetAtlasTexture2D
public Texture2D GetAtlas();Returns AtlasTexture.Atlas.
Texture2DCurrent Atlas value. The texture reference is shared rather than copied; it can be null.
GetMarginRect2
public Rect2 GetMargin();Returns AtlasTexture.Margin.
Rect2Current Margin value.
GetRegionRect2
public Rect2 GetRegion();Returns AtlasTexture.Region.
Rect2Current Region value.
HasFilterClipbool
public bool HasFilterClip();Returns AtlasTexture.FilterClip.
boolCurrent FilterClip value.
SetAtlasvoid
public void SetAtlas(Texture2D atlas);Sets AtlasTexture.Atlas.
| Name | Type | Default |
|---|---|---|
atlas | Texture2D | — |
atlasShared Texture2D or null; do not create self-references or cycles.
SetFilterClipvoid
public void SetFilterClip(bool enable);Sets AtlasTexture.FilterClip.
| Name | Type | Default |
|---|---|---|
enable | bool | — |
enableRestrict sampling to the atlas region during 2D drawing.
SetMarginvoid
public void SetMargin(Rect2 margin);Sets AtlasTexture.Margin.
| Name | Type | Default |
|---|---|---|
margin | Rect2 | — |
marginPosition offsets content; Size adds logical canvas dimensions without changing pixels.
SetRegionvoid
public void SetRegion(Rect2 region);Sets AtlasTexture.Region.
| Name | Type | Default |
|---|---|---|
region | Rect2 | — |
regionSource region in texture coordinates; a zero axis uses source size.