@Override public void compile(ShortBuffer vertexBuffer, ShortBuffer indexBuffer) { mClipper = null; if (mVertexMap != null) { vertexPool.releaseAll(mVertexMap.releaseItems()); mVertexMap = vertexMapPool.release(mVertexMap); mVertexMap = null; } if (sumVertices == 0) { return; } indexOffset = indexBuffer.position(); for (int i = 0; i <= IND_MESH; i++) { for (VertexItem vi = mIndices[i]; vi != null; vi = vi.next) { indexBuffer.put(vi.vertices, 0, vi.used); numIndices[i] += vi.used; } } // log.debug("INDEX HITS " + numIndexHits + " / " + sumVertices + " / " + sumIndices); offset = vertexBuffer.position() * 2; for (VertexItem vi = mVertices; vi != null; vi = vi.next) vertexBuffer.put(vi.vertices, 0, vi.used); clear(); }
@Override protected void clear() { mClipper = null; if (mVertexMap != null) { vertexPool.releaseAll(mVertexMap.releaseItems()); mVertexMap = vertexMapPool.release(mVertexMap); mVertexMap = null; } if (mIndices != null) { for (int i = 0; i <= IND_MESH; i++) mIndices[i] = VertexItem.pool.releaseAll(mIndices[i]); mIndices = null; mVertices = VertexItem.pool.releaseAll(mVertices); } }