LYGIA Shader Library

sprite (lygia/v1.1.6/sample/sprite)

sample a frame on a sprite sheet

Dependencies:

Use:

<SAMPLESPRITE_TYPE> sampleSprite(<SAMPLER_TYPE >tex, <vec2> st, <vec2> grid, <float> frame)

Check it on Github



#ifndef SAMPLESPRITE_TYPE
#define SAMPLESPRITE_TYPE vec4
#endif

#ifndef SAMPLESPRITE_SAMPLER_FNC
#define SAMPLESPRITE_SAMPLER_FNC(TEX, UV) SAMPLER_FNC(TEX, UV)
#endif

#ifndef FNC_SAMPLESPRITE
#define FNC_SAMPLESPRITE

SAMPLESPRITE_TYPE sampleSprite(SAMPLER_TYPE tex, in vec2 st, in vec2 grid, float frame) {
    return SAMPLESPRITE_SAMPLER_FNC(tex, sprite(st, grid, frame) );
}

#endif

Dependencies:

Use:

<SAMPLESPRITE_TYPE> sampleSprite(<SAMPLER_TYPE >tex, <float2> st, <float2> grid, <float> frame)

Check it on Github



#ifndef SAMPLESPRITE_TYPE
#define SAMPLESPRITE_TYPE float4
#endif

#ifndef SAMPLESPRITE_SAMPLER_FNC
#define SAMPLESPRITE_SAMPLER_FNC(TEX, UV) SAMPLER_FNC(TEX, UV)
#endif

#ifndef FNC_SAMPLESPRITE
#define FNC_SAMPLESPRITE

SAMPLESPRITE_TYPE sampleSprite(SAMPLER_TYPE tex, in float2 st, in float2 grid, float frame) {
    return SAMPLESPRITE_SAMPLER_FNC(tex, sprite(st, grid, frame) );
}

#endif

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository