<@include gpu/Config.slh@> <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> // // model_lightmap.frag // fragment shader // // Created by Samuel Gateau on 11/19/14. // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // <@include DeferredBufferWrite.slh@> <@include model/Material.slh@> <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS)$> <$declareMaterialLightmap()$> in vec4 _position; in vec2 _texCoord0; in vec2 _texCoord1; in vec3 _normal; in vec3 _color; void main(void) { Material mat = getMaterial(); int matKey = getMaterialKey(mat); <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> packDeferredFragmentLightmap( normalize(_normal), evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), getMaterialAlbedo(mat) * albedo.rgb * _color, getMaterialRoughness(mat) * roughness, getMaterialMetallic(mat), getMaterialFresnel(mat), lightmapVal); }