From 3c7d14349a8862b13387c88fa7e0d3e3589d0bab Mon Sep 17 00:00:00 2001 From: Christoph Diehl <1614333+posidron@users.noreply.github.com> Date: Thu, 10 May 2018 09:16:18 +0200 Subject: [PATCH] Let webgl.match() be accessible --- lib/make/webgl.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/make/webgl.js b/lib/make/webgl.js index 5941cb9..3a54814 100644 --- a/lib/make/webgl.js +++ b/lib/make/webgl.js @@ -57,7 +57,7 @@ class webgl extends make { return random.item(sources) } - match (shader, regex, group = 1) { + static match (shader, regex, group = 1) { let matches = [] let match while (match = regex.exec(shader)) { @@ -68,33 +68,33 @@ class webgl extends make { static parseUniforms (shader, group = 1) { /* Todo: Parse their individual data types into categories. */ - return match(shader, /uniform .+? (\w+)(?=[\[;])/gm, group) + return webgl.match(shader, /uniform .+? (\w+)(?=[\[;])/gm, group) } static parseAttributes (shader, group = 1) { - return match(shader, /attribute .+? (\w+)(?=;)/gm, group) + return webgl.match(shader, /attribute .+? (\w+)(?=;)/gm, group) } static parseVaryings (shader, group = 1) { - return match(shader, /varying .+? (\w+)(?=;)/gm, group) + return webgl.match(shader, /varying .+? (\w+)(?=;)/gm, group) } static parseFragDatav2 (shader, group = 1) { // #version 200 - return match(shader, /(gl_Frag[^[ =]+)/gm, group) + return webgl.match(shader, /(gl_Frag[^[ =]+)/gm, group) } static parseFragDatav3 (shader, group = 1) { // #version 300 - return match(shader, /out .+? (\w+)(?=[\[;])/gm, group) + return webgl.match(shader, /out .+? (\w+)(?=[\[;])/gm, group) } static parseFrag (shader, group = 1) { - let matches = parseFragDatav2(shader) + let matches = webgl.parseFragDatav2(shader) if (matches.length) { return matches } - return parseFragDatav3(shader) + return webgl.parseFragDatav3(shader) } static randomBitmask () {