in seriously.js [4553:4608]
TransformNode.prototype.render = function (renderTransform) {
if (!this.source) {
if (this.transformDirty) {
mat4.copy(this.cumulativeMatrix, this.matrix);
this.transformDirty = false;
}
this.texture = null;
this.dirty = false;
return;
}
this.source.render();
if (this.transformDirty) {
if (this.transformed) {
//use this.matrix
if (this.source.cumulativeMatrix) {
mat4.multiply(this.cumulativeMatrix, this.matrix, this.source.cumulativeMatrix);
} else {
mat4.copy(this.cumulativeMatrix, this.matrix);
}
} else {
//copy source.cumulativeMatrix
mat4.copy(this.cumulativeMatrix, this.source.cumulativeMatrix || identity);
}
this.transformDirty = false;
}
if (renderTransform && gl) {
if (this.renderDirty) {
if (!this.frameBuffer) {
this.uniforms = {
resolution: [this.width, this.height]
};
this.frameBuffer = new FrameBuffer(gl, this.width, this.height);
}
this.uniforms.source = this.source.texture;
this.uniforms.transform = this.cumulativeMatrix || identity;
draw(baseShader, rectangleModel, this.uniforms, this.frameBuffer.frameBuffer, this);
this.renderDirty = false;
}
this.texture = this.frameBuffer.texture;
} else if (this.source) {
this.texture = this.source.texture;
} else {
this.texture = null;
}
this.dirty = false;
return this.texture;
};