Merge pull request #603 from Gustl22/short_constant
Renderer: replace with SHORT_BYTES constant for better readability
This commit is contained in:
commit
e773d868f1
@ -23,6 +23,7 @@ import org.oscim.backend.GL;
|
|||||||
import org.oscim.core.Tile;
|
import org.oscim.core.Tile;
|
||||||
import org.oscim.renderer.bucket.ExtrusionBucket;
|
import org.oscim.renderer.bucket.ExtrusionBucket;
|
||||||
import org.oscim.renderer.bucket.ExtrusionBuckets;
|
import org.oscim.renderer.bucket.ExtrusionBuckets;
|
||||||
|
import org.oscim.renderer.bucket.RenderBuckets;
|
||||||
import org.oscim.utils.FastMath;
|
import org.oscim.utils.FastMath;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -82,7 +83,7 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
|||||||
for (ExtrusionBucket eb = ebs.buckets(); eb != null; eb = eb.next()) {
|
for (ExtrusionBucket eb = ebs.buckets(); eb != null; eb = eb.next()) {
|
||||||
|
|
||||||
gl.vertexAttribPointer(vertexPointer, 3,
|
gl.vertexAttribPointer(vertexPointer, 3,
|
||||||
GL.SHORT, false, 8,
|
GL.SHORT, false, RenderBuckets.SHORT_BYTES * 4,
|
||||||
eb.getVertexOffset());
|
eb.getVertexOffset());
|
||||||
|
|
||||||
int sumIndices = eb.idx[0] + eb.idx[1] + eb.idx[2];
|
int sumIndices = eb.idx[0] + eb.idx[1] + eb.idx[2];
|
||||||
@ -188,10 +189,10 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gl.vertexAttribPointer(s.aPos, 3, GL.SHORT,
|
gl.vertexAttribPointer(s.aPos, 3, GL.SHORT,
|
||||||
false, 8, eb.getVertexOffset());
|
false, RenderBuckets.SHORT_BYTES * 4, eb.getVertexOffset());
|
||||||
|
|
||||||
gl.vertexAttribPointer(s.aLight, 2, GL.UNSIGNED_BYTE,
|
gl.vertexAttribPointer(s.aLight, 2, GL.UNSIGNED_BYTE,
|
||||||
false, 8, eb.getVertexOffset() + 6);
|
false, RenderBuckets.SHORT_BYTES * 4, eb.getVertexOffset() + RenderBuckets.SHORT_BYTES * 3);
|
||||||
|
|
||||||
/* draw extruded outlines (mMesh == false) */
|
/* draw extruded outlines (mMesh == false) */
|
||||||
if (eb.idx[0] > 0) {
|
if (eb.idx[0] > 0) {
|
||||||
|
@ -219,10 +219,10 @@ public class BitmapBucket extends TextureBucket {
|
|||||||
int off = (t.offset + i) * 8 + tb.vertexOffset;
|
int off = (t.offset + i) * 8 + tb.vertexOffset;
|
||||||
|
|
||||||
gl.vertexAttribPointer(s.aPos, 2,
|
gl.vertexAttribPointer(s.aPos, 2,
|
||||||
GL.SHORT, false, 12, off);
|
GL.SHORT, false, RenderBuckets.SHORT_BYTES * 6, off);
|
||||||
|
|
||||||
gl.vertexAttribPointer(s.aTexCoord, 2,
|
gl.vertexAttribPointer(s.aTexCoord, 2,
|
||||||
GL.SHORT, false, 12, off + 8);
|
GL.SHORT, false, RenderBuckets.SHORT_BYTES * 6, off + RenderBuckets.SHORT_BYTES * 4);
|
||||||
|
|
||||||
int numIndices = t.indices - i;
|
int numIndices = t.indices - i;
|
||||||
if (numIndices > MAX_INDICES)
|
if (numIndices > MAX_INDICES)
|
||||||
|
@ -145,7 +145,7 @@ public class TextureBucket extends RenderBucket {
|
|||||||
for (int i = 0; i < t.indices; i += MAX_INDICES) {
|
for (int i = 0; i < t.indices; i += MAX_INDICES) {
|
||||||
/* to.offset * (24(shorts) * 2(short-bytes)
|
/* to.offset * (24(shorts) * 2(short-bytes)
|
||||||
* / 6(indices) == 8) */
|
* / 6(indices) == 8) */
|
||||||
int off = (t.offset + i) * 8 + tb.vertexOffset;
|
int off = (t.offset + i) * RenderBuckets.SHORT_BYTES * 4 + tb.vertexOffset;
|
||||||
|
|
||||||
int numIndices = t.indices - i;
|
int numIndices = t.indices - i;
|
||||||
if (numIndices > MAX_INDICES)
|
if (numIndices > MAX_INDICES)
|
||||||
@ -165,10 +165,10 @@ public class TextureBucket extends RenderBucket {
|
|||||||
|
|
||||||
public void render(int offset, int numIndices) {
|
public void render(int offset, int numIndices) {
|
||||||
gl.vertexAttribPointer(shader.aPos, 4, GL.SHORT,
|
gl.vertexAttribPointer(shader.aPos, 4, GL.SHORT,
|
||||||
false, 12, offset);
|
false, RenderBuckets.SHORT_BYTES * 6, offset);
|
||||||
|
|
||||||
gl.vertexAttribPointer(shader.aTexCoord, 2, GL.SHORT,
|
gl.vertexAttribPointer(shader.aTexCoord, 2, GL.SHORT,
|
||||||
false, 12, offset + 8);
|
false, RenderBuckets.SHORT_BYTES * 6, offset + RenderBuckets.SHORT_BYTES * 4);
|
||||||
|
|
||||||
gl.drawElements(GL.TRIANGLES, numIndices,
|
gl.drawElements(GL.TRIANGLES, numIndices,
|
||||||
GL.UNSIGNED_SHORT, 0);
|
GL.UNSIGNED_SHORT, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user