Math v0.2.0
SIMD optimized C++ mathematics library
Loading...
Searching...
No Matches
Sampler2D Class Reference

Texture (image) sampler 2D. More...

#include <sampler.hpp>

Public Member Functions

 Sampler2D (const void *texels, uint3 size) noexcept
 Creates a new 2D texture (image) sampler.
template<class T = f32x4>
get (uint2 position) const noexcept
 Returns texel at specified position.
template<class T = f32x4>
sampleNearest (float2 uv, bool repeatMode=false) const noexcept
 Samples nearest texel from an image.

Detailed Description

Texture (image) sampler 2D.

Constructor & Destructor Documentation

◆ Sampler2D()

Sampler2D ( const void * texels,
uint3 size )
inlinenoexcept

Creates a new 2D texture (image) sampler.

Parameters
[in]texelstarget texture texel data
sizetarget texture 3D size in texels
mipCounttexture mipmap level count

Member Function Documentation

◆ get()

template<class T = f32x4>
T get ( uint2 position) const
inlinenoexcept

Returns texel at specified position.

Parameters
positiontexel 2D position and mipmap level
Template Parameters
Ttype of the texture pixel

◆ sampleNearest()

template<class T = f32x4>
T sampleNearest ( float2 uv,
bool repeatMode = false ) const
inlinenoexcept

Samples nearest texel from an image.

Parameters
uv2D texture coordinates where to sample
repeatModeclamp to border or repeat sampling mode
Template Parameters
Ttype of the texture pixel