MCPcopy Create free account
hub / github.com/microsoft/SandDance / getLightSourceUniforms

Function getLightSourceUniforms

docs/app/js/sanddance-app.js:76051–76076  ·  view source on GitHub ↗
(_ref2)

Source from the content-addressed store, hash-verified

76049 });
76050}
76051function getLightSourceUniforms(_ref2) {
76052 var ambientLight = _ref2.ambientLight, _ref2$pointLights = _ref2.pointLights, pointLights = _ref2$pointLights === void 0 ? [] : _ref2$pointLights, _ref2$directionalLigh = _ref2.directionalLights, directionalLights = _ref2$directionalLigh === void 0 ? [] : _ref2$directionalLigh;
76053 var lightSourceUniforms = {};
76054 if (ambientLight) lightSourceUniforms["lighting_uAmbientLight.color"] = convertColor(ambientLight);
76055 else lightSourceUniforms["lighting_uAmbientLight.color"] = [
76056 0,
76057 0,
76058 0
76059 ];
76060 pointLights.forEach(function(pointLight, index) {
76061 lightSourceUniforms["lighting_uPointLight[".concat(index, "].color")] = convertColor(pointLight);
76062 lightSourceUniforms["lighting_uPointLight[".concat(index, "].position")] = pointLight.position;
76063 lightSourceUniforms["lighting_uPointLight[".concat(index, "].attenuation")] = pointLight.attenuation || [
76064 1,
76065 0,
76066 0
76067 ];
76068 });
76069 lightSourceUniforms.lighting_uPointLightCount = pointLights.length;
76070 directionalLights.forEach(function(directionalLight, index) {
76071 lightSourceUniforms["lighting_uDirectionalLight[".concat(index, "].color")] = convertColor(directionalLight);
76072 lightSourceUniforms["lighting_uDirectionalLight[".concat(index, "].direction")] = directionalLight.direction;
76073 });
76074 lightSourceUniforms.lighting_uDirectionalLightCount = directionalLights.length;
76075 return lightSourceUniforms;
76076}
76077function getUniforms() {
76078 var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_MODULE_OPTIONS;
76079 if ("lightSources" in opts) {

Callers 1

getUniformsFunction · 0.70

Calls 2

convertColorFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected