gpu: split camera position from model position

This commit is contained in:
Adam
2018-11-21 15:26:49 -05:00
committed by Adam
parent 67f0672799
commit fd6b67fae2
3 changed files with 16 additions and 14 deletions

View File

@@ -691,10 +691,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
y = 0;
z = tileY * Perspective.LOCAL_TILE_SIZE;
x -= client.getCameraX2();
y -= client.getCameraY2();
z -= client.getCameraZ2();
GpuIntBuffer b = modelBufferUnordered;
++unorderedModels;
@@ -721,10 +717,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
y = 0;
z = tileY * Perspective.LOCAL_TILE_SIZE;
x -= client.getCameraX2();
y -= client.getCameraY2();
z -= client.getCameraZ2();
GpuIntBuffer b = modelBufferUnordered;
++unorderedModels;
@@ -858,7 +850,10 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
.put(client.getCameraPitch())
.put(centerX)
.put(centerY)
.put(client.getScale());
.put(client.getScale())
.put(client.getCameraX2())
.put(client.getCameraY2())
.put(client.getCameraZ2());
uniformBuffer.flip();
gl.glBufferSubData(gl.GL_UNIFORM_BUFFER, 0, uniformBuffer.limit() * Integer.BYTES, uniformBuffer);
@@ -1266,7 +1261,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
buffer.put(tc);
buffer.put(targetBufferOffset);
buffer.put(FLAG_SCENE_BUFFER | (model.getRadius() << 12) | orientation);
buffer.put(x).put(y).put(z);
buffer.put(x + client.getCameraX2()).put(y + client.getCameraY2()).put(z + client.getCameraZ2());
targetBufferOffset += tc * 3;
}
@@ -1309,7 +1304,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
buffer.put(len / 3);
buffer.put(targetBufferOffset);
buffer.put((model.getRadius() << 12) | orientation);
buffer.put(x).put(y).put(z);
buffer.put(x + client.getCameraX2()).put(y + client.getCameraY2()).put(z + client.getCameraZ2());
tempOffset += len;
if (hasUv)