Let webgl.match() be accessible
This commit is contained in:
parent
60a7b65cdf
commit
3c7d14349a
1 changed files with 8 additions and 8 deletions
|
@ -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 () {
|
||||
|
|
Loading…
Reference in a new issue