adds getballindices
This commit is contained in:
parent
dc7516e9e6
commit
aa79eeda20
@ -18,16 +18,22 @@ function BallRenderer(thecanvas){
|
|||||||
this.ballsSoFar = 0;
|
this.ballsSoFar = 0;
|
||||||
this.balls = 0;
|
this.balls = 0;
|
||||||
this.cumulative = true;
|
this.cumulative = true;
|
||||||
|
this.RW4 = this.radius * this.width *4;
|
||||||
}
|
}
|
||||||
BallRenderer.prototype = {
|
BallRenderer.prototype = {
|
||||||
|
getBallIndices: function(x, y){
|
||||||
|
var indices = new Int8Array(2*r+1);
|
||||||
|
|
||||||
|
return indices;
|
||||||
|
},
|
||||||
addBall: function(x0, y0){
|
addBall: function(x0, y0){
|
||||||
if(this.cachedBall){
|
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,
|
var i = 0,
|
||||||
pointer = startingPoint,
|
pointer = startingPoint,
|
||||||
ballWidth = (this.radius*2)*4
|
ballWidth = (this.radius*2)*4
|
||||||
linemax = startingPoint + 2 * this.radius*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 <= endPoint){
|
||||||
while (pointer <= linemax){
|
while (pointer <= linemax){
|
||||||
this.pointLayer[pointer+3] += this.cachedBall[i+3];
|
this.pointLayer[pointer+3] += this.cachedBall[i+3];
|
||||||
|
Loading…
Reference in New Issue
Block a user