diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java b/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java index 2b398d8b3..1e71ff0c2 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java +++ b/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java @@ -12,12 +12,12 @@ public final class FogUniforms extends UniformWriter { var color = RenderSystem.getShaderFogColor(); ptr = writeFloat(ptr, color[0]); - ptr = writeFloat(ptr + 4, color[1]); - ptr = writeFloat(ptr + 8, color[2]); - ptr = writeFloat(ptr + 12, color[3]); - ptr = writeFloat(ptr + 16, RenderSystem.getShaderFogStart()); - ptr = writeFloat(ptr + 20, RenderSystem.getShaderFogEnd()); - ptr = writeInt(ptr + 24, RenderSystem.getShaderFogShape() + ptr = writeFloat(ptr, color[1]); + ptr = writeFloat(ptr, color[2]); + ptr = writeFloat(ptr, color[3]); + ptr = writeFloat(ptr, RenderSystem.getShaderFogStart()); + ptr = writeFloat(ptr, RenderSystem.getShaderFogEnd()); + ptr = writeInt(ptr, RenderSystem.getShaderFogShape() .getIndex()); BUFFER.markDirty(); diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java b/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java index 891b790d3..9951abb01 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java +++ b/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java @@ -47,7 +47,7 @@ class UniformWriter { } static long writeMat4(long ptr, Matrix4f mat) { - MatrixMath.writeUnsafe(mat, ptr); + MatrixMath.writeUnsafe(ptr, mat); return ptr + 64; } diff --git a/src/main/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java b/src/main/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java index b7bcb16be..2f6e8ce47 100644 --- a/src/main/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java +++ b/src/main/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java @@ -28,8 +28,8 @@ public final class InstanceTypes { MemoryUtil.memPutShort(ptr + 6, (short) (instance.overlay >> 16 & 0xFFFF)); MemoryUtil.memPutShort(ptr + 8, (short) (instance.packedLight & 0xFFFF)); MemoryUtil.memPutShort(ptr + 10, (short) (instance.packedLight >> 16 & 0xFFFF)); - MatrixMath.writeUnsafe(instance.model, ptr + 12); - MatrixMath.writeUnsafe(instance.normal, ptr + 76); + MatrixMath.writeUnsafe(ptr + 12, instance.model); + MatrixMath.writeUnsafe(ptr + 76, instance.normal); }) .vertexShader(Flywheel.rl("instance/transformed.vert")) .cullShader(Flywheel.rl("instance/cull/transformed.glsl")) diff --git a/src/main/java/com/jozufozu/flywheel/lib/math/MatrixMath.java b/src/main/java/com/jozufozu/flywheel/lib/math/MatrixMath.java index 257598838..428e3a89b 100644 --- a/src/main/java/com/jozufozu/flywheel/lib/math/MatrixMath.java +++ b/src/main/java/com/jozufozu/flywheel/lib/math/MatrixMath.java @@ -50,7 +50,7 @@ public final class MatrixMath { return fma(matrix.m02(), x, fma(matrix.m12(), y, matrix.m22() * z)); } - public static void writeUnsafe(Matrix4f matrix, long ptr) { + public static void writeUnsafe(long ptr, Matrix4f matrix) { MemoryUtil.memPutFloat(ptr, matrix.m00()); MemoryUtil.memPutFloat(ptr + 4, matrix.m01()); MemoryUtil.memPutFloat(ptr + 8, matrix.m02()); @@ -69,7 +69,7 @@ public final class MatrixMath { MemoryUtil.memPutFloat(ptr + 60, matrix.m33()); } - public static void writeUnsafe(Matrix3f matrix, long ptr) { + public static void writeUnsafe(long ptr, Matrix3f matrix) { MemoryUtil.memPutFloat(ptr, matrix.m00()); MemoryUtil.memPutFloat(ptr + 4, matrix.m01()); MemoryUtil.memPutFloat(ptr + 8, matrix.m02());