Commit Graph

1664 Commits

Author SHA1 Message Date
Ansis Brammanis
38b5cb0c77 [core, ios] replace altitude with fov
ported from -js: eb6c6596c6a7a61363d30356674e0002153b1d19

`altitude` was a terribly-named variable that was used to indirectly
control the fov. This should eliminate some confusion.

`altitude` was equivalent to `cameraToCenterDistance / height`
2016-12-21 15:46:36 -08:00
Minh Nguyễn
a6b1773a44 Merge branch 'release-ios-v3.4.0' into 1ec5-release-ios-v3.4.0-beta.5-master
Also reran make style-code and manually discarded anything related to fill extrusion layers.
2016-12-20 12:41:40 -08:00
Ivo van Dongen
18730d598d [core] use raii to guard backend deactivation 2016-12-13 10:03:05 -08:00
Ivo van Dongen
c76a933514 [core] use raii to guard backend deactivation 2016-12-12 09:05:23 -05:00
John Firebaugh
3b2a4216a2 [core] Implement circle-stroke properties
Also includes stubs for fill-extrusion layer, because most of the code was auto-generated.
2016-12-09 09:35:21 -08:00
Minh Nguyễn
a39f53df22 [ios, macos] Migrate MGLCustomStyleLayerAdditions to style layer API (#7250)
* [ios, macos] Replaced custom style layer API with MGLOpenGLStyleLayer

Replaced the custom style layer API on MGLMapView with an equally unsupported MGLOpenGLStyleLayer API that nonetheless is consistent with the broader runtime styling API and is compatible with macOS.

Fixed an unrecognized selector crash when wrapping a layer of unrecognized type coming from mbgl.

* [macos] Added lime green layer demo to macosapp

Reprised the demo removed from iosapp in #5091.

* [ios, macos] Rationalized MGLOpenGLStyleLayer API

MGLStyle now strongly references any MGLOpenGLStyleLayer object that’s added to it, in order to prevent pointers from going stale and make it easy for layer drawing code to get more information about the map view. Replaced the MGLOpenGLStyleLayer callback blocks with overridable instance methods. Added internal documentation for each method. Subclassed MGLOpenGLStyleLayer as LimeGreenStyleLayer inside macosapp.

Consolidated -addToMapView: into -addToMapView:belowLayer: to ensure that MGLRedundantLayerException gets raised even if the layer is being inserted rather than added to the bottom of the stack.

* [core] Clarified that rendering happens on the main thread

* [ios, macos] Fixed removing and re-adding MGLOpenGLStyleLayer

Don’t allow index-based layer removal to circumvent -removeFromMapView:, which MGLOpenGLStyleLayer relies on to synchronize the style’s array of MGLOpenGLStyleLayers. When obtaining an MGLOpenGLStyleLayer, get the instance already added to the style instead of creating a new one to wrap the underlying CustomLayer.
2016-12-07 00:01:11 -08:00
John Firebaugh
05b0dcd0f8 [core] Move evaluation algorithm to Function 2016-12-06 15:05:45 -08:00
John Firebaugh
0adf830b9a [core] Inline friend equality operators 2016-12-06 15:05:45 -08:00
Roman Blum
1045934d5e [core, ios, macos] Add image accessor to MGLStyle (#7096)
* [core] Add interface to get image from sprite atlas

* [tests] Add tests for Map::getImage

* [ios, macos] WIP: get MGLImage for name from style

* [ios, macos] Fixed -imageForName:

Convert from sprite images to platform images using the existing encodePNG() function, which is also used for printing. Allow -imageForName: to return nil without an assertion failure. Added a basic test.
2016-12-05 17:16:13 -08:00
Minh Nguyễn
3503c0e767 Merge branch 'release-ios-v3.4.0' into 1ec5-release-ios-v3.4.0-beta.4-master 2016-12-03 15:36:42 -08:00
John Firebaugh
7d16824fda [core] Functions must have at least one stop
This is already enforced by the style validator in mapbox-gl-style-spec. Enforce it here too.
2016-12-01 09:00:06 -08:00
John Firebaugh
3d2d57cd30 [core] Assert valid range for color components 2016-11-29 06:52:24 -08:00
Minh Nguyễn
850b70ff91 [core, ios, macos] Added layers and sources properties to MGLStyle
Added new layers and sources properties to MGLStyle that contain all the style’s layers and sources, respectively. These properties are KVC-compliant with all the mutable to-many methods. Layers are ordered from topmost to bottommost, for consistency with Cocoa APIs where front/first means top and back/last means bottom.

Also added storage for mbgl::style::Source in MGLSource proper for wrapping AnnotationSource. Until the style finishes loading, its name property is set to nil.

Fixes #6003.
2016-11-28 15:45:37 -08:00
Konstantin Käfer
4577c56745 [core] remove unused umbrella header in favor of individual includes 2016-11-22 20:58:51 +01:00
Konstantin Käfer
e76de05402 [build] move logging to util 2016-11-22 20:58:51 +01:00
Konstantin Käfer
117863f111 [build] move headless rendering files to platform/default 2016-11-22 20:58:51 +01:00
Konstantin Käfer
3bc79e316e [build] move default ThreadPool implementation to platform/default 2016-11-22 20:58:51 +01:00
Konstantin Käfer
67ed3ae3eb [build] move GLFW-related files to platform/glfw 2016-11-22 20:58:51 +01:00
Konstantin Käfer
9353fcbf4c [build] move default_styles to platform/default 2016-11-22 20:58:51 +01:00
Konstantin Käfer
a71868fc8d [build] move Reachability to platform/darwin 2016-11-22 20:58:51 +01:00
John Firebaugh
38fcbe21d4 [core] Convert style properties to a tuple-based approach
This converts the style property classes (CirclePaintProperties and so on) to the same tuple-based approach as gl::Attribute and gl::Uniform. The approach is outlined in https://github.com/mapbox/cpp/blob/master/C%2B%2B%20Structural%20Metaprogramming.md.

The main advantage of this approach is it allows writing algorithms that work on sets of style properties, without resorting to code generation or manually repetitive code. This lets us iterate on approaches to data-driven properties more easily.

Another advantage is that the cascading, unevaluated, and evaluated states of a set of properties exist as independent structures, instead of individual properties holding their own state. This is a more functional approach that makes data flow clearer and reduces state.
2016-11-17 15:13:38 -08:00
Jesse Bounds
96a7a4402e [core] Return source and layer ownership (#7014)
When a source or layer is removed transfer ownership back to the
caller so it can (optionally) take it. Preserve the behavior that 
removing a CustomLayer triggers deinitialization.  Deinitialize all 
custom layers when a style is destroyed in case those layers are not 
explicitly removed.
2016-11-13 19:56:29 -08:00
Bruno de Oliveira Abinader
5dcf7ca18e [linux] Added OSMesa headless backend 2016-11-13 16:10:36 -08:00
Jesse Bounds
edf40bb6d9 [core] Return source and layer ownership (#7014)
When a source or layer is removed transfer ownership back to the
caller so it can (optionally) take it. Preserve the behavior that 
removing a CustomLayer triggers deinitialization.  Deinitialize all 
custom layers when a style is destroyed in case those layers are not 
explicitly removed.
2016-11-11 14:40:04 -08:00
John Firebaugh
66bdbc3b96 [core] Introduce gl::Program template 2016-11-08 08:09:29 -08:00
Bruno de Oliveira Abinader
687ee1e1c9 [build] Remove unused gl/implementation.hpp 2016-11-08 18:02:38 +02:00
Bruno de Oliveira Abinader
d0ac12309b [core] Refactor HeadlessBackend 2016-11-08 18:02:38 +02:00
Bruno de Oliveira Abinader
297c303e88 [core] Refactor HeadlessDisplay 2016-11-08 18:02:38 +02:00
Bruno de Oliveira Abinader
e66cc2e583 [linux] Added OSMesa headless backend 2016-11-04 18:43:08 +02:00
Konstantin Käfer
358701f475 [core] add ability to upload alpha-only textures + images 2016-11-01 18:41:52 +01:00
Bruno de Oliveira Abinader
38f536049a [core] Moved util::log2 to its own header
- Added util::{MIN,MAX}_ZOOM_F to avoid consecutive conversions from
double to float
- Move util::log2 to its own header (part of mbgl/math)
2016-10-31 16:53:07 +02:00
John Firebaugh
0e57d10d77 [core] Modern C++ bindings for OpenGL 2016-10-28 17:14:01 -07:00
John Firebaugh
a4c82b8a3b [core] operator bool() must always be explicit
Otherwise, it can participate in unexpected conversions. Case in point: GlyphSet::insert was comparing the result of GlyphMetrics::operator bool() where it wanted to use operator==.
2016-10-28 17:10:45 -07:00
Konstantin Käfer
62b56b799a [core] change std::array<uint16_t, 2> to mbgl::Size 2016-10-27 18:30:58 -07:00
Konstantin Käfer
a4d259c33f [core] move gl::Context to Backend and refactor View 2016-10-25 13:52:36 -07:00
Konstantin Käfer
5cc390d694 [core] separate Backend from View for headless rendering 2016-10-25 13:52:36 -07:00
Mike Morris
7bbd49c72c [core] extract weak_ptr mailbox->receive into Mailbox::maybeReceive 2016-10-20 14:39:11 -04:00
Mike Morris
817c26111a [core] [node] pass thread pool impl to Map constructor
Updates mbgl::Map constructor usage everywhere

Adds NodeThreadPool implementation using AsyncQueue to call
Nan::AsyncQueueWorker from main thread
2016-10-20 14:37:36 -04:00
Ivo van Dongen
ab85fdb452 [glfw] add map change callback methods to glfw_view 2016-10-20 17:02:40 +03:00
Bruno de Oliveira Abinader
ef62b78fce [core] TileCoordinate::fromLatLng no longer depens on TransformState 2016-10-19 08:11:41 +03:00
Bruno de Oliveira Abinader
2188d68b6c [core] Move TransformState::{un,}project() to Projection 2016-10-19 08:11:41 +03:00
Bruno de Oliveira Abinader
f01a829dc9 [core] Move TransformState::worldSize() to Projection 2016-10-19 08:11:41 +03:00
John Firebaugh
e4310aa874 [core] Improve attribute binding API 2016-10-05 10:52:19 -07:00
John Firebaugh
73334ac8fa [core] Move shader and uniform to gl directory 2016-10-05 10:52:19 -07:00
John Firebaugh
7a3bef091e [core] Refactor Buffer 2016-10-05 10:52:19 -07:00
Ivo van Dongen
1bf12e20a6 [core] LocalFileSource implementation and tests 2016-09-30 14:57:26 +02:00
Konstantin Käfer
2ec2860ce5 [core] move OpenGL extension loading to their own headers 2016-09-29 13:19:27 -07:00
Konstantin Käfer
cc78b74098 [core] remove dependence on gl.h types 2016-09-29 10:17:47 -07:00
Konstantin Käfer
15aece8a30 [core] introduces types for GL objects 2016-09-29 10:17:47 -07:00
Konstantin Käfer
a8b007daa0 [core] remove unused GL_TRACK functions 2016-09-28 16:34:07 +02:00