/** * Select which direction vector to use for dynamic atmosphere lighting based on an enum value * * @name czm_getDynamicAtmosphereLightDirection * @glslfunction * @see DynamicAtmosphereLightingType.js * * @param {vec3} positionWC the position of the vertex/fragment in world coordinates. This is normalized and returned when dynamic lighting is turned off. * @param {float} lightEnum The enum value for selecting between light sources. * @return {vec3} The normalized light direction vector. Depending on the enum value, it is either positionWC, czm_lightDirectionWC or czm_sunDirectionWC */ vec3 czm_getDynamicAtmosphereLightDirection(vec3 positionWC, float lightEnum) { const float NONE = 0.0; const float SCENE_LIGHT = 1.0; const float SUNLIGHT = 2.0; vec3 lightDirection = positionWC * float(lightEnum == NONE) + czm_lightDirectionWC * float(lightEnum == SCENE_LIGHT) + czm_sunDirectionWC * float(lightEnum == SUNLIGHT); return normalize(lightDirection); }