Skybox.glsl 601 B

12345678910111213141516171819202122232425
  1. #include "Uniforms.glsl"
  2. #include "Samplers.glsl"
  3. #include "Transform.glsl"
  4. varying vec3 vTexCoord;
  5. void VS()
  6. {
  7. mat4 modelMatrix = iModelMatrix;
  8. vec3 worldPos = GetWorldPos(modelMatrix);
  9. gl_Position = GetClipPos(worldPos);
  10. #ifndef GL_ES
  11. gl_Position.z = gl_Position.w;
  12. #else
  13. // On OpenGL ES force Z slightly in front of far plane to avoid clipping artifacts due to inaccuracy
  14. gl_Position.z = 0.999 * gl_Position.w;
  15. #endif
  16. vTexCoord = iPos.xyz;
  17. }
  18. void PS()
  19. {
  20. gl_FragColor = cMatDiffColor * textureCube(sDiffCubeMap, vTexCoord);
  21. }