Sha256: 78177cc5f0ae90c40538f23d176aa6fe651e2220493044ea72c7c90aa753b02f
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material) { return czm_getLambertDiffuse(lightDirectionEC, material.normal); } float czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material) { return czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess); } /** * Computes a color using the Phong lighting model. * * @name czm_phong * @glslFunction * * @param {vec3} toEye A normalized vector from the fragment to the eye in eye coordinates. * @param {czm_material} material The fragment's material. * * @returns {vec4} The computed color. * * @example * vec3 positionToEyeEC = // ... * czm_material material = // ... * gl_FragColor = czm_phong(normalize(positionToEyeEC), material); * * @see czm_getMaterial */ vec4 czm_phong(vec3 toEye, czm_material material) { // Diffuse from directional light sources at eye (for top-down and horizon views) float diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material) + czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material); // Specular from sun and pseudo-moon float specular = czm_private_getSpecularOfMaterial(czm_sunDirectionEC, toEye, material) + czm_private_getSpecularOfMaterial(czm_moonDirectionEC, toEye, material); vec3 ambient = vec3(0.0); vec3 color = ambient + material.emission; color += material.diffuse * diffuse; color += material.specular * specular; return vec4(color, material.alpha); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cesium-0.21 | app/assets/javascripts/Shaders/Builtin/Functions/phong.glsl |