Add parseUniforms and parseAttributes for WebGL shaders
This commit is contained in:
parent
3ddc37a7e9
commit
f0befe57fc
1 changed files with 18 additions and 0 deletions
|
@ -64,5 +64,23 @@
|
||||||
'ArrayBufferView'
|
'ArrayBufferView'
|
||||||
]
|
]
|
||||||
return random.item(sources)
|
return random.item(sources)
|
||||||
|
},
|
||||||
|
parseUniforms: (shader) => {
|
||||||
|
let names = [], result = shader.match(/uniform .* (\w+)(?=;)/gm)
|
||||||
|
if (result) {
|
||||||
|
result.forEach(function (v) {
|
||||||
|
names.push(v.split(" ").pop())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return names
|
||||||
|
},
|
||||||
|
parseAttributes: (shader) => {
|
||||||
|
let names = [], result = shader.match(/attribute .* (\w+)(?=;)/gm)
|
||||||
|
if (result) {
|
||||||
|
result.forEach(function (v) {
|
||||||
|
names.push(v.split(" ").pop())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return names
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue