blob: 8aad803869986e91e720996cc3e1f0e7e1c03fa6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
Star = function(center, size, starsBuf) {
if (starsBuf.length == STAR_MAX_COUNT)
throw 'Error: cannot add more stars, limit of ' + STAR_MAX_COUNT + ' reached!'
this.sphere = new Sphere(center, size);
this.sphere.color = [0.956,0.5,0.215];
this.index = starsBuf.push([]) - 1;
this.center = center;
this.sphere.center = center;
starsBuf[this.index] = center.concat(this.sphere.size);
}
Star.prototype.moveTo = function(newCenter, starsBuf) {
this.sphere.center = newCenter;
starsBuf[this.index] = newCenter.concat(this.sphere.size);
gl.uniform4fv(gl.getUniformLocation(glprog, 'uStars[' + this.index + ']'), starsBuf[this.index]);
}
Star.prototype.draw = function() {
this.sphere.draw();
}
|