overte-HifiExperiments/libraries/render-utils/src/model_lightmap.slf
2015-08-04 14:36:42 -07:00

45 lines
1.1 KiB
Text
Executable file

<@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@>
// the diffuse texture
uniform sampler2D diffuseMap;
// the emissive map texture and parameters
uniform sampler2D emissiveMap;
uniform vec2 emissiveParams;
in vec4 _position;
in vec2 _texCoord0;
in vec2 _texCoord1;
in vec3 _normal;
in vec3 _color;
void main(void) {
vec4 diffuse = texture(diffuseMap, _texCoord0);
vec4 emissive = texture(emissiveMap, _texCoord1);
Material mat = getMaterial();
packDeferredFragmentLightmap(
normalize(_normal),
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
getMaterialDiffuse(mat) * diffuse.rgb * _color,
getMaterialSpecular(mat),
getMaterialShininess(mat),
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));
}