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

Function processAttributeDefinition

docs/tests/v2/es6/js/sanddance.js:29804–29842  ·  view source on GitHub ↗
(line, textureMap)

Source from the content-addressed store, hash-verified

29802
29803
29804function processAttributeDefinition(line, textureMap) {
29805 var samplerTextureMap = {};
29806 var attributeData = getAttributeDefinition(line);
29807
29808 if (!attributeData) {
29809 return null;
29810 }
29811
29812 var type = attributeData.type,
29813 name = attributeData.name;
29814
29815 if (name && textureMap[name]) {
29816 var updatedLine = "// ".concat(line, " => Replaced by Transform with a sampler");
29817
29818 var _getSamplerDecleratio = getSamplerDeclerations(name),
29819 samplerName = _getSamplerDecleratio.samplerName,
29820 sizeName = _getSamplerDecleratio.sizeName,
29821 uniformDeclerations = _getSamplerDecleratio.uniformDeclerations;
29822
29823 var channels = (0, _src.typeToChannelSuffix)(type);
29824 var sampleInstruction = " ".concat(type, " ").concat(name, " = transform_getInput(").concat(samplerName, ", ").concat(sizeName, ").").concat(channels, ";\n");
29825 samplerTextureMap[samplerName] = name;
29826 var inject = {
29827 'vs:#decl': uniformDeclerations,
29828 'vs:#main-start': sampleInstruction
29829 }; // samplerNameMap
29830
29831 return {
29832 // update vertex shader line.
29833 updatedLine: updatedLine,
29834 // inject object with sampler instructions.
29835 inject: inject,
29836 // sampler name to texture name map
29837 samplerTextureMap: samplerTextureMap
29838 };
29839 }
29840
29841 return null;
29842}
29843},{"assert":"azYr","../shadertools/src":"H4AH"}],"TTgu":[function(require,module,exports) {
29844
29845"use strict";

Callers 1

updateForTexturesFunction · 0.70

Calls 2

getAttributeDefinitionFunction · 0.70
getSamplerDeclerationsFunction · 0.70

Tested by

no test coverage detected