API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classTextureRegion

@codexo/exojs / rendering / stable

An immutable descriptor for a rectangular sub-region of a Texture. Stores the pixel-space source rectangle, pre-computed normalised UV bounds, and optional extrusion/padding metadata for atlas-safe linear filtering. Constructed once and reused across sprites, tile-sets, atlas lookups, and the scalable-sprite repeat planners. Extrusion metadata is copied and frozen during construction - the caller retains no mutable reference to the stored object. The underlying Texture reference is stable, but the Texture's own lifecycle and sampler state remain owned by Texture. **Sub-regions** name an explicit rectangle. Their descriptor is fixed at construction and validated against the texture, which must therefore already know its dimensions - a still-loading texture makes the rectangle unverifiable, so the constructor throws. **Whole-texture regions** omit the rectangle and cover the entire texture. They derive their geometry from the texture instead of capturing it, so one built from a loader handle that has not resolved yet reports zero dimensions for the moment and the real ones as soon as the payload lands. Nothing has to be rebuilt or invalidated for the region itself to become correct; consumers that cache geometry off it watch Texture.version.

10
props
0
methods
0
events
Import
import { TextureRegion } from '@codexo/exojs'

An immutable descriptor for a rectangular sub-region of a Texture.

Stores the pixel-space source rectangle, pre-computed normalised UV bounds, and optional extrusion/padding metadata for atlas-safe linear filtering. Constructed once and reused across sprites, tile-sets, atlas lookups, and the scalable-sprite repeat planners.

Extrusion metadata is copied and frozen during construction - the caller retains no mutable reference to the stored object. The underlying Texture reference is stable, but the Texture's own lifecycle and sampler state remain owned by Texture.

**Sub-regions** name an explicit rectangle. Their descriptor is fixed at construction and validated against the texture, which must therefore already know its dimensions - a still-loading texture makes the rectangle unverifiable, so the constructor throws.

**Whole-texture regions** omit the rectangle and cover the entire texture. They derive their geometry from the texture instead of capturing it, so one built from a loader handle that has not resolved yet reports zero dimensions for the moment and the real ones as soon as the payload lands. Nothing has to be rebuilt or invalidated for the region itself to become correct; consumers that cache geometry off it watch Texture.version.

Constructors1
With options, a sub-region over that rectangle: validated against the texture, which must already know its dimensions. Without, a region covering the whole texture: valid for a texture that has not loaded yet, whose dimensions it then follows.
Properties10
height: number
Height of the region in texture pixels.
u0: number
Normalised left texture coordinate (U-min).
u1: number
Normalised right texture coordinate (U-max).
v0: number
Normalised top texture coordinate (V-min).
v1: number
Normalised bottom texture coordinate (V-max).
width: number
Width of the region in texture pixels.
x: number
Left edge of the region in texture pixels.
y: number
Top edge of the region in texture pixels.
Source