Advertisement
Guest User

Untitled

a guest
Jul 7th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.00 KB | None | 0 0
  1. #version 400 core
  2.  
  3. // описание материала
  4. struct MaterialStruct {
  5.     int ambientTexutre;
  6.     int diffuseTexture;
  7.     int specularTexture;
  8.     int bumpTexture;
  9.  
  10.     vec4 ambientColor;
  11.     vec4 diffuseColor;
  12.     vec4 specularColor;
  13.  
  14.     float specularComponent;
  15.     float alpha;
  16.     int illuminationModel;
  17. };
  18.  
  19.  
  20. // входящие параметры от вершинного шейдера
  21. in VertexData {
  22.     vec3 textureCoords;
  23.     vec3 normalCoords;
  24.     int material;
  25. } vs_out;
  26.  
  27. // uniform буферы
  28. // буфер материалов
  29. // std140 - размер каждой текстуры будет кратен 16 байтам
  30. layout (std140) uniform MaterialsBlock {
  31.     MaterialStruct materials[8];
  32. } u_materials;
  33.  
  34. // сэмплеры текстур
  35. uniform sampler2D u_samplers[16];
  36.  
  37. // финальный цвет фрагмента
  38. out vec4 fs_color;
  39.  
  40.  
  41. void main() {
  42.     fs_color = vec4(u_materials.materials[vs_out.material].diffuseColor.rgb, 1);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement