sdfsdfs
This commit is contained in:
32
node_modules/pixi.js/lib/rendering/high-shader/compiler/utils/compileInputs.js
generated
vendored
Normal file
32
node_modules/pixi.js/lib/rendering/high-shader/compiler/utils/compileInputs.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
function extractInputs(fragmentSource, out) {
|
||||
let match;
|
||||
const regex = /@in\s+([^;]+);/g;
|
||||
while ((match = regex.exec(fragmentSource)) !== null) {
|
||||
out.push(match[1]);
|
||||
}
|
||||
}
|
||||
function compileInputs(fragments, template, sort = false) {
|
||||
const results = [];
|
||||
extractInputs(template, results);
|
||||
fragments.forEach((fragment) => {
|
||||
if (fragment.header) {
|
||||
extractInputs(fragment.header, results);
|
||||
}
|
||||
});
|
||||
const mainInput = results;
|
||||
if (sort) {
|
||||
mainInput.sort();
|
||||
}
|
||||
const finalString = mainInput.map((inValue, i) => ` @location(${i}) ${inValue},`).join("\n");
|
||||
let cleanedString = template.replace(/@in\s+[^;]+;\s*/g, "");
|
||||
cleanedString = cleanedString.replace("{{in}}", `
|
||||
${finalString}
|
||||
`);
|
||||
return cleanedString;
|
||||
}
|
||||
|
||||
exports.compileInputs = compileInputs;
|
||||
//# sourceMappingURL=compileInputs.js.map
|
Reference in New Issue
Block a user