Allow multiple TextureAtlas per SymbolBucket (#303)
This commit is contained in:
17
vtm/src/org/oscim/renderer/bucket/SymbolBucket.java
Normal file → Executable file
17
vtm/src/org/oscim/renderer/bucket/SymbolBucket.java
Normal file → Executable file
@@ -80,6 +80,7 @@ public final class SymbolBucket extends TextureBucket {
|
||||
prevTextures = textures;
|
||||
textures = null;
|
||||
TextureItem t = null;
|
||||
TextureItem lastTexture = null;
|
||||
|
||||
for (SymbolItem it = mSymbols.head(); it != null; ) {
|
||||
int width = 0, height = 0;
|
||||
@@ -88,12 +89,24 @@ public final class SymbolBucket extends TextureBucket {
|
||||
|
||||
// FIXME Use simultaneously TextureAtlas and external symbols
|
||||
if (it.texRegion != null) {
|
||||
/* FIXME This work only with one TextureAtlas per SymbolBucket */
|
||||
if (textures == null) {
|
||||
if (it.texRegion.texture.id == -1) {
|
||||
//upload texture for give correct texID
|
||||
it.texRegion.texture.upload();
|
||||
}
|
||||
|
||||
if (textures == null || lastTexture == null || lastTexture.id != it.texRegion.texture.id) {
|
||||
/* clone TextureItem to use same texID with
|
||||
* multiple TextureItem */
|
||||
int nextOffset = 0;
|
||||
|
||||
if (t != null) {
|
||||
nextOffset = t.offset + t.indices;
|
||||
}
|
||||
|
||||
t = TextureItem.clone(it.texRegion.texture);
|
||||
t.offset = nextOffset;
|
||||
textures = Inlist.appendItem(textures, t);
|
||||
lastTexture = t;
|
||||
}
|
||||
|
||||
TextureAtlas.Rect r = it.texRegion.rect;
|
||||
|
||||
3
vtm/src/org/oscim/renderer/bucket/TextureItem.java
Normal file → Executable file
3
vtm/src/org/oscim/renderer/bucket/TextureItem.java
Normal file → Executable file
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2012, 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -42,7 +43,7 @@ public class TextureItem extends Inlist<TextureItem> {
|
||||
/**
|
||||
* texture ID
|
||||
*/
|
||||
private int id;
|
||||
int id;
|
||||
|
||||
/**
|
||||
* current settings
|
||||
|
||||
Reference in New Issue
Block a user