diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-09 16:52:59 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-11 12:44:54 -0800 |
commit | 65b3220368f669dd7ddbcb06e95019319e0c536a (patch) | |
tree | f0e5a437f11feb231336dc7aa4ce67fd07ebab92 /include/mbgl/style | |
parent | 78691fa9e61dadbb73be28bcac1a606d7a029ad4 (diff) | |
download | qtlocation-mapboxgl-65b3220368f669dd7ddbcb06e95019319e0c536a.tar.gz |
[core] Reduce custom layer API to lowest common denominator
Diffstat (limited to 'include/mbgl/style')
-rw-r--r-- | include/mbgl/style/types.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/mbgl/style/types.hpp b/include/mbgl/style/types.hpp index 95944ce18f..38915db7d8 100644 --- a/include/mbgl/style/types.hpp +++ b/include/mbgl/style/types.hpp @@ -189,6 +189,45 @@ MBGL_DEFINE_ENUM_CLASS(TextTransformTypeClass, TextTransformType, { { TextTransformType::Lowercase, "lowercase" }, }); +/** + * Initialize any GL state needed by the custom layer. This method is called once, from the + * rendering thread, at a point when the GL context is active but before rendering for the + * first time. + * + * Resources that are acquired in this method must be released in the UninitializeFunction. + */ +using CustomLayerInitializeFunction = void (*)(void* context); + +/** + * Parameters that define the current camera position for a CustomLayerRenderFunction. + */ +struct CustomLayerRenderParameters { + double width; + double height; + double latitude; + double longitude; + double zoom; + double bearing; + double pitch; + double altitude; +}; + +/** + * Render the layer. This method is called once per frame. The implementation should not make + * any assumptions about the GL state (other than that the correct context is active). It may + * make changes to the state, and is not required to reset values such as the depth mask, stencil + * mask, and corresponding test flags to their original values. + */ +using CustomLayerRenderFunction = void (*)(void* context, const CustomLayerRenderParameters&); + +/** + * Destroy any GL state needed by the custom layer, and deallocate context, if necessary. This + * method is called once, from the rendering thread, at a point when the GL context is active. + * + * Note that it may be called even when the InitializeFunction has not been called. + */ +using CustomLayerDeinitializeFunction = void (*)(void* context); + } // namespace mbgl #endif |