Clone of mesa.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

CH18-mandel.vert.txt 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // Vertex shader for drawing the Mandelbrot set
  3. //
  4. // Authors: Dave Baldwin, Steve Koren, Randi Rost
  5. // based on a shader by Michael Rivero
  6. //
  7. // Copyright (c) 2002-2005: 3Dlabs, Inc.
  8. //
  9. // See 3Dlabs-License.txt for license information
  10. //
  11. uniform vec3 LightPosition;
  12. uniform float SpecularContribution;
  13. uniform float DiffuseContribution;
  14. uniform float Shininess;
  15. varying float LightIntensity;
  16. varying vec3 Position;
  17. void main()
  18. {
  19. vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Vertex);
  20. vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal);
  21. vec3 lightVec = normalize(LightPosition - ecPosition);
  22. vec3 reflectVec = reflect(-lightVec, tnorm);
  23. vec3 viewVec = normalize(-ecPosition);
  24. float spec = max(dot(reflectVec, viewVec), 0.0);
  25. spec = pow(spec, Shininess);
  26. LightIntensity = DiffuseContribution *
  27. max(dot(lightVec, tnorm), 0.0) +
  28. SpecularContribution * spec;
  29. Position = vec3(gl_MultiTexCoord0 - 0.5) * 5.0;
  30. gl_Position = ftransform();
  31. }