[core] Add Projection matrix to CustomLayerRenderParameters to transform web mercator world coordinates to GL coordinates.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user