Skip to content

Commit

Permalink
Take a number, not elementGroups, as an argument to setAttribPointers…
Browse files Browse the repository at this point in the history
… (SQUASH ME)
  • Loading branch information
Lucas Wojciechowski committed Mar 3, 2016
1 parent 6d5f228 commit c9b0d8f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions js/data/bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Bucket.prototype.isAttributeDisabled = function(attribute) {
* @param {number} offset The offset of the attribute data in the currently bound GL buffer.
* @param {Array} arguments to be passed to disabled attribute value functions
*/
Bucket.prototype.setAttribPointers = function(shaderName, gl, shader, group, args) {
Bucket.prototype.setAttribPointers = function(shaderName, gl, shader, vertexOffset, args) {
// Set disabled attributes
var disabledAttributes = this.getAttributes(shaderName, {isDisabled: true});
for (var i = 0; i < disabledAttributes.length; i++) {
Expand All @@ -243,7 +243,7 @@ Bucket.prototype.setAttribPointers = function(shaderName, gl, shader, group, arg
vertexBuffer.setAttribPointers(
gl,
shader,
group.vertexOffset,
vertexOffset,
util.mapObjectKV(enabledAttributes, function(attribute) {
return [attribute.name, 'a_' + attribute.name];
})
Expand Down
2 changes: 1 addition & 1 deletion js/render/draw_circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function drawCircles(painter, source, layer, coords) {
for (var k = 0; k < elementGroups.length; k++) {
var group = elementGroups[k];

bucket.setAttribPointers('circle', gl, shader, group, [{$zoom: painter.transform.zoom}]);
bucket.setAttribPointers('circle', gl, shader, group.vertexOffset, [{$zoom: painter.transform.zoom}]);

var count = group.elementLength * 3;
gl.drawElements(gl.TRIANGLES, count, gl.UNSIGNED_SHORT, group.elementOffset);
Expand Down
2 changes: 1 addition & 1 deletion js/render/draw_collision_debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function drawCollisionDebug(painter, source, layer, coords) {
if (elementGroups[0].vertexLength === 0) continue;

bucket.bindBuffers('collisionBox', gl);
bucket.setAttribPointers('collisionBox', gl, shader, elementGroups[0]);
bucket.setAttribPointers('collisionBox', gl, shader, elementGroups[0].vertexOffset);

var posMatrix = painter.calculatePosMatrix(coord, source.maxzoom);
gl.setPosMatrix(posMatrix);
Expand Down
4 changes: 2 additions & 2 deletions js/render/draw_fill.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function drawFill(painter, source, layer, coord) {

for (var i = 0; i < elementGroups.length; i++) {
var group = elementGroups[i];
bucket.setAttribPointers('fill', gl, painter.fillShader, group);
bucket.setAttribPointers('fill', gl, painter.fillShader, group.vertexOffset);

var count = group.elementLength * 3;
gl.drawElements(gl.TRIANGLES, count, gl.UNSIGNED_SHORT, group.elementOffset);
Expand Down Expand Up @@ -202,7 +202,7 @@ function drawStroke(painter, source, layer, coord) {

for (var k = 0; k < elementGroups.length; k++) {
var group = elementGroups[k];
bucket.setAttribPointers('fill', gl, painter.outlineShader, group);
bucket.setAttribPointers('fill', gl, painter.outlineShader, group.vertexOffset);

var count = group.secondElementLength * 2;
gl.drawElements(gl.LINES, count, gl.UNSIGNED_SHORT, group.secondElementOffset);
Expand Down
2 changes: 1 addition & 1 deletion js/render/draw_line.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ module.exports = function drawLine(painter, source, layer, coords) {

for (var i = 0; i < elementGroups.length; i++) {
var group = elementGroups[i];
bucket.setAttribPointers('line', gl, shader, group);
bucket.setAttribPointers('line', gl, shader, group.vertexOffset);

var count = group.elementLength * 3;
gl.drawElements(gl.TRIANGLES, count, gl.UNSIGNED_SHORT, group.elementOffset);
Expand Down
6 changes: 3 additions & 3 deletions js/render/draw_symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function drawSymbol(painter, layer, posMatrix, tile, bucket, elementGroups, pref

for (var j = 0; j < elementGroups.length; j++) {
group = elementGroups[j];
bucket.setAttribPointers(shaderInterfaceName, gl, shader, group);
bucket.setAttribPointers(shaderInterfaceName, gl, shader, group.vertexOffset);

count = group.elementLength * 3;
gl.drawElements(gl.TRIANGLES, count, gl.UNSIGNED_SHORT, group.elementOffset);
Expand All @@ -182,7 +182,7 @@ function drawSymbol(painter, layer, posMatrix, tile, bucket, elementGroups, pref

for (var i = 0; i < elementGroups.length; i++) {
group = elementGroups[i];
bucket.setAttribPointers(shaderInterfaceName, gl, shader, group);
bucket.setAttribPointers(shaderInterfaceName, gl, shader, group.vertexOffset);

count = group.elementLength * 3;
gl.drawElements(gl.TRIANGLES, count, gl.UNSIGNED_SHORT, group.elementOffset);
Expand All @@ -192,7 +192,7 @@ function drawSymbol(painter, layer, posMatrix, tile, bucket, elementGroups, pref
gl.uniform1f(shader.u_opacity, layer.paint['icon-opacity']);
for (var k = 0; k < elementGroups.length; k++) {
group = elementGroups[k];
bucket.setAttribPointers(shaderInterfaceName, gl, shader, group);
bucket.setAttribPointers(shaderInterfaceName, gl, shader, group.vertexOffset);

count = group.elementLength * 3;
gl.drawElements(gl.TRIANGLES, count, gl.UNSIGNED_SHORT, group.elementOffset);
Expand Down

0 comments on commit c9b0d8f

Please sign in to comment.