Commit Graph

2843 Commits

Author SHA1 Message Date
Konstantin Käfer
6c91c3e519 [core] replace <regex> usage with plain string code to reduce binary size 2016-11-18 10:38:49 +01:00
Bruno de Oliveira Abinader
e9f849e4d0 [core] Sort symbol render tiles prior to rendering 2016-11-18 09:13:53 +01:00
Bruno de Oliveira Abinader
ce14037b55 [core] Cleanup symbol clipping 2016-11-18 09:13:53 +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
Chris Loer
d4fc66af39 [core] Add minimal line breaking support for RTL text. 2016-11-17 14:33:03 -08:00
Chris Loer
bceeba29a3 [core] Add ICU package for Bidirectional text support and arabic text shaping.
Apply bidi and shaping in symbol_layout.
Add utility functions for converting to and from UTF-16.
2016-11-17 14:33:03 -08:00
Chris Loer
40b0c8d076 [core] Use UTF-16 instead of UTF-32 for label features to avoid extra conversions and reduce in-memory size.
Continue to use uint32 as glyph ID to maintain Glyph PBF, even though we're only using 16 bits of that uint32.
Use std::codecvt instead of boost::unicode_iterator for UTF8->UTF16 conversions.
2016-11-17 14:33:03 -08:00
Konstantin Käfer
117062acc1 [core] cache raster tiles 2016-11-17 11:09:30 +01:00
Molly Lloyd
3380f0803a [core] update native for line property function shaders changes (#6658)
* [core] update shaders for line property functions

update deps, define device pixel ratio for all shaders

[core] create ShaderParameter struct to store pixel ratio and overdraw param

repair rebase errs

update shaders to include pixel ratio

make sure collision_box never overdraws

update test suite, move shaders to Painter::render so the correct pixel ratio is applied

move shader compiling back to the Painter constructor

rebase from shader --> program refactor

re-factor parameters for collisionBox and debug programs

remove unused vars from line-program, move blur math to shader

update core files

remove unecessary files

update shaders PR, remove comments

bump test suite sha

fix formatting, incorporate feedback

refactor program.hpp

* [core] remove line transformations that were moved to the shaders, bump shader sha

* [core] shorten ProgramParameter instantiation

* [core] bump shader+test suite shas
2016-11-16 17:34:33 -08:00
John Firebaugh
9d2be04461 [core] Return to static, per-segment approach to VAOs
This is safer now -- it can be an implementation detail of Segment/Context. And the typing of SegmentVector now ensures that the attributes and program match.
2016-11-15 13:55:08 -08:00
John Firebaugh
377d0fb0d2 [core] Introduce SegmentVector 2016-11-15 13:55:08 -08:00
John Firebaugh
58877d1b3d [core] Assign attribute locations sequentially
Two reasons to prefer explicit sequential location assignment, rather than relying on the GLSL linker to assign locations:

* For data-driven properties, we want to have the option to use glDisableVertexAttribArray plus glVertexAttrib*. In order to use glDisableVertexAttribArray, we must avoid using attribute location 0, which cannot be disabled.
* We want to use the same VAO in cases where, say, a fill layer might be rendered with FillProgram at first, and then FillPatternProgram later. VAOs do not store the program binding, only the attribute bindings, so as long as the two programs have the same attributes and attribute locations, only a single VAO (per segment) is needed.
2016-11-15 13:55:08 -08:00
John Firebaugh
bcad3b6d4b [core] Use indexed rendering for collision boxes 2016-11-15 12:39:49 -08:00
Minh Nguyễn
dbd2235744 [core] Line-break ideographic text by character (#6828)
* [core] Line-break ideographic text by character

Allow a line break to be inserted after any supported Chinese, Japanese, or Yi character in a point-placed label. Balance the lines unless non-ideographic text such as Latin letters are present.

Fixes #1223.

* [core] Moved more character classing into util::i18n

* [core] Detect character properties by Unicode block

* [test] Reenabled ideographic breaking tests
2016-11-14 14:53:21 -08:00
Konstantin Käfer
a7fa97e8a3 [core] don't run symbol placement more often than necessary 2016-11-14 10:35:15 +01:00
Konstantin Käfer
35a66eb2bd [core] don't show OpenGL debug information on startup 2016-11-14 10:25:48 +01: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
Ivo van Dongen
39b0bc0a40 [core] symbol layer - recalculate style on icon/text size changes 2016-11-11 20:18:16 +01:00
Tobrun
720a0256f5 Default Style Camera on Android (#7019)
* [core] - do not set camera mutated to true when calling Map::getLatLng

* [android] - correctly check if a Map is created without a camera position
2016-11-11 18:13:25 +01:00
John Firebaugh
31047b6cb5 [core] Default camera position to that specified by the style 2016-11-09 17:27:35 -08:00
John Firebaugh
7ea0457e89 [core] Ensure correct GL context in Map::onLowMemory() 2016-11-09 09:57:20 -08:00
Konstantin Käfer
1afd993184 [core] don't initialize with Duration::min() to avoid arithmetic overflows
In FrameHistory::needsAnimation, we are computing "time - previousTime", but since previousTime was
initialized to Duration::min(), we got a integer overflow, which produced invalid values.
2016-11-09 17:55:59 +01:00
Konstantin Käfer
bcdbbbcac2 [core] don't assign clip IDs to tiles that aren't rendered 2016-11-08 18:09:58 +01:00
John Firebaugh
3b38cf48b7 [core] Require point size / line width for DrawMode constructors 2016-11-08 08:09:29 -08:00
John Firebaugh
52be5d480d [core] Put ignore in util namespace 2016-11-08 08:09:29 -08:00
John Firebaugh
d1e2fe511e [core] Introduce and use IndexedTuple 2016-11-08 08:09:29 -08:00
John Firebaugh
1db2ffbc1b [core] Use gl::Program to resolve some rough edges in the GL binding types
* Extract `ignore` util to separate header.
* `Segment` now tracks offset and length of indices, rather than primitives. This is more natural.
* Introduce `VertexVector` and `IndexVector` types. These types carry information about the intended draw mode (`Triangles`, `LineStrip`, etc.), and ensure that elements are always appended in a group size appropriate for that draw mode, for both indexed and unindexed rendering.
* `Program`, rather than `Drawable`, is now the unifying object for draw calls. `Program` is the best place to type check the draw call, because it is typed to carry information about the intended primitive, vertex type, attributes, and uniforms.
* Use the debug shaders for debug tile rendering, like gl-js.
* Fix the draw mode for background. It was drawing triangle strips with a triangles array. Surprised this didn’t cause issues. Now it’s type checked.
2016-11-08 08:09:29 -08:00
John Firebaugh
66bdbc3b96 [core] Introduce gl::Program template 2016-11-08 08:09:29 -08:00
John Firebaugh
36210fe4e9 [core] Make attribute binding more similar to uniform binding 2016-11-08 08:09:28 -08:00
John Firebaugh
aa08796767 [core] Separate pathway for notifying workers of new images/glyphs 2016-11-07 10:16:35 -08:00
Konstantin Käfer
1533d28314 [core] move Value class outside of Uniform to enforce explicit construction 2016-11-07 18:51:47 +01:00
Konstantin Käfer
bd3d4bc89a [core] force explicit initialization of uniform values
force users to use the actual names to avoid implicit conversion accidentally targeting the wrong shader
2016-11-07 18:51:47 +01:00
Konstantin Käfer
ed72581e0c [core] remove Uniforms::value in favor of direct construction 2016-11-07 18:51:47 +01:00
Konstantin Käfer
afd43eea3a [core] remove gl.hpp from all headers that don't need it 2016-11-04 21:24:05 +01:00
Konstantin Käfer
7b772611d5 [core] move pixel blitting to gl::Context 2016-11-04 21:24:05 +01:00
Konstantin Käfer
29c5c13aa2 [core] move OpenGL debug information printing to core 2016-11-04 21:24:05 +01:00
Konstantin Käfer
c90a559599 [core] move framebuffer reading to gl::Context 2016-11-04 21:24:05 +01:00
Konstantin Käfer
eed16cb1bb [core] add state tracking to pixel transfer 2016-11-04 21:24:05 +01:00
Konstantin Käfer
008a83b915 [core] add state tracking to pixel store packing alignment 2016-11-04 21:24:05 +01:00
Mike Morris
39e9b30ebc [core] add more detail to invalid metrics error in createSpriteImage 2016-11-04 14:47:34 -04:00
Bruno de Oliveira Abinader
3f5972cba0 [core] Fix render tile ordering when querying sources 2016-11-04 18:43:08 +02:00
Bruno de Oliveira Abinader
549929cefd [core] Set bucket segments to initialize empty 2016-11-02 18:12:28 +02:00
Konstantin Käfer
e4e9b3a2f0 [core] convert FrameHistory to use managed texture handling 2016-11-01 18:41:52 +01:00
Konstantin Käfer
ed155460d3 [core] convert LineAtlas to use managed texture handling 2016-11-01 18:41:52 +01:00
Konstantin Käfer
7b50cac49f [core] convert GlyphAtlas to use managed texture handling 2016-11-01 18:41:52 +01:00
Konstantin Käfer
358701f475 [core] add ability to upload alpha-only textures + images 2016-11-01 18:41:52 +01:00
Konstantin Käfer
9e3839781f [core] convert SpriteAtlas to use managed texture handling 2016-11-01 18:41:52 +01:00
Bruno de Oliveira Abinader
e2981c890e Revert "[core] Don't use GL_LINEAR if panning w/o rotation nor pitch"
This reverts commit a70bfd8910.
2016-11-01 17:44:34 +02:00
Konstantin Käfer
bb6e39a1cf [core] fix depth/stencil visualization
The previous code didn't set the packing correctly, which meant that we had a buffer overrun in the debug code.
2016-11-01 10:46:04 +01:00
Konstantin Käfer
f7801e5d82 [core] correctly set the framebuffer size on retina screens
Also asserts in Debug mode that the internal state and the OpenGL state are identical
2016-11-01 10:46:04 +01:00