[core] Add Projection matrix to CustomLayerRenderParameters to transform web mercator world coordinates to GL coordinates.

This commit is contained in:
Asheem Mamoowala
2018-04-04 15:08:16 -07:00
parent 275d753e91
commit dc495e1c9d
2 changed files with 7 additions and 0 deletions

View File

@@ -2,6 +2,8 @@
#include <mbgl/style/layer.hpp>
#include <array>
namespace mbgl {
namespace style {
@@ -17,6 +19,7 @@ struct CustomLayerRenderParameters {
double bearing;
double pitch;
double fieldOfView;
std::array<double, 16> projectionMatrix;
};
class CustomLayerHost {

View File

@@ -6,6 +6,7 @@
#include <mbgl/style/layers/custom_layer_impl.hpp>
#include <mbgl/map/transform_state.hpp>
#include <mbgl/gl/gl.hpp>
#include <mbgl/util/mat4.hpp>
namespace mbgl {
@@ -72,6 +73,9 @@ void RenderCustomLayer::render(PaintParameters& paintParameters, RenderSource*)
parameters.bearing = -state.getAngle() * util::RAD2DEG;
parameters.pitch = state.getPitch();
parameters.fieldOfView = state.getFieldOfView();
mat4 projMatrix;
state.getProjMatrix(projMatrix);
parameters.projectionMatrix = projMatrix;
MBGL_CHECK_ERROR(host->render(parameters));