132001f49Smrg// 232001f49Smrg// Vertex shader for drawing the Mandelbrot set 332001f49Smrg// 432001f49Smrg// Authors: Dave Baldwin, Steve Koren, Randi Rost 532001f49Smrg// based on a shader by Michael Rivero 632001f49Smrg// 732001f49Smrg// Copyright (c) 2002-2005: 3Dlabs, Inc. 832001f49Smrg// 932001f49Smrg// See 3Dlabs-License.txt for license information 1032001f49Smrg// 1132001f49Smrg 1232001f49Smrguniform vec3 LightPosition; 1332001f49Smrguniform float SpecularContribution; 1432001f49Smrguniform float DiffuseContribution; 1532001f49Smrguniform float Shininess; 1632001f49Smrg 1732001f49Smrgvarying float LightIntensity; 1832001f49Smrgvarying vec3 Position; 1932001f49Smrg 2032001f49Smrgvoid main() 2132001f49Smrg{ 2232001f49Smrg vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Vertex); 2332001f49Smrg vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal); 2432001f49Smrg vec3 lightVec = normalize(LightPosition - ecPosition); 2532001f49Smrg vec3 reflectVec = reflect(-lightVec, tnorm); 2632001f49Smrg vec3 viewVec = normalize(-ecPosition); 2732001f49Smrg float spec = max(dot(reflectVec, viewVec), 0.0); 2832001f49Smrg spec = pow(spec, Shininess); 2932001f49Smrg LightIntensity = DiffuseContribution * 3032001f49Smrg max(dot(lightVec, tnorm), 0.0) + 3132001f49Smrg SpecularContribution * spec; 3232001f49Smrg Position = vec3(gl_MultiTexCoord0 - 0.5) * 5.0; 3332001f49Smrg gl_Position = ftransform(); 3432001f49Smrg 3532001f49Smrg}