<@include gpu/Config.slh@> <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> // // forward_simple.frag // fragment shader // // Created by Andrzej Kapolka on 9/15/14. // Copyright 2014 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 DefaultMaterials.slh@> <@include ForwardGlobalLight.slh@> <$declareEvalSkyboxGlobalColor()$> <@include gpu/Transform.slh@> <$declareStandardCameraTransform()$> // the interpolated normal layout(location=RENDER_UTILS_ATTR_NORMAL_WS) in vec3 _normalWS; layout(location=RENDER_UTILS_ATTR_NORMAL_MS) in vec3 _normalMS; layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color; layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01; #define _texCoord0 _texCoord01.xy #define _texCoord1 _texCoord01.zw layout(location=RENDER_UTILS_ATTR_POSITION_MS) in vec4 _positionMS; layout(location=RENDER_UTILS_ATTR_POSITION_ES) in vec4 _positionES; // For retro-compatibility #define _normal _normalWS #define _modelNormal _normalMS #define _position _positionMS #define _eyePosition _positionES layout(location=0) out vec4 _fragColor0; void main(void) { vec3 normal = normalize(_normalWS.xyz); vec3 diffuse = _color.rgb; vec3 specular = DEFAULT_SPECULAR; float shininess = DEFAULT_SHININESS; float emissiveAmount = 0.0; TransformCamera cam = getTransformCamera(); vec3 fragPosition = _positionES.xyz; _fragColor0 = vec4(evalSkyboxGlobalColor( cam._viewInverse, 1.0, DEFAULT_OCCLUSION, fragPosition, normal * (2.0 * float(gl_FrontFacing) - 1.0), diffuse, DEFAULT_FRESNEL, length(specular), max(0.0, 1.0 - shininess / 128.0)), 1.0); }