don't pass the entire tile object to changeMatrix
This commit is contained in:
@@ -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:
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user