diff --git a/lib/torque/renderer/ball.js b/lib/torque/renderer/ball.js index 702ce81..39ad5fb 100644 --- a/lib/torque/renderer/ball.js +++ b/lib/torque/renderer/ball.js @@ -18,16 +18,22 @@ function BallRenderer(thecanvas){ this.ballsSoFar = 0; this.balls = 0; this.cumulative = true; + this.RW4 = this.radius * this.width *4; } BallRenderer.prototype = { + getBallIndices: function(x, y){ + var indices = new Int8Array(2*r+1); + + return indices; + }, addBall: function(x0, y0){ if(this.cachedBall){ - var startingPoint = this.getRIndexPos(x0, y0) - this.radius * this.width *4 - this.radius*4; + var startingPoint = this.getRIndexPos(x0, y0) - this.RW4 - this.radius*4; var i = 0, pointer = startingPoint, ballWidth = (this.radius*2)*4 linemax = startingPoint + 2 * this.radius*4, - endPoint = this.getRIndexPos(x0, y0) + this.radius * this.width *4 + this.radius; + endPoint = this.getRIndexPos(x0, y0) + this.RW4 + this.radius; while (pointer <= endPoint){ while (pointer <= linemax){ this.pointLayer[pointer+3] += this.cachedBall[i+3];