Add parseUniforms and parseAttributes for WebGL shaders
This commit is contained in:
parent
f0befe57fc
commit
15c9503e40
1 changed files with 8 additions and 6 deletions
|
@ -55,7 +55,7 @@
|
||||||
return 'RENDERBUFFER'
|
return 'RENDERBUFFER'
|
||||||
},
|
},
|
||||||
textureSources: () => {
|
textureSources: () => {
|
||||||
sources = [
|
let sources = [
|
||||||
'HTMLCanvasElement',
|
'HTMLCanvasElement',
|
||||||
'HTMLImageElement',
|
'HTMLImageElement',
|
||||||
'HTMLVideoElement',
|
'HTMLVideoElement',
|
||||||
|
@ -66,19 +66,21 @@
|
||||||
return random.item(sources)
|
return random.item(sources)
|
||||||
},
|
},
|
||||||
parseUniforms: (shader) => {
|
parseUniforms: (shader) => {
|
||||||
let names = [], result = shader.match(/uniform .* (\w+)(?=;)/gm)
|
let names = []
|
||||||
|
let result = shader.match(/uniform .* (\w+)(?=;)/gm)
|
||||||
if (result) {
|
if (result) {
|
||||||
result.forEach(function (v) {
|
result.forEach(function (v) {
|
||||||
names.push(v.split(" ").pop())
|
names.push(v.split(' ').pop())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return names
|
return names
|
||||||
},
|
},
|
||||||
parseAttributes: (shader) => {
|
parseAttributes: (shader) => {
|
||||||
let names = [], result = shader.match(/attribute .* (\w+)(?=;)/gm)
|
let names = []
|
||||||
|
let result = shader.match(/attribute .* (\w+)(?=;)/gm)
|
||||||
if (result) {
|
if (result) {
|
||||||
result.forEach(function (v) {
|
result.forEach(function (v) {
|
||||||
names.push(v.split(" ").pop())
|
names.push(v.split(' ').pop())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return names
|
return names
|
||||||
|
|
Loading…
Reference in a new issue