Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 400 core
- // описание материала
- struct MaterialStruct {
- int ambientTexutre;
- int diffuseTexture;
- int specularTexture;
- int bumpTexture;
- vec4 ambientColor;
- vec4 diffuseColor;
- vec4 specularColor;
- float specularComponent;
- float alpha;
- int illuminationModel;
- };
- // входящие параметры от вершинного шейдера
- in VertexData {
- vec3 textureCoords;
- vec3 normalCoords;
- int material;
- } vs_out;
- // uniform буферы
- // буфер материалов
- // std140 - размер каждой текстуры будет кратен 16 байтам
- layout (std140) uniform MaterialsBlock {
- MaterialStruct materials[8];
- } u_materials;
- // сэмплеры текстур
- uniform sampler2D u_samplers[16];
- // финальный цвет фрагмента
- out vec4 fs_color;
- void main() {
- fs_color = vec4(u_materials.materials[vs_out.material].diffuseColor.rgb, 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement