VertexData: docs
- remove superfluous static get()
This commit is contained in:
parent
123b0aa098
commit
a835d44187
@ -81,7 +81,7 @@ public class ExtrusionLayer extends RenderElement {
|
|||||||
mIndices = new VertexData[5];
|
mIndices = new VertexData[5];
|
||||||
|
|
||||||
for (int i = 0; i <= IND_MESH; i++)
|
for (int i = 0; i <= IND_MESH; i++)
|
||||||
mIndices[i] = VertexData.get();
|
mIndices[i] = new VertexData();
|
||||||
|
|
||||||
mClipper = new LineClipper(0, 0, Tile.SIZE, Tile.SIZE);
|
mClipper = new LineClipper(0, 0, Tile.SIZE, Tile.SIZE);
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ public class ExtrusionLayer extends RenderElement {
|
|||||||
mGroundResolution = groundResolution;
|
mGroundResolution = groundResolution;
|
||||||
|
|
||||||
mIndices = new VertexData[5];
|
mIndices = new VertexData[5];
|
||||||
mIndices[4] = VertexData.get();
|
mIndices[4] = new VertexData();
|
||||||
|
|
||||||
synchronized (vertexPool) {
|
synchronized (vertexPool) {
|
||||||
mVertexMap = vertexMapPool.get();
|
mVertexMap = vertexMapPool.get();
|
||||||
|
@ -25,11 +25,26 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A linked list of array chunks to hold temporary vertex data.
|
||||||
|
*
|
||||||
* TODO override append() etc to update internal (cur) state.
|
* TODO override append() etc to update internal (cur) state.
|
||||||
*/
|
*/
|
||||||
public class VertexData extends Inlist.List<Chunk> {
|
public class VertexData extends Inlist.List<Chunk> {
|
||||||
static final Logger log = LoggerFactory.getLogger(VertexData.class);
|
static final Logger log = LoggerFactory.getLogger(VertexData.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Size of array chunks. Must be multiple of:
|
||||||
|
* 4 (LineLayer/PolygonLayer),
|
||||||
|
* 24 (TexLineLayer - one block, i.e. two segments)
|
||||||
|
* 24 (TextureLayer)
|
||||||
|
*/
|
||||||
|
public static final int SIZE = 360;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shared chunk pool size.
|
||||||
|
*/
|
||||||
|
private static final int MAX_POOL = 500;
|
||||||
|
|
||||||
public static class Chunk extends Inlist<Chunk> {
|
public static class Chunk extends Inlist<Chunk> {
|
||||||
public final short[] vertices = new short[SIZE];
|
public final short[] vertices = new short[SIZE];
|
||||||
public int used;
|
public int used;
|
||||||
@ -78,16 +93,8 @@ public class VertexData extends Inlist.List<Chunk> {
|
|||||||
return super.clear();
|
return super.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int MAX_POOL = 500;
|
|
||||||
|
|
||||||
private final static Pool pool = new Pool();
|
private final static Pool pool = new Pool();
|
||||||
|
|
||||||
/* Must be multiple of
|
|
||||||
* 4 (LineLayer/PolygonLayer),
|
|
||||||
* 24 (TexLineLayer - one block, i.e. two segments)
|
|
||||||
* 24 (TextureLayer) */
|
|
||||||
public static final int SIZE = 360;
|
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
pool.releaseAll(super.clear());
|
pool.releaseAll(super.clear());
|
||||||
used = SIZE; /* set SIZE to get new item on add */
|
used = SIZE; /* set SIZE to get new item on add */
|
||||||
@ -184,11 +191,11 @@ public class VertexData extends Inlist.List<Chunk> {
|
|||||||
used += 6;
|
used += 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VertexData get() {
|
/**
|
||||||
return new VertexData();
|
* Direct access to the current chunk of VertexData. Use with care!
|
||||||
}
|
*
|
||||||
|
* When changing the position use releaseChunk to update internal state
|
||||||
/** When changing the position releaseChunk to update internal state */
|
*/
|
||||||
public Chunk obtainChunk() {
|
public Chunk obtainChunk() {
|
||||||
if (used == SIZE)
|
if (used == SIZE)
|
||||||
getNext();
|
getNext();
|
||||||
@ -201,16 +208,16 @@ public class VertexData extends Inlist.List<Chunk> {
|
|||||||
used = cur.used;
|
used = cur.used;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Do not use! */
|
||||||
public void seek(int offset) {
|
public void seek(int offset) {
|
||||||
used += offset;
|
used += offset;
|
||||||
cur.used = used;
|
cur.used = used;
|
||||||
|
|
||||||
if (used > SIZE || used < 0)
|
if (used > SIZE || used < 0)
|
||||||
throw new IllegalStateException("seekkeed: " + offset + ":" + used);
|
throw new IllegalStateException("seeked too far: " + offset + "/" + used);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean empty() {
|
public boolean empty() {
|
||||||
return cur == null;
|
return cur == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user