Advertisement
Guest User

material.vert

a guest
Dec 24th, 2015
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. attribute vec3 att0;
  2. varying vec3 var0;
  3. #ifndef USE_OPENSUBDIV
  4. attribute vec2 att1;
  5. varying vec2 var1;
  6. #endif
  7. attribute vec4 att2;
  8. varying vec4 var2;
  9.  
  10. #ifdef USE_OPENSUBDIV
  11.  
  12. in vec3 normal;
  13.  
  14. in vec4 position;
  15.  
  16.  
  17.  
  18. out block {
  19.  
  20.     VertexData v;
  21.  
  22. } outpt;
  23.  
  24. #endif
  25.  
  26.  
  27.  
  28. varying vec3 varposition;
  29.  
  30. varying vec3 varnormal;
  31.  
  32.  
  33.  
  34. #ifdef CLIP_WORKAROUND
  35.  
  36. varying float gl_ClipDistance[6];
  37.  
  38. #endif
  39.  
  40.  
  41.  
  42. void main()
  43.  
  44. {
  45.  
  46. #ifndef USE_OPENSUBDIV
  47.  
  48.     vec4 position = gl_Vertex;
  49.  
  50.     vec3 normal = gl_Normal;
  51.  
  52. #endif
  53.  
  54.  
  55.  
  56.     vec4 co = gl_ModelViewMatrix * position;
  57.  
  58.  
  59.  
  60.     varposition = co.xyz;
  61.  
  62.     varnormal = normalize(gl_NormalMatrix * normal);
  63.  
  64.     gl_Position = gl_ProjectionMatrix * co;
  65.  
  66.  
  67.  
  68. #ifdef CLIP_WORKAROUND
  69.  
  70.     int i;
  71.  
  72.     for(i = 0; i < 6; i++)
  73.  
  74.         gl_ClipDistance[i] = dot(co, gl_ClipPlane[i]);
  75.  
  76. #elif !defined(GPU_ATI)
  77.  
  78.     // Setting gl_ClipVertex is necessary to get glClipPlane working on NVIDIA
  79.  
  80.     // graphic cards, while on ATI it can cause a software fallback.
  81.  
  82.     gl_ClipVertex = co;
  83.  
  84. #endif
  85.  
  86.  
  87.  
  88. #ifdef USE_OPENSUBDIV
  89.  
  90.     outpt.v.position = co;
  91.  
  92.     outpt.v.normal = varnormal;
  93.  
  94. #endif
  95.  
  96.     var0 = att0;
  97. #ifndef USE_OPENSUBDIV
  98.     var1 = att1;
  99. #endif
  100.     var2 = att2;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement