<jittershader name="toon">
	<description>
	Simple toon style shader.
	</description>
	<param name="diffuse" type="vec4" default="0.0 0.25 1.0 1.0">
		<description>Diffuse Color</description>
	</param>
	<param name="specular" type="vec4" default="0.75 0.75 1.0 1.0">
		<description>Specular Color</description>
	</param>
	<param name="edge" type="float" default="0.5">
		<description>Edge Threshold</description>
	</param>
	<param name="shininess" type="float" default="0.98">
		<description>Specularity Adjustment</description>
	</param>
	<language name="glsl" version="1.0">
		<bind param="diffuse" program="fp" />
		<bind param="specular" program="fp" />
		<bind param="edge" program="fp" />
		<bind param="shininess" program="fp" />
		<program name="vp" type="vertex">
<![CDATA[
//
// Vertex shader for cartoon-style shading
//
// Author: Philip Rideout
//
// Copyright (c) 2005 3Dlabs Inc. Ltd.
//
// See 3Dlabs-License.txt for license information
//

varying vec3 normal;

void main(void)
{

	normal = normalize(gl_NormalMatrix * gl_Normal);
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

}
]]>
		</program>
		<program name="fp" type="fragment">
<![CDATA[
//
// Fragment shader for cartoon-style shading
//
// Author: Philip Rideout
//
// Copyright (c) 2005 3Dlabs Inc. Ltd.
//
// See 3Dlabs-License.txt for license information
//

uniform vec4 diffuse;
uniform vec4 specular;
uniform float edge;
uniform float shininess;

varying vec3 normal;

void main (void)
{
	vec4 color = diffuse;

	float f = dot(vec3(0,0,1),normal);

	if (abs(f) < edge)
		color = vec4(0,0,0,1);

	if (f > shininess)
		color = specular;

	gl_FragColor = color;
}
]]>
		</program>
	</language>	
</jittershader>
