You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
637 B
GLSL
24 lines
637 B
GLSL
varying vec3 v_positionEC;
|
|
varying vec3 v_normalEC;
|
|
|
|
void main()
|
|
{
|
|
vec3 positionToEyeEC = -v_positionEC;
|
|
|
|
vec3 normalEC = normalize(v_normalEC);
|
|
#ifdef FACE_FORWARD
|
|
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
|
#endif
|
|
|
|
czm_materialInput materialInput;
|
|
materialInput.normalEC = normalEC;
|
|
materialInput.positionToEyeEC = positionToEyeEC;
|
|
czm_material material = czm_getMaterial(materialInput);
|
|
|
|
#ifdef FLAT
|
|
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
|
#else
|
|
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
|
#endif
|
|
}
|