No Description

ground.vert 946B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #version 450
  2. #extension GL_ARB_separate_shader_objects : enable
  3. #extension GL_ARB_shading_language_420pack : enable
  4. // Vertex attributes
  5. layout (location = 0) in vec4 inPos;
  6. layout (location = 1) in vec3 inNormal;
  7. layout (location = 2) in vec2 inUV;
  8. layout (location = 3) in vec3 inColor;
  9. layout (binding = 0) uniform UBO
  10. {
  11. mat4 projection;
  12. mat4 modelview;
  13. } ubo;
  14. layout (location = 0) out vec3 outNormal;
  15. layout (location = 1) out vec3 outColor;
  16. layout (location = 2) out vec2 outUV;
  17. layout (location = 3) out vec3 outViewVec;
  18. layout (location = 4) out vec3 outLightVec;
  19. out gl_PerVertex
  20. {
  21. vec4 gl_Position;
  22. };
  23. void main()
  24. {
  25. outColor = inColor;
  26. outUV = inUV * 32.0;
  27. outNormal = inNormal;
  28. vec4 pos = vec4(inPos.xyz, 1.0);
  29. gl_Position = ubo.projection * ubo.modelview * pos;
  30. vec4 wPos = ubo.modelview * vec4(pos.xyz, 1.0);
  31. vec4 lPos = vec4(0.0, -5.0, 0.0, 1.0);
  32. outLightVec = lPos.xyz - pos.xyz;
  33. outViewVec = -pos.xyz;
  34. }