parseUniform function
dynamic
parseUniform(
- dynamic activeInfo,
- dynamic addr,
- WebGLUniform container
)
Implementation
parseUniform(activeInfo, addr, WebGLUniform container) {
var path = activeInfo.name;
var pathLength = path.length;
// print("WebGLUniformsHelper.parseUniform path: ${path} addr: ${addr} ");
// reset RegExp object, because of the early exit of a previous run
// RePathPart.lastIndex = 0;
int _lastIndex = 0;
var matches = RePathPart.allMatches(path);
for (var match in matches) {
dynamic id = match.group(1);
var idIsIndex = match.group(2) == ']';
var subscript = match.group(3);
if (idIsIndex) id = int.parse(id); // convert to integer
var matchEnd = match.end;
if (subscript == null || subscript == '[' && matchEnd + 2 == pathLength) {
// bare name or "pure" bottom-level array "[0]" suffix
addUniform(
container,
subscript == null
? SingleUniform(id, activeInfo, addr)
: PureArrayUniform(id, activeInfo, addr));
break;
} else {
// step into inner node / create it in case it doesn't exist
var map = container.map;
var next = map[id];
if (next == null) {
next = StructuredUniform(id);
addUniform(container, next);
}
container = next;
}
}
}