import { SKY_GLSL, SKY_UNIFORMS_GLSL } from './skyCommon';

export const SKY_VERT = /* glsl */ `
varying vec3 vWorldPos;
void main() {
  vWorldPos = (modelMatrix * vec4(position, 1.0)).xyz;
  vec4 mv = modelViewMatrix * vec4(position, 1.0);
  gl_Position = projectionMatrix * mv;
  // pin to far plane so the dome never clips
  gl_Position.z = gl_Position.w * 0.99999;
}
`;

export const SKY_FRAG = /* glsl */ `
precision highp float;
varying vec3 vWorldPos;
${SKY_UNIFORMS_GLSL}
${SKY_GLSL}
void main() {
  vec3 rd = normalize(vWorldPos - cameraPosition);
  vec3 col = skyColor(rd, uTime);
  gl_FragColor = vec4(col, 1.0);
}
`;
