BlackHole = function(center, size, blackHolesBuf) { if (blackHolesBuf.length == BLACKHOLE_MAX_COUNT) throw 'Error: cannot add more black holes, limit of ' + BLACKHOLE_MAX_COUNT + ' reached!' this.rs = size / 3; this.index = blackHolesBuf.push([]) - 1; this.center = center; blackHolesBuf[this.index] = center.concat(this.rs); } BlackHole.prototype.moveTo = function(newCenter, blackHolesBuf) { blackHolesBuf[this.index] = newCenter.concat(this.rs); gl.uniform4fv(gl.getUniformLocation(glprog, 'uBH[' + this.index + ']'), blackHolesBuf[this.index]); } BlackHole.prototype.draw = function() { // Black holes are not "drawn" }