TextureAtlasPage
Represents a single texture page within a texture atlas.
TextureAtlasPage holds the actual GPU texture containing packed images and metadata about the page dimensions and filtering. Large atlases may consist of multiple pages when images don't fit within texture size limits.
Pages are observable, allowing UI or debugging tools to react to changes in texture assignment or filtering modes. Each page is referenced by regions via their page index.
Features:
- Observable properties for reactive updates
- Automatic dimension detection from texture
- Filter mode propagation to texture
- Named identification for debugging
// Access a page from an atlas
var page = atlas.pages[0];
trace('Page ${page.name}: ${page.width}x${page.height}');
// Change filtering for all regions on this page
page.filter = NEAREST; // For pixel art
Instance Members
observedDirty: Bool
Default is false
, automatically set to true
when any of this instance's observable variables has changed.
name: String
Unique identifier for this page.
Typically in format like "page0", "atlas_0", or custom names. Used for debugging and in some atlas formats for page references.
width: Float
Width of this page in pixels.
Set explicitly or auto-detected from the texture. Observable to allow reactive updates when page size changes.
height: Float
Height of this page in pixels.
Set explicitly or auto-detected from the texture. Observable to allow reactive updates when page size changes.
Texture filtering mode for this page.
Controls how the texture is sampled:
- LINEAR: Smooth interpolation (default)
- NEAREST: Pixel-perfect sampling
When changed, automatically updates the associated texture. All regions on this page share the same filter setting.
texture: Texture
The GPU texture containing the packed images.
This texture holds all regions assigned to this page. When set, automatically updates width/height if not already specified. Observable to allow monitoring texture changes or hot-reloading.
invalidateName(): Void
invalidateWidth(): Void
invalidateHeight(): Void
invalidateFilter(): Void
invalidateTexture(): Void
unbindEvents(): Void
new(name: String, ?width: Float = 0, ?height: Float = 0, ?filter: Anonymous = LINEAR, ?texture: Texture = null): Void
Creates a new texture atlas page.
Name | Type | Default | Description |
---|---|---|---|
name |
String | Identifier for this page | |
width |
Float | 0 |
Page width in pixels (0 to auto-detect from texture) |
height |
Float | 0 |
Page height in pixels (0 to auto-detect from texture) |
filter |
Anonymous | LINEAR |
Texture filtering mode (default: LINEAR) |
texture |
Texture | null |
Optional texture to assign immediately |
Private Members
unobservedName: String
unobservedWidth: Float
unobservedHeight: Float
unobservedTexture: Texture
emitObservedDirty(instance: TextureAtlasPage, fromSerializedField: Bool): Void
Event when any observable value as changed on this instance.
Name | Type |
---|---|
instance |
TextureAtlasPage |
fromSerializedField |
Bool |
Event when name field changes.
Name | Type |
---|---|
current |
String |
previous |
String |
Event when width field changes.
Name | Type |
---|---|
current |
Float |
previous |
Float |
Event when height field changes.
Name | Type |
---|---|
current |
Float |
previous |
Float |
emitFilterChange(current: Anonymous, previous: Anonymous): Void
Event when filter field changes.
Name | Type |
---|---|
current |
Anonymous |
previous |
Anonymous |
Event when texture field changes.
Name | Type |
---|---|
current |
Texture |
previous |
Texture |
Metadata
Name | Parameters |
---|---|
:build |
tracker.macros.ObservableMacro.build() |
:autoBuild |
tracker.macros.ObservableMacro.build() |