Fix regex for parsing uniforms and attributes

This commit is contained in:
Christoph Diehl 2018-05-09 17:48:44 +02:00
parent a7ac3bc258
commit 6079e9b428
No known key found for this signature in database
GPG key ID: 799CE5B68FEF404A

View file

@ -59,7 +59,7 @@ class webgl extends make {
static parseUniforms (shader) { static parseUniforms (shader) {
let names = [] let names = []
let result = shader.match(/uniform .* (\w+)(?=;)/gm) let result = shader.match(/uniform \w+ \w+(?=;)/gm)
if (result) { if (result) {
result.forEach((v) => names.push(v.split(' ').pop())) result.forEach((v) => names.push(v.split(' ').pop()))
} }
@ -68,7 +68,7 @@ class webgl extends make {
static parseAttributes (shader) { static parseAttributes (shader) {
let names = [] let names = []
let result = shader.match(/attribute .* (\w+)(?=;)/gm) let result = shader.match(/attribute \w+ \w+(?=;)/gm)
if (result) { if (result) {
result.forEach((v) => names.push(v.split(' ').pop())) result.forEach((v) => names.push(v.split(' ').pop()))
} }