Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 1.55 KB | None | 0 0
  1. #
  2. # RobGetOut custom shade
  3. #
  4.  
  5. # Vertex shader for brushes
  6. shade RobGetOut code brush vs {
  7.     #version 120
  8.  
  9.     void main()
  10.     {
  11.         gl_FrontColor = gl_Color;
  12.         gl_TexCoord[0] = gl_MultiTexCoord0;
  13.         gl_TexCoord[1] = gl_MultiTexCoord1;
  14.         gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
  15.     }
  16. }
  17.  
  18. # Fragment shader for brushes
  19. shade RobGetOut code brush fs {
  20.     #version 120
  21.    
  22.     uniform sampler2D texture;
  23.     uniform sampler2D lightmap;
  24.    
  25.     void main()
  26.     {
  27.     vec4 lmc = texture2D(lightmap, gl_TexCoord[1].st);
  28.         vec4 color = texture2D(texture, gl_TexCoord[0].st)*vec4(lmc.x, lmc.y, lmc.z, 1.0);
  29.         gl_FragColor = color + color*color*vec4(1.5, 1.5, 1.5, 1.0) + color*color*color*vec4(2.0, 2.0, 2.0, 1.0);
  30.     }
  31. }
  32.  
  33. # Vertex shader for meshes
  34. shade RobGetOut code mesh vs {
  35.     #version 120
  36.  
  37.     varying vec3 normal;
  38.  
  39.     void main()
  40.     {
  41.         gl_FrontColor = gl_Color;
  42.         gl_TexCoord[0] = gl_MultiTexCoord0;
  43.         normal = gl_NormalMatrix*gl_Normal;
  44.         gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
  45.     }
  46. }
  47.  
  48. # Fragment shader for meshes
  49. shade RobGetOut code mesh fs {
  50.     #version 120
  51.  
  52.     uniform sampler2D texture;
  53.     varying vec3 normal;
  54.  
  55.     void main()
  56.     {
  57.         float lighting = dot(normalize(normal), gl_LightSource[0].position.xyz);
  58.         vec4 color = texture2D(texture, gl_TexCoord[0].st)*(gl_LightSource[0].diffuse*lighting + gl_LightSource[0].ambient);
  59.         gl_FragColor = color + color*color*vec4(0.5, 0.5, 0.5, 1.0);
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement