#version 150 /* Cel shading fragment program for single-pass rendering */ uniform vec4 diffuse; uniform vec4 specular; uniform sampler2D diffuseMap; uniform sampler2D diffuseRamp; uniform sampler2D specularRamp; uniform sampler2D edgeRamp; in vec2 uvIn; in float diffuseIn; in float specularIn; in float edge; out vec4 fragColour; /*uniform lighting { vec4 diffuse; vec4 specular; } LightingParams;*/ void main() { // Step functions from textures vec4 diffuseTex = texture(diffuseMap, uvIn); float diffuseStep = texture(diffuseRamp, vec2(diffuseIn, 0.0)).x; float specularStep = texture(specularRamp, vec2(specularIn, 0.0)).x; float edgeStep = texture(edgeRamp, vec2(edge, 0.0)).x; fragColour = diffuseTex * edgeStep * ((diffuse * diffuseStep) + (specular * specularStep)); }