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 ​
| Parameter | Type |
|---|---|
source | TextureSource |
options? | TextureOptions |
Returns ​
Texture
Properties ​
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
id | readonly | string | Stable 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 ​
| Parameter | Type |
|---|---|
value | boolean |
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 ​
Set Signature ​
set magFilter(
value):void
Defined in: 3d/src/core/texture.ts:113
Parameters ​
| Parameter | Type |
|---|---|
value | TextureFilter |
Returns ​
void
minFilter ​
Get Signature ​
get minFilter():
TextureFilter
Defined in: 3d/src/core/texture.ts:119
How the texture is sampled when minified.
Returns ​
Set Signature ​
set minFilter(
value):void
Defined in: 3d/src/core/texture.ts:123
Parameters ​
| Parameter | Type |
|---|---|
value | TextureFilter |
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 ​
Set Signature ​
set offset(
value):void
Defined in: 3d/src/core/texture.ts:153
Parameters ​
| Parameter | Type |
|---|---|
value | Vector2 |
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 ​
Set Signature ​
set repeat(
value):void
Defined in: 3d/src/core/texture.ts:143
Parameters ​
| Parameter | Type |
|---|---|
value | Vector2 |
Returns ​
void
source ​
Get Signature ​
get source():
TextureSource
Defined in: 3d/src/core/texture.ts:79
The image this texture samples.
Returns ​
Set Signature ​
set source(
value):void
Defined in: 3d/src/core/texture.ts:83
Parameters ​
| Parameter | Type |
|---|---|
value | TextureSource |
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 ​
Set Signature ​
set wrapS(
value):void
Defined in: 3d/src/core/texture.ts:93
Parameters ​
| Parameter | Type |
|---|---|
value | TextureWrap |
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 ​
Set Signature ​
set wrapT(
value):void
Defined in: 3d/src/core/texture.ts:103
Parameters ​
| Parameter | Type |
|---|---|
value | TextureWrap |
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