No Description

texture3d.vert 1015B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #version 450
  2. #extension GL_ARB_separate_shader_objects : enable
  3. #extension GL_ARB_shading_language_420pack : enable
  4. layout (location = 0) in vec3 inPos;
  5. layout (location = 1) in vec2 inUV;
  6. layout (location = 2) in vec3 inNormal;
  7. layout (binding = 0) uniform UBO
  8. {
  9. mat4 projection;
  10. mat4 model;
  11. vec4 viewPos;
  12. float depth;
  13. } ubo;
  14. layout (location = 0) out vec3 outUV;
  15. layout (location = 1) out float outLodBias;
  16. layout (location = 2) out vec3 outNormal;
  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. outUV = vec3(inUV, ubo.depth);
  26. vec3 worldPos = vec3(ubo.model * vec4(inPos, 1.0));
  27. gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0);
  28. vec4 pos = ubo.model * vec4(inPos, 1.0);
  29. outNormal = mat3(inverse(transpose(ubo.model))) * inNormal;
  30. vec3 lightPos = vec3(0.0);
  31. vec3 lPos = mat3(ubo.model) * lightPos.xyz;
  32. outLightVec = lPos - pos.xyz;
  33. outViewVec = ubo.viewPos.xyz - pos.xyz;
  34. }