start to make line stipple themeable
This commit is contained in:
@@ -150,9 +150,17 @@ public class Layers {
|
||||
lineOffset = size * SHORT_BYTES;
|
||||
size += addLayerItems(sbuf, baseLayers, Layer.LINE, 0);
|
||||
|
||||
|
||||
texLineOffset = size * SHORT_BYTES;
|
||||
size += addLayerItems(sbuf, baseLayers, Layer.TEXLINE, 0);
|
||||
for (Layer l = baseLayers; l != null; l= l.next){
|
||||
if (l.type == Layer.TEXLINE){
|
||||
// HACK, see LineTexLayer
|
||||
//sbuf.position(sbuf.position() + 6);
|
||||
addPoolItems(l, sbuf);
|
||||
//l.offset -= 12;
|
||||
}
|
||||
}
|
||||
|
||||
//size += addLayerItems(sbuf, baseLayers, Layer.TEXLINE, 0);
|
||||
|
||||
for (Layer l = textureLayers; l != null; l = l.next) {
|
||||
TextureLayer tl = (TextureLayer) l;
|
||||
@@ -172,18 +180,10 @@ public class Layers {
|
||||
VertexPoolItem last = null, items = null;
|
||||
int size = 0;
|
||||
|
||||
// HACK, see LineTexLayer
|
||||
boolean addOffset = (type == Layer.TEXLINE);
|
||||
|
||||
for (; l != null; l = l.next) {
|
||||
if (l.type != type)
|
||||
continue;
|
||||
|
||||
if (addOffset){
|
||||
sbuf.position(sbuf.position() + 6);
|
||||
addOffset = false;
|
||||
}
|
||||
|
||||
for (VertexPoolItem it = l.pool; it != null; it = it.next) {
|
||||
if (it.next == null){
|
||||
size += it.used;
|
||||
@@ -199,6 +199,7 @@ public class Layers {
|
||||
continue;
|
||||
|
||||
l.offset = pos;
|
||||
|
||||
pos += l.verticesCnt;
|
||||
|
||||
last.next = items;
|
||||
|
||||
@@ -21,6 +21,8 @@ import org.oscim.theme.renderinstruction.Line;
|
||||
|
||||
/**
|
||||
* Layer for textured or stippled lines
|
||||
*
|
||||
* this would be all so much simpler with geometry shaders...
|
||||
*/
|
||||
public final class LineTexLayer extends Layer {
|
||||
// Interleave two segment quads in one block to be able to use
|
||||
@@ -57,6 +59,11 @@ public final class LineTexLayer extends Layer {
|
||||
// 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.
|
||||
|
||||
private static final float COORD_SCALE = GLRenderer.COORD_MULTIPLIER;
|
||||
// scale factor mapping extrusion vector to short values
|
||||
@@ -84,15 +91,11 @@ public final class LineTexLayer extends Layer {
|
||||
|
||||
if (pool == null) {
|
||||
curItem = pool = VertexPool.get();
|
||||
// need to make sure there is one unused
|
||||
// vertex in front for interleaving.
|
||||
|
||||
// HACK add this offset when compiling
|
||||
// otherwise one cant use the full
|
||||
// HACK add one vertex offset when compiling
|
||||
// buffer otherwise one cant use the full
|
||||
// VertexItem
|
||||
//curItem.used = 6;
|
||||
|
||||
verticesCnt = 1;
|
||||
//verticesCnt = 1;
|
||||
}
|
||||
|
||||
VertexPoolItem si = curItem;
|
||||
@@ -207,14 +210,14 @@ public final class LineTexLayer extends Layer {
|
||||
pos += length;
|
||||
}
|
||||
|
||||
evenSegment = even;
|
||||
|
||||
// advance offset to last written position
|
||||
if (!even)
|
||||
opos += 12;
|
||||
|
||||
si.used = opos;
|
||||
curItem = si;
|
||||
|
||||
evenSegment = even;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user