in seriously.js [2351:2403]
EffectNode.prototype.render = function () {
var key,
frameBuffer,
effect = this.effect,
that = this,
inPlace;
function drawFn(shader, model, uniforms, frameBuffer, node, options) {
draw(shader, model, uniforms, frameBuffer, node || that, options);
}
if (!gl) {
return;
}
if (!this.initialized) {
this.initialize();
}
if (this.shaderDirty) {
this.buildShader();
}
if (this.dirty && this.ready) {
for (key in this.sources) {
if (this.sources.hasOwnProperty(key) &&
(!effect.requires || effect.requires.call(this, key, this.inputs))) {
//todo: set source texture in case it changes?
//sourcetexture = this.sources[i].render() || this.sources[i].texture
inPlace = typeof this.inPlace === 'function' ? this.inPlace(key) : this.inPlace;
this.sources[key].render(!inPlace);
}
}
if (this.frameBuffer) {
frameBuffer = this.frameBuffer.frameBuffer;
}
if (typeof effect.draw === 'function') {
effect.draw.call(this, this.shader, this.model, this.uniforms, frameBuffer, drawFn);
this.emit('render');
} else if (frameBuffer) {
draw(this.shader, this.model, this.uniforms, frameBuffer, this);
this.emit('render');
}
this.dirty = false;
}
return this.texture;
};