don't pass the entire tile object to changeMatrix

This commit is contained in:
Konstantin Käfer
2014-01-30 12:37:16 +01:00
parent 6a343494ec
commit bc07cb4b26
3 changed files with 5 additions and 5 deletions

View File

@@ -33,7 +33,9 @@ public:
void setup();
void clear();
void changeMatrix(const Tile::ID& id);
void render(const std::shared_ptr<Tile>& tile);
void renderLayers(const std::shared_ptr<Tile>& tile, const std::vector<LayerDescription>& layers);
void renderDebug(const std::shared_ptr<Tile>& tile);
@@ -49,7 +51,6 @@ public:
private:
void setupShaders();
void changeMatrix(const std::shared_ptr<Tile>& tile);
public:

View File

@@ -294,6 +294,7 @@ bool Map::render() {
for (Tile::Ptr& tile : tiles) {
assert(tile);
if (tile->state == Tile::ready) {
painter.changeMatrix(tile->id);
painter.render(tile);
}
}

View File

@@ -51,13 +51,13 @@ void Painter::setupShaders() {
lineShader = std::make_shared<LineShader>();
}
void Painter::changeMatrix(const Tile::Ptr& tile) {
void Painter::changeMatrix(const Tile::ID& id) {
// Initialize projection matrix
mat4 projMatrix;
matrix::ortho(projMatrix, 0, transform.width, transform.height, 0, 1, 10);
// The position matrix.
transform.matrixFor(matrix, tile->id);
transform.matrixFor(matrix, id);
matrix::multiply(matrix, projMatrix, matrix);
// The extrusion matrix.
@@ -118,8 +118,6 @@ void Painter::render(const Tile::Ptr& tile) {
return;
}
changeMatrix(tile);
drawClippingMask();
renderLayers(tile, style.layers);