lygia
/v1.1.6
/lighting
/material
/emissive
)get material emissive property from GlslViewer's defines https://github.com/patriciogonzalezvivo/glslViewer/wiki/GlslViewer-DEFINES#material-defines
Dependencies:
Use:
vec4 materialEmissive()
#ifndef FNC_MATERIAL_EMISSIVE
#define FNC_MATERIAL_EMISSIVE
#ifdef MATERIAL_EMISSIVEMAP
uniform SAMPLER_TYPE MATERIAL_EMISSIVEMAP;
#endif
vec3 materialEmissive() {
vec3 emission = vec3(0.0);
#if defined(MATERIAL_EMISSIVEMAP) && defined(MODEL_VERTEX_TEXCOORD)
vec2 uv = v_texcoord.xy;
#if defined(MATERIAL_EMISSIVEMAP_OFFSET)
uv += (MATERIAL_EMISSIVEMAP_OFFSET).xy;
#endif
#if defined(MATERIAL_EMISSIVEMAP_SCALE)
uv *= (MATERIAL_EMISSIVEMAP_SCALE).xy;
#endif
emission = gamma2linear( SAMPLER_FNC(MATERIAL_EMISSIVEMAP, uv) ).rgb;
#elif defined(MATERIAL_EMISSIVE)
emission = MATERIAL_EMISSIVE;
#endif
return emission;
}
#endif
Dependencies:
Use:
float4 materialEmissive()
#ifndef FNC_MATERIAL_EMISSIVE
#define FNC_MATERIAL_EMISSIVE
#ifdef MATERIAL_EMISSIVEMAP
uniform SAMPLER_TYPE MATERIAL_EMISSIVEMAP;
#endif
float3 materialEmissive() {
float3 emission = float3(0.0, 0.0, 0.0);
#if defined(MATERIAL_EMISSIVEMAP) && defined(MODEL_VERTEX_TEXCOORD)
float2 uv = v_texcoord.xy;
#if defined(MATERIAL_EMISSIVEMAP_OFFSET)
uv += (MATERIAL_EMISSIVEMAP_OFFSET).xy;
#endif
#if defined(MATERIAL_EMISSIVEMAP_SCALE)
uv *= (MATERIAL_EMISSIVEMAP_SCALE).xy;
#endif
emission = gamma2linear( SAMPLER_FNC(MATERIAL_EMISSIVEMAP, uv) ).rgb;
#elif defined(MATERIAL_EMISSIVE)
emission = MATERIAL_EMISSIVE;
#endif
return emission;
}
#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.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository