overte/libraries/render-utils/src/model.slf
2015-06-23 09:49:10 -07:00

39 lines
933 B
Text
Executable file

<@include gpu/Config.slh@>
<$VERSION_HEADER$>
// Generated on <$_SCRIBE_DATE$>
// model.frag
// fragment shader
//
// Created by Andrzej Kapolka on 10/14/13.
// 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;
in vec4 _position;
in vec4 _normal;
in vec3 _color;
in vec2 _texCoord0;
void main(void) {
// Fetch diffuse map
vec4 diffuse = texture(diffuseMap, _texCoord0);
Material mat = getMaterial();
packDeferredFragment(
normalize(_normal.xyz),
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
getMaterialDiffuse(mat) * diffuse.rgb * _color,
getMaterialSpecular(mat),
getMaterialShininess(mat));
}