RenderElement for textured or stippled lines
Interleave two segment quads in one block to be able to use
vertices twice. pos0 and pos1 use the same vertex array where
pos1 has an offset of one vertex. The vertex shader will use
pos0 when the vertexId is even, pos1 when the Id is odd.
As there is no gl_VertexId in gles 2.0 an additional 'flip'
array is used. Depending on 'flip' extrusion is inverted.
Indices and flip buffers can be static.
First pass: using even vertex array positions
(used vertices are in braces)
vertex id 0 1 2 3 4 5 6 7
pos0 x (0) 1 (2) 3 (4) 5 (6) 7 x
pos1 x (0) 1 (2) 3 (4) 5 (6) 7 x
flip 0 1 0 1 0 1 0 1
Second pass: using odd vertex array positions
vertex id 0 1 2 3 4 5 6 7
pos0 x 0 (1) 2 (3) 4 (5) 6 (7) x
pos1 x 0 (1) 2 (3) 4 (5) 6 (7) x
flip 0 1 0 1 0 1 0 1
Vertex layout:
[2 short] position,
[2 short] extrusion,
[1 short] line length
[1 short] unused
indices, for two blocks:
0, 1, 2,
2, 1, 3,
4, 5, 6,
6, 5, 7,
BIG NOTE: renderer assumes to be able to offset vertex array position
so that in the first pass 'pos1' offset will be < 0 if no data precedes
- in our case there is always the polygon fill array at start
- see addLine hack otherwise.