Documentation / @ripl/3d / sampleTexture
Function: sampleTexture() ​
sampleTexture(
texture,coordU,coordV):ColorRGBA|undefined
Defined in: 3d/src/core/texture.ts:359
Samples a texture on the CPU, honouring its wrap modes, filter, flip and transform.
Used by the Canvas painter's texture mapping and by raycast queries. The pixel data is read back once per texture version and cached, because reading it per sample would be ruinous.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
texture | Texture | The texture to sample. |
coordU | number | The horizontal surface coordinate. |
coordV | number | The vertical surface coordinate. |
Returns ​
ColorRGBA | undefined
The sampled colour in 0–255 channels, or undefined when the image has no pixels.