Skip to content

Documentation / @ripl/3d / Texture

Class: Texture ​

Defined in: 3d/src/core/texture.ts:63

An image mapped onto a surface, usable by either backend.

Mutating a texture's sampling properties bumps its version, which is how a backend knows to re-upload or rebuild whatever it derived from it. Replacing the source does the same.

Constructors ​

Constructor ​

new Texture(source, options?): Texture

Defined in: 3d/src/core/texture.ts:173

Parameters ​

ParameterType
sourceTextureSource
options?TextureOptions

Returns ​

Texture

Properties ​

PropertyModifierTypeDescriptionDefined in
idreadonlystringStable identity, used by backends to key whatever they cache against this texture.3d/src/core/texture.ts:66

Accessors ​

flipY ​

Get Signature ​

get flipY(): boolean

Defined in: 3d/src/core/texture.ts:129

Whether the image is flipped vertically when sampled.

Returns ​

boolean

Set Signature ​

set flipY(value): void

Defined in: 3d/src/core/texture.ts:133

Parameters ​
ParameterType
valueboolean
Returns ​

void


height ​

Get Signature ​

get height(): number

Defined in: 3d/src/core/texture.ts:169

The image's height in pixels, or 0 when it has not loaded.

Returns ​

number


magFilter ​

Get Signature ​

get magFilter(): TextureFilter

Defined in: 3d/src/core/texture.ts:109

How the texture is sampled when magnified.

Returns ​

TextureFilter

Set Signature ​

set magFilter(value): void

Defined in: 3d/src/core/texture.ts:113

Parameters ​
ParameterType
valueTextureFilter
Returns ​

void


minFilter ​

Get Signature ​

get minFilter(): TextureFilter

Defined in: 3d/src/core/texture.ts:119

How the texture is sampled when minified.

Returns ​

TextureFilter

Set Signature ​

set minFilter(value): void

Defined in: 3d/src/core/texture.ts:123

Parameters ​
ParameterType
valueTextureFilter
Returns ​

void


offset ​

Get Signature ​

get offset(): Vector2

Defined in: 3d/src/core/texture.ts:149

How far the texture is shifted across the surface.

Returns ​

Vector2

Set Signature ​

set offset(value): void

Defined in: 3d/src/core/texture.ts:153

Parameters ​
ParameterType
valueVector2
Returns ​

void


repeat ​

Get Signature ​

get repeat(): Vector2

Defined in: 3d/src/core/texture.ts:139

How many times the texture repeats across the surface.

Returns ​

Vector2

Set Signature ​

set repeat(value): void

Defined in: 3d/src/core/texture.ts:143

Parameters ​
ParameterType
valueVector2
Returns ​

void


source ​

Get Signature ​

get source(): TextureSource

Defined in: 3d/src/core/texture.ts:79

The image this texture samples.

Returns ​

TextureSource

Set Signature ​

set source(value): void

Defined in: 3d/src/core/texture.ts:83

Parameters ​
ParameterType
valueTextureSource
Returns ​

void


version ​

Get Signature ​

get version(): number

Defined in: 3d/src/core/texture.ts:159

Increments on every change, so a backend can tell whether its cached upload is stale.

Returns ​

number


width ​

Get Signature ​

get width(): number

Defined in: 3d/src/core/texture.ts:164

The image's width in pixels, or 0 when it has not loaded.

Returns ​

number


wrapS ​

Get Signature ​

get wrapS(): TextureWrap

Defined in: 3d/src/core/texture.ts:89

How horizontal coordinates outside the unit range are resolved.

Returns ​

TextureWrap

Set Signature ​

set wrapS(value): void

Defined in: 3d/src/core/texture.ts:93

Parameters ​
ParameterType
valueTextureWrap
Returns ​

void


wrapT ​

Get Signature ​

get wrapT(): TextureWrap

Defined in: 3d/src/core/texture.ts:99

How vertical coordinates outside the unit range are resolved.

Returns ​

TextureWrap

Set Signature ​

set wrapT(value): void

Defined in: 3d/src/core/texture.ts:103

Parameters ​
ParameterType
valueTextureWrap
Returns ​

void

Methods ​

invalidate() ​

invalidate(): void

Defined in: 3d/src/core/texture.ts:186

Marks the texture as changed, so backends re-upload it. Call after mutating the source in place.

Returns ​

void