summaryrefslogtreecommitdiff
path: root/misc/proto
diff options
context:
space:
mode:
Diffstat (limited to 'misc/proto')
-rw-r--r--misc/proto/binary_program.proto18
-rw-r--r--misc/proto/glyphs.proto33
-rw-r--r--misc/proto/style.proto110
-rw-r--r--misc/proto/vector_tile.proto109
4 files changed, 270 insertions, 0 deletions
diff --git a/misc/proto/binary_program.proto b/misc/proto/binary_program.proto
new file mode 100644
index 0000000000..9d06a209c3
--- /dev/null
+++ b/misc/proto/binary_program.proto
@@ -0,0 +1,18 @@
+// Protocol Version 1
+
+package mapboxgl.binary_program;
+
+option optimize_for = LITE_RUNTIME;
+
+message binding {
+ required string name = 1;
+ required uint32 value = 2;
+}
+
+message binary_program {
+ required uint32 format = 1;
+ required bytes code = 2;
+ repeated binding attribute = 3;
+ repeated binding uniform = 4;
+ optional string identifier = 5;
+}
diff --git a/misc/proto/glyphs.proto b/misc/proto/glyphs.proto
new file mode 100644
index 0000000000..6930b47a2b
--- /dev/null
+++ b/misc/proto/glyphs.proto
@@ -0,0 +1,33 @@
+// Protocol Version 1
+
+package mapboxgl.glyphs;
+
+option optimize_for = LITE_RUNTIME;
+
+// Stores a glyph with metrics and optional SDF bitmap information.
+message glyph {
+ required uint32 id = 1;
+
+ // A signed distance field of the glyph with a border of 3 pixels.
+ optional bytes bitmap = 2;
+
+ // Glyph metrics.
+ required uint32 width = 3;
+ required uint32 height = 4;
+ required sint32 left = 5;
+ required sint32 top = 6;
+ required uint32 advance = 7;
+}
+
+// Stores fontstack information and a list of faces.
+message fontstack {
+ required string name = 1;
+ required string range = 2;
+ repeated glyph glyphs = 3;
+}
+
+message glyphs {
+ repeated fontstack stacks = 1;
+
+ extensions 16 to 8191;
+}
diff --git a/misc/proto/style.proto b/misc/proto/style.proto
new file mode 100644
index 0000000000..90e5b65061
--- /dev/null
+++ b/misc/proto/style.proto
@@ -0,0 +1,110 @@
+enum bucket_type {
+ fill = 1;
+ line = 2;
+ point = 3;
+
+ background = 15;
+}
+
+enum cap_type {
+ round_cap = 1;
+ butt_cap = 2;
+ square_cap = 3;
+}
+
+enum join_type {
+ miter_join = 1;
+ bevel_join = 2;
+ round_join = 3;
+}
+
+enum winding_type {
+ evenodd = 1;
+ nonzero = 2;
+}
+
+enum property_type {
+ null = 1;
+ constant = 2;
+ stops = 3;
+ linear = 4;
+}
+
+message value {
+ // Exactly one of these values may be present in a valid message
+ optional string string_value = 1;
+ optional float float_value = 2;
+ optional double double_value = 3;
+ optional int64 int_value = 4;
+ optional uint64 uint_value = 5;
+ optional sint64 sint_value = 6;
+ optional bool bool_value = 7;
+
+ extensions 8 to max;
+}
+
+message bucket {
+ required string name = 1;
+ required bucket_type type = 2;
+
+ // Specify what data to pull into this bucket
+ required string source_name = 3;
+ required string source_layer = 4;
+ optional string source_field = 5;
+ repeated value source_value = 6;
+
+ // Specifies how the geometry for this bucket should be created
+ optional cap_type cap = 7;
+ optional join_type join = 8;
+ optional string font = 9;
+ optional float font_size = 10;
+}
+
+message layer {
+ required string name = 1;
+ optional string bucket_name = 2;
+ repeated layer child_layer = 3;
+}
+
+message property {
+ required property_type function = 1;
+ repeated float value = 2 [ packed = true ];
+}
+
+message fill_style {
+ required string layer_name = 1;
+ optional property hidden = 2;
+ optional winding_type winding = 3 [ default = nonzero ];
+ optional property antialias = 4;
+ optional fixed32 fill_color = 5 [ default = 0x000000FF ]; // rgba (=> rgb << 8 | 0xFF for opaque!)
+ optional fixed32 stroke_color = 6; // if none is specified, no stroke will be painted
+ optional property opacity = 7; // values from 0..1
+ optional string image = 8;
+ // TODO: translate x/y
+}
+
+message stroke_style {
+ required string layer_name = 1;
+ optional property hidden = 2;
+ optional fixed32 color = 3 [ default = 0x000000FF ]; // rgba (=> rgb << 8 | 0xFF for opaque!)
+ optional property width = 4;
+ optional property offset = 5;
+ optional property opacity = 6; // values from 0..1
+ // line join + line cap are already defined in the
+ // TODO: dasharray
+ // TODO: image/icon
+ // TODO: translate x/y
+}
+
+message class {
+ required string name = 1;
+ repeated fill_style fill = 2;
+ repeated stroke_style stroke = 3;
+}
+
+// root level object
+message style {
+ repeated bucket bucket = 1;
+ repeated layer layer = 2;
+ repeated class class = 3;
+}
diff --git a/misc/proto/vector_tile.proto b/misc/proto/vector_tile.proto
new file mode 100644
index 0000000000..1cde2c7aa9
--- /dev/null
+++ b/misc/proto/vector_tile.proto
@@ -0,0 +1,109 @@
+// Protocol Version 1
+
+package mapboxgl.vector;
+
+option optimize_for = LITE_RUNTIME;
+
+enum geom_type {
+ Unknown = 0;
+ Point = 1;
+ LineString = 2;
+ Polygon = 3;
+}
+
+// Variant type encoding
+message value {
+ // Exactly one of these values may be present in a valid message
+ optional string string_value = 1;
+ optional float float_value = 2;
+ optional double double_value = 3;
+ optional int64 int_value = 4;
+ optional uint64 uint_value = 5;
+ optional sint64 sint_value = 6;
+ optional bool bool_value = 7;
+
+ extensions 8 to max;
+}
+
+message feature {
+ optional uint64 id = 1;
+
+ // Tags of this feature. Even numbered values refer to the nth
+ // value in the keys list on the tile message, odd numbered
+ // values refer to the nth value in the values list on the tile
+ // message.
+ repeated uint32 tags = 2 [ packed = true ];
+
+ // The type of geometry stored in this feature.
+ optional geom_type type = 3 [ default = Unknown ];
+
+ // Contains a stream of commands and parameters (vertices). The
+ // repeat count is shifted to the left by 3 bits. This means
+ // that the command has 3 bits (0-15). The repeat count
+ // indicates how often this command is to be repeated. Defined
+ // commands are:
+ // - MoveTo: 1 (2 parameters follow)
+ // - LineTo: 2 (2 parameters follow)
+ // - ClosePath: 15 (no parameters follow)
+ //
+ // Ex.: MoveTo(3, 6), LineTo(8, 12), LineTo(20, 34), ClosePath
+ // Encoded as: [ 3 6 18 5 6 12 22 15 ]
+ // == command type 15 (ClosePath)
+ // ===== relative LineTo(+12, +22) == LineTo(20, 34)
+ // === relative LineTo(+5, +6) == LineTo(8, 12)
+ // == [00010 010] = command type 2 (LineTo), length 2
+ // === relative MoveTo(+3, +6)
+ // = implicit command type 1 (MoveTo), length 1
+ // Commands are encoded as uint32 varints, vertex parameters are
+ // encoded as sint32 varints (zigzag). Vertex parameters are
+ // also encoded as deltas to the previous position. The original
+ // position is (0,0)
+ repeated uint32 geometry = 4 [ packed = true ];
+
+ // A list of indices to the geometry array that specify a triangulation of
+ // this geometry. This must only exist if this feature is a polygon.
+ // These are the valid indices for the example above:
+ // 0 ==> (3/6)
+ // 1 ==> (8/12)
+ // 2 ==> (20/34)
+ // Indices beyond 2 are invalid, as the total number of vertices is 3.
+ repeated sint32 triangulation = 5 [ packed = true ];
+
+ // The total number of vertices encoded in the geometry field. This is can
+ // be deduced by manually iterating through the geometry field, but we can
+ // just as well store the number to avoid the overhead on parsing.
+ optional uint32 vertex_count = 6;
+}
+
+message layer {
+ // Any compliant implementation must first read the version
+ // number encoded in this message and choose the correct
+ // implementation for this version number before proceeding to
+ // decode other parts of this message.
+ required uint32 version = 15 [ default = 1 ];
+
+ required string name = 1;
+
+ // The actual features in this tile.
+ repeated feature features = 2;
+
+ // Dictionary encoding for keys
+ repeated string keys = 3;
+
+ // Dictionary encoding for values
+ repeated value values = 4;
+
+ // The bounding box in this tile spans from 0..4095 units
+ optional uint32 extent = 5 [ default = 4096 ];
+
+ // Total vertex count in this layer.
+ optional uint32 vertex_count = 6;
+
+ extensions 16 to max;
+}
+
+message tile {
+ repeated layer layers = 3;
+
+ extensions 16 to 8191;
+}